Questions tagged [elisp]

Emacs Lisp is the extension language for the GNU Emacs text editor, and in fact, most of the functionality of Emacs is implemented using Emacs Lisp. Users generally customize Emacs' behavior by adding Emacs Lisp statements to their `~/.emacs`, or writing separate packages.

Emacs Lisp is the extension language for the GNU Emacs text editor, and in fact, most of the functionality of Emacs is implemented using Emacs Lisp. Users generally customize Emacs' behavior by adding Emacs Lisp statements to their ~/.emacs or ~/.emacs.d/init.el file, or writing separate packages. A guide to learning Emacs Lisp for non-programmers can be found here.

Emacs Lisp differs from most other lisps in two main ways:

  1. It has special features for scanning and parsing text, as well as features for handling files, buffers, arrays, displays, and subprocesses. This is due to the fact that it is designed to be used in a text editor.
  2. It uses primarily dynamic scope as opposed to lexical scope. This was done very intentionally, the reasons are well explained in the 1981 paper on Emacs. Lexical scope has been introduced only recently and, while not yet widely adopted, is expected to become increasingly important in future versions according to the manual.

Wisdom from the Stack

Emacs on Stack Exchange

3773 questions
15
votes
2 answers

GLSL major mode for Emacs?

I found this link http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/, but there isn't a lot of description around it, aside that it's "simple". Ideally, I'd like an extension to CcMode that can do it, or at least a mode that can handle…
Branan
  • 1,819
  • 15
  • 21
15
votes
3 answers

emacs: is there a clear example of multi-line font-locking?

Some background, I'm comfortable with Emacs Lisp, and have written lots of lines of it. However I've never written a major mode, so I'm fairly new to how the font-locking mechanism works. For my current project, I'd like to add inlined javascript…
event_jr
  • 17,467
  • 4
  • 47
  • 62
15
votes
6 answers

How to call interactive Emacs Lisp function with a prefix argument, from another Emacs Lisp function?

I want to write an Emacs Lisp function that will turn on flyspell-mode regardless of the current state of the mode. Function flyspell-mode-on is deprecated. The documentation suggests that a positive prefix argument will turn flyspell-mode, but…
Norman Ramsey
  • 198,648
  • 61
  • 360
  • 533
15
votes
2 answers

Emacs Lisp: how to avoid inserting a duplicate list item?

How do I check if a string is already in a list in Emacs Lisp? I need to check if a certain path string is already in exec-path, and then add it to that list if it's not.
λ Jonas Gorauskas
  • 6,121
  • 6
  • 45
  • 66
15
votes
1 answer

answering/asking SO questions from emacs.?

Right now I am using gnus to read SO questions by subscribing interested tags from gwene. I can only see/read the Question and not the answers. Is there a plugin to answer/ask SO question. Of course I can use edit-server to compose the messages…
kindahero
  • 5,817
  • 3
  • 25
  • 32
15
votes
1 answer

emacs: how to disable .# files creation

Possible Duplicate: Why does emacs create temporary symbolic links for modified files? Every time I edit file emacs creates file similar to: lrwxrwxrwx 1 vladimir vladimir 49 2011-11-23 19:20 .#models.py -> vladimir@host.15570:1322037576 I…
Vladimir Mihailenco
  • 3,382
  • 2
  • 24
  • 38
15
votes
2 answers

emacs lisp: how to add to link/hyperlink to another file just like that in *H e l p*

we can get help with "C-h ..." and emacs show a Help buffer,and jump to other place with the link . How can I make something like that with elisp, link to another buffer or show something else?
Eric.Q
  • 703
  • 1
  • 9
  • 21
15
votes
3 answers

Emacs truncate lines in all buffers

What can I put in my .emacs file so that all lines an any kind of buffer always truncate if too long. I do this mostly because I tend to open many frames and it gets hard to read on a small screen if my 80 char lines get wrapped 2 or 3 times over.
Jesus Ramos
  • 22,940
  • 10
  • 58
  • 88
15
votes
3 answers

Simple tcp client examples in emacs elisp?

I'm trying to learn emacs elisp and trying to write a little program to connect to a TCP/IP port and process records that come back. In one case I'll be parsing CSV data and in the another, I'll be parsing JSON (e.g. from GPSD, and json.el…
Kurt Schwehr
  • 2,638
  • 3
  • 24
  • 41
15
votes
6 answers

in Emacs, what's the best way for keyboard-escape-quit not destroy other windows?

EDIT: I understand there is keyboard-quit (which is normally bound to C-g); but I'm more interested to know about how one deals with editing functions that come with Emacs (like in this case). I run into this kind of situations from time to time…
polyglot
  • 9,945
  • 10
  • 49
  • 63
15
votes
6 answers

Killing buffers whose names start with a particular string

Here's my problem: I use Emacs and get lots of buffers that are pretty useless all the time, like *Messages* or *Completions*. I want to bind \C-y to close all buffers that start with * except for *shell* (and *shell* < k >) buffers. To do that, I'd…
Dan Filimon
  • 1,419
  • 14
  • 16
15
votes
1 answer

Emacs align-regexp on = but not ==

I am working in Haskell and frequently come across code similar to the following: func i j | i == j = i | otherwise = j I want to align on the '=' character using align-regexp but don't have the elisp knowhow. I have tried just doing " =…
Karl
  • 1,143
  • 6
  • 20
15
votes
6 answers

How viable is emacs LISP aside from editing emacs?

I'm in my second year of my CS major, and I've only had courses in C (first course and then a polymorphic data structures course), C++ (OOP focus), MIPS assembly, and a compiler course. I worked in WinForms and C# over the summer. I worked through…
Kizaru
  • 2,443
  • 3
  • 24
  • 39
15
votes
6 answers

How can I easily reload Emacs lisp code as I am editing it?

As an Emacs beginner, I am working on writing a minor mode. My current (naive) method of programming elisp consists of making a change, closing out Emacs, restarting Emacs, and observing the change. How can I streamline this process? Is there a…
davidscolgan
  • 7,508
  • 9
  • 59
  • 78
15
votes
3 answers

How to create keybindings for a custom minor mode in Emacs

Question: How do I create custom keybindings for minor modes? Something like this. Here is what I have so far. I'm trying to get just one custom keybinding to work: (define-minor-mode num-mode "Toggle the Num pad keys. With no argument,…
Peter Ajtai
  • 56,972
  • 13
  • 121
  • 140