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

How to have Emacs auto-refresh all buffers when files have changed on disk?

I have a non-emacs global search and replace function that causes my disk files to become more up-to-date than my emacs buffers (en masse). Is there any way to tell emacs to refresh all the buffers from disk in one fell swoop, instead of having to…
Dave
  • 2,653
  • 4
  • 20
  • 22
158
votes
10 answers

Is there a (repeat-last-command) in Emacs?

Frequently, I've dug into apropos and docs looking for something like the following only to give up to get back to the task at hand: (repeat-last-command) do the last C- or M- command I just executed (to be rebound to a fn key) or sometimes the…
ack
  • 1,583
  • 2
  • 10
  • 4
147
votes
6 answers

How do I byte-compile everything in my .emacs.d directory?

I have decided to check out Emacs, and I liked it very much. Now, I'm using the Emacs Starter Kit, which sort of provides better defaults and some nice customizations to default install of Emacs. I have customized it a little, added some stuff like…
Mikka
  • 2,113
  • 2
  • 16
  • 12
145
votes
14 answers

How to achieve code folding effects in Emacs?

What's the best way to achieve something like code folding, or the type of cycling that org-mode uses. What would be the best solution in elisp to create this type of behavior? EDIT: I'm sorry I was not clear. I want to program something in elisp…
jacob
  • 2,284
  • 3
  • 20
  • 21
131
votes
1 answer

Emacs Ruby autocomplete almost working

I've been updating my emacs config with the use of Rsense to allow for an autocomplete drop down box to appear whilst typing code. This works well in most files except I've found it doesn't allow me to select an answer from the table when I'm…
map7
  • 5,096
  • 6
  • 65
  • 128
125
votes
4 answers

emacs/elisp: What is the hash (pound, number sign, octothorp) symbol used for?

What does this do? (add-hook 'compilation-mode-hook #'my-setup-compile-mode) ...and is it different than (add-hook 'compilation-mode-hook 'my-setup-compile-mode)
Cheeso
  • 189,189
  • 101
  • 473
  • 713
123
votes
13 answers

The function to show current file's full path in mini buffer

I need to get the full path of the file that I'm editing with emacs. Is there a function for that? If not, what would be the elisp function for getting that? How can I copy the result (path name) to a clipboard so that I can reuse it? I'm using…
prosseek
  • 182,215
  • 215
  • 566
  • 871
112
votes
1 answer

The difference between setq and setq-default in Emacs Lisp

I have a question about Emacs Lisp. What is the difference between setq and setq-default? Tutorials say setq takes effect in the local buffer while setq-default affects all buffers. For example, if I wrote (setq a-var a-vars-value) in init.el, I…
ruanhao
  • 4,663
  • 6
  • 28
  • 43
111
votes
10 answers

How do I set the size of Emacs' window?

I'm trying to detect the size of the screen I'm starting emacs on, and adjust the size and position the window it is starting in (I guess that's the frame in emacs-speak) accordingly. I'm trying to set up my .emacs so that I always get a…
Tom Dunham
  • 5,779
  • 2
  • 30
  • 27
110
votes
4 answers

In Emacs Lisp, how do I check if a variable is defined?

In Emacs Lisp, how do I check if a variable is defined?
mike
  • 46,876
  • 44
  • 102
  • 112
108
votes
2 answers

emacs, unsplit a particular window split

I often want to unsplit window as follows: +--------------+-------------+ +--------------+-------------+ | | | | | | | | | | …
kindahero
  • 5,817
  • 3
  • 25
  • 32
107
votes
11 answers

Close all buffers besides the current one in Emacs

How do I close all but the current buffer in Emacs? Similar to "Close other tabs" feature in modern web browsers?
Sridhar Ratnakumar
  • 81,433
  • 63
  • 146
  • 187
107
votes
8 answers

How to determine operating system in elisp?

How do I programmatically determine which OS Emacs is running under in ELisp? I would like to run different code in .emacs depending on the OS.
ljs
  • 37,275
  • 36
  • 106
  • 124
85
votes
2 answers

Convert Symbol to a String in Elisp

How can I convert a symbol type into a string in Emacs lisp? I wasn't able to find a symbol-to-string function or anything similar.
Cristian
  • 42,563
  • 25
  • 88
  • 99
83
votes
11 answers

Emacs - Error when calling (server-start)

I am currently using GNU Emacs 23.0.93.1 in Windows Vista SP1. In my .emacs file I make a call to (server-start) and that is causing an error with the message The directory ~/.emacs.d/server is unsafe. Has anyone seen this and know a fix or…
λ Jonas Gorauskas
  • 6,121
  • 6
  • 45
  • 66
1
2 3
99 100