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
19
votes
2 answers

Range data type or generator in Emacs Lisp (elisp)?

What is elisp's equivalent for Python's range(start, end, [step])?
mcandre
  • 22,868
  • 20
  • 88
  • 147
19
votes
2 answers

How do I speed up emacs output from an asynchronous shell-command?

I'm running the output of an application in an emacs buffer using shell-command. (shell-command "verbose-app &" "*verbose-app*") The problem is this command is extremely verbose. So much so, that it sometimes takes several seconds for the emacs…
hyperlogic
  • 7,525
  • 7
  • 39
  • 32
18
votes
4 answers

Elisp: How to delete an element from an association list with string key

Now this works just fine: (setq al '((a . "1") (b . "2"))) (assq-delete-all 'a al) But I'm using strings as keys in my app: (setq al '(("a" . "foo") ("b" . "bar"))) And this fails to do anything: (assq-delete-all "a" al) I think that's because…
auramo
  • 13,167
  • 13
  • 66
  • 88
18
votes
2 answers

What are the new rules for variable scoping in Emacs 24?

Emacs 24 now has lexically-scoped variables. It also still has dynamically-scoped variables, of course. Now that it has both, I'm quite confused about when a variable will have which kind of scope. There's a lexical-binding variable that controls…
Ryan C. Thompson
  • 40,856
  • 28
  • 97
  • 159
18
votes
4 answers

What Are The Most Important Parts Of ELisp To Learn If You Want To Programme Emacs?

I use Emacs everyday as it is the standard editor for Erlang. I decided as my New Years Resolution to learn to programme eLisp. I decided that writing a book about eLisp was the best way to learn. I have make pretty good progress: Learn eLisp For…
Gordon Guthrie
  • 6,252
  • 2
  • 27
  • 52
18
votes
1 answer

In Lisp, Avoid "Cannot open load file" when using require

I am working on a custom .emacs file that I will be able to use on several different computers. I would like to be able to load a mode if it exists on the system. If it does not exist I would like Emacs to stop showing the error: File error: Cannot…
Jesse Vogt
  • 16,229
  • 16
  • 59
  • 72
18
votes
4 answers

Emacs key binding for multiple commands

I'm new to emacs, and have a rookie question. I can bind a key to a particular function by (global-set-key (kbd "C-c a b c") 'some-command), where some-command is a function. How can I invoke two functions (say some-command and some-other-command)…
Ying Xiong
  • 4,578
  • 8
  • 33
  • 69
18
votes
5 answers

Emacs: how to get the default theme?

I've been using the default theme with about 10 faces changed via custom-set-faces for a while now. But from time to time I want to try out a couple of the custom themes out there. The problem is that they set much more than 10 faces and there's…
abo-abo
  • 20,038
  • 3
  • 50
  • 71
18
votes
4 answers

After 'emacs --deamon' I can not see new theme in emacsclient frame. It works from 'emacs M-x server-start'

Minimal config https://www.refheap.com/18816 Scenario 1. Run 'emacs' from terminal. M-x server-start Run 'emacsclient -c' from terminal. Effect: Theme applied. Scenario 2. Run 'emacs --daemon' from terminal Run 'emacsclient -c' Effect: Theme is…
Ace Rimmer
  • 181
  • 1
  • 4
18
votes
4 answers

How to force Emacs not to display buffer in a specific window?

My windows configuration looks like this: +----------+-----------+ | | | | | | | | | | | | | | | | …
polyglot
  • 9,945
  • 10
  • 49
  • 63
17
votes
3 answers

In elisp, how do I put a function in a variable?

I want to allow the user to choose their own command in the "customize" emacs backend (and generally be able to store an executable form name in a variable) but this does not work : (defun dumb-f () (message "I'm a function")) (defvar…
yPhil
  • 8,049
  • 4
  • 57
  • 83
17
votes
6 answers

Is there an Emacs Lisp library for generating HTML?

I'm looking for a solution that allows me to write native Emacs Lisp code and at compile time turns it into HTML, like Franz's htmlgen: (html ((:div class "post") (:h1 "Title") (:p "Hello, World!"))) Of course I can write my own macros, but…
viam0Zah
  • 25,949
  • 8
  • 77
  • 100
17
votes
3 answers

Automatically close emacs shell mode tab-completion buffer?

This has driven me crazy for a long time; I wonder if there is a way to fix it? Hopefully I can describe the situation well. For simplicity's sake, say I've got the following directory structure: ~jer/dirA and ~jer/dirB Within a shell within…
Jer
  • 5,468
  • 8
  • 34
  • 41
17
votes
12 answers

Emacs Lisp Function Guide?

I have been using Emacs for more than three years now but it still takes me days to write even small functions in Lisp. I've looked through GNU Emacs Lisp Reference Manual but it's huge and structured completely opposite from JavaDoc, not from…
vava
  • 24,851
  • 11
  • 64
  • 79
17
votes
3 answers

How do I comment out sexps in elisp code?

What is the preferred way to comment out sexps in elisp code? I have been wrapping my sexps in (if nil ...) so far.
sigjuice
  • 28,661
  • 12
  • 68
  • 93