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

Emacs shell scripts - how to put initial options into the script?

Inspired by Stack Overflow question Idomatic batch processing of text in Emacs? I tried out an Emacs shell script with the following headline: #!/usr/bin/emacs --script I put some Emacs Lisp code in it, and saved it as textfile rcat. Since the…
Thorsten
  • 3,451
  • 3
  • 20
  • 25
21
votes
1 answer

Is there a way to undefine a function in emacs lisp?

I have a macro that creates function. It creates interactive functions based on current opened buffer. However, it starts to flood the M-x after a long running section. Is there a way to make a function invalid?
tom
  • 1,302
  • 1
  • 16
  • 30
21
votes
3 answers

How do I pass a function as a parameter to in elisp?

I'm trying to pass one method to another in elisp, and then have that method execute it. Here is an example: (defun t1 () "t1") (defun t2 () "t1") (defun call-t (t) ; how do I execute "t"? (t)) ; How do I pass in method…
oneself
  • 38,641
  • 34
  • 96
  • 120
21
votes
3 answers

Emacs custom command line argument

From the documentation I can see I can access command line arguments (command-line-args). I'd like to add my own arguments but Emacs complains at start up that it doesn't recognize them. E.g. emacs -my_argument I get: command-line-1: Unknown…
Slava Litvinov
  • 392
  • 3
  • 7
21
votes
4 answers

Where to find Emacs Helm documentation

Helm is a great framework for selection and autocompletion. Reading Anything page on Emacs Wiki, I know Helm evolved from Anything. The page advises user to update extensions written for Anything to be used with Helm but provided no instruction on…
Ha-Duong Nguyen
  • 1,373
  • 1
  • 14
  • 22
21
votes
3 answers

Emacs: disable theme background color in terminal

I'd like to have emacs not to have a background color when I open a frame in the terminal. I'm using a terminal with a translucent background, and characters with a background color are not "see-through". TERM is set to "xterm-256color". How do I…
Ron
  • 1,989
  • 2
  • 17
  • 33
21
votes
4 answers

Emacs 24.3 python: Can't guess python-indent-offset, using defaults 4

Can anyone who understands Lisp please help resolve this warning? I upgraded to Emacs 24.3 and whenever I create a Python file using Emacs I get this warning message. Searched in python.el and found the following section of code that produces the…
bohanl
  • 1,885
  • 4
  • 17
  • 33
21
votes
5 answers

Is there emacs capability for visiting last edits?

In the JetBrains products, there's a very handy key binding that lets you visit all the spots you made an edit. Hit the key once to go to the last edit (file and location), and keep hitting the key to go back to earlier edits. It's typically when…
justingordon
  • 12,553
  • 12
  • 72
  • 116
21
votes
3 answers

Making JSON requests within Emacs

I am in the early stages of writing an Emacs major mode for browsing and contributing to sites on the Stack Exchange network, in much the same way as dired and list-packages works, with a few inspirations from magit and org-mode. The problem is, of…
Sean Allred
  • 3,558
  • 3
  • 32
  • 71
20
votes
3 answers

How to check if a function (e.g. server-running-p) is available under Emacs?

I'm trying to check if server-running-p is available in my .emacs file before calling it. I already have the following: (if (not (server-running-p)) (server-start)) But on some computers where I use Emacs, calling (server-running-p) gives an…
Christian Hudon
  • 1,881
  • 1
  • 21
  • 42
20
votes
6 answers

Name of this function in built-in Emacs Lisp library?

The following Emacs Lisp function takes a list of lists and returns a list in which the items of the inner lists have been concatenated to one big list. It is pretty straight-forward and I am convinced something like this must already be part of the…
Thomas
20
votes
4 answers

How to view history of various commands in Emacs

Commands entered after pressing M-x can be viewed using the up/down arrow keys. How can I get a list of all the commands including menu bar invocation, commands triggered using mouse clicks, etc. in Emacs?
Talespin_Kit
  • 20,830
  • 29
  • 89
  • 135
20
votes
6 answers

Where I can find the most popular Emacs settings?

While it is fun to customize, the Emacs has 100s of mode and there is lots of customization. I like to find popular choices, so it makes my life easier and I can spend time productively. It could be about hooks, registers, buffers,…
aartist
  • 3,145
  • 3
  • 33
  • 31
20
votes
1 answer

Adding Completion to (interactive)

Is there any way to add my own completion to an (interactive) elisp function? Ideally, I'd like to pass it a list of strings that it would tab-complete from. I know that using (interactive "D"), (interactive "F") or (interactive "b") give you…
Inaimathi
  • 13,853
  • 9
  • 49
  • 93
20
votes
5 answers

How to find a bug in ".emacs" or "init.el"?

Sometimes when I open Emacs, Emacs initialization fail. That is because .emacs or init.el files have a bug. (My bugs often come from just mistyping.) I want to find the bug in .emacs or init.el. Is there any way to do this?
Kei Minagawa
  • 4,395
  • 3
  • 25
  • 43