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
17
votes
3 answers

Emacs Line Height

I am trying to set the line height of text in an Emacs buffer so there is space above and below the letters. From the documentation, I infer that the line-height text property may help me to accomplish this. There is also a line-spacing variable…
Jackson
  • 9,188
  • 6
  • 52
  • 77
17
votes
2 answers

Wrong indentation of comments in Emacs

In many languages, the line comment starts with a single symbol, for example # in Python and R. I find that in Emacs, when writing such line comments, I have to repeat the comment symbol twice to make the correct indentation. See the following…
Yin Zhu
  • 16,980
  • 13
  • 75
  • 117
17
votes
5 answers

How to append multiple elements to a list in Emacs lisp

In Emacs lisp there is add-to-list to add a single element to a list (if it doesn't exist already). Instead of one, I want to add multiple elements. Also, I do not want to filter duplicate elements but add them to the list nonetheless. Currently, I…
Viktor Rosenfeld
  • 183
  • 1
  • 1
  • 6
17
votes
2 answers

How to get selected text in Emacs Lisp?

I need to get selection as a string in my Emacs Lisp function.
Pavel Chuchuva
  • 22,633
  • 10
  • 99
  • 115
17
votes
6 answers

Emacs Auto Load Color Theme by Time

Can I let Emacs automatically load theme ? or do certain command at customized time ? Say what I want is to M-x load-theme RET solarized-light when I am at office at 9:00am and M-x laod-theme RET solarized-dark when I am back home and continued on…
liuminzhao
  • 2,385
  • 17
  • 28
17
votes
3 answers

How to create a column view in Emacs Lisp?

I'm writing my own mode in Elisp. It's basically a simple crud application showing rows of data which can be manipulated via the minibuffer. I'd like to create a view for these rows which looks like the emacs package manager: columns of data nicely…
auramo
  • 13,167
  • 13
  • 66
  • 88
16
votes
1 answer

Obtain buffer file name without extension in .emacs

I am trying to make shortcuts for portable emacs linking to a portable LaTeX compiler and R for Sweave, but I know very little about the language used in .emacs (this is Lisp?) Currently I am using fullpath-relative-to-current-file obtained from…
Sacha Epskamp
  • 46,463
  • 20
  • 113
  • 131
16
votes
5 answers

How to preserve clipboard content in Emacs on Windows?

This is scenario that I ran into a few times: I copy some text from other program. Go to Emacs and did some editing before I paste/yank the text in. C-y to yank and voila ... not the text I intended to paste in. Then I realize that while I am moving…
polyglot
  • 9,945
  • 10
  • 49
  • 63
16
votes
6 answers

Emacs Modes: "Command attempted to use minibuffer while in minibuffer"

Scenario: I start to type M-x to type a command I switch to another emacs window/buffer because I realise I'm executing the command in the wrong window I start to type M-x again to execute the command in the correct window Result: I get the…
EoghanM
  • 25,161
  • 23
  • 90
  • 123
16
votes
1 answer

How fix emacs error "old-style backquotes detected"

Any tips on fixing the emacs error "old-style backquotes detected"? I'm sure the error is coming from some ancient lisp code I wrote. Thanks.
justingordon
  • 12,553
  • 12
  • 72
  • 116
16
votes
1 answer

in elisp's let, how do you reference a variable bound in the same let while binding another variable?

(let ((a 1) (b (+ a 1))) (message a)) This throws the error Debugger entered--Lisp error: (void-variable a) What's the canonical way to do this?
jshen
  • 11,507
  • 7
  • 37
  • 59
16
votes
2 answers

Learning Elisp - what are the highest quality libraries to read source code?

When learning a new programming language, "read source code" is a common advice received by the experts. However, with such a huge system like emacs, build over decades by many people, it is not so easy for the beginner to figure out which libraries…
Thorsten
  • 3,451
  • 3
  • 20
  • 25
16
votes
7 answers

Elisp programming - what's the best setup?

There are all kind of cool programming language modes in Emacs, written in elisp, but apparently no special support for elisp itself. Since slime is not working for elisp, I ask myself if all that elisp code is just hacked in the scratch buffer?…
Thorsten
  • 3,451
  • 3
  • 20
  • 25
16
votes
1 answer

Elisp: how can I express else-if

In elisp, the if statement logic only allows me an if case and else case. (if (< 3 5) ; if case (foo) ; else case (bar)) but what if I want to do an else-if? Do I need to put a new if statement inside the else case? It just seems a…
Cameron
  • 2,805
  • 3
  • 31
  • 45
16
votes
5 answers

How to check if a variable is set to what in elisp/emacs?

Let's say I have the following line in .emacs file. (setq-default default-directory "~/Desktop/mag") How can I check the value for `default-directory' in elisp? Added I asked this question as I need to check the value of default-directory based on…
prosseek
  • 182,215
  • 215
  • 566
  • 871