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
29
votes
7 answers

Maximizing / restoring a window in emacs

I often have my emacs split into about 4 windows so I can look at a bunch of buffers at the same time, however I'd like to be able to C-x 1 (make the window the same size as emacs) and then somehow restore back to my nice 4 window layout I was just…
John Hunt
  • 4,265
  • 8
  • 45
  • 59
29
votes
3 answers

what does &rest mean in elisp?

What does the &rest mean in this: (append &rest sequences) I have finished the book "elisp_intro",but I didn't find the answer. I will be very grateful if you can help me.
hq.wrong
  • 353
  • 3
  • 5
29
votes
1 answer

Setting auto-mode-alist in emacs

I notice that the current auto-mode-alist entries all end with a single quote, for example ("\\.java\\'" . java-mode) What is the purpose of the single quote. I would have expected to see ("\\.java$" . java-mode) The reason I ask is that I am…
chris
  • 2,473
  • 1
  • 29
  • 28
29
votes
2 answers

Emacs function to case-insensitive sort-lines?

I know that you can do the following to sort-lines in emacs without case sensitivity: M-x set-variable [RETURN] sort-fold-case [RETURN] t [RETURN] M-x sort-lines M-x set-variable [RETURN] sort-fold-case [RETURN] nil [RETURN] But this is annoying to…
Phillip B Oldham
  • 18,807
  • 20
  • 94
  • 134
29
votes
2 answers

Emacs Lisp: evaluate variable in alist

This is probably silly but I don't have enough Elisp knowledge to understand what is going on with respect to quoting and evaluation. Suppose I have this Elisp code: (add-to-list 'default-frame-alist '(width . 100)) (add-to-list 'default-frame-alist…
Laurynas Biveinis
  • 10,547
  • 4
  • 53
  • 66
28
votes
4 answers

What does "s-[keyname]" refer to in Emacs, and how do I tell Emacs to ignore it?

Background information: I'm on a Mac, and I've just upgraded to Emacs 23.1 via http://emacsformacosx.com/. There are a few issues, notably the lack of full screen ability. I've attempted to get around this last issue by installing Megazoomer, which…
Brad Wright
  • 5,602
  • 6
  • 29
  • 30
27
votes
4 answers

Elisp mechanism for converting PCRE regexps to emacs regexps

I admit significant bias toward liking PCRE regexps much better than emacs, if no no other reason that when I type a '(' I pretty much always want a grouping operator. And, of course, \w and similar are SO much more convenient than the other…
Wes Hardaker
  • 21,735
  • 2
  • 38
  • 69
27
votes
1 answer

elisp conditional based on hostname

I have a shared .emacs file between different Linux systems. I would like to execute an expression based on the hostname of the system I'm running: (color-theme-initialize) ;; required for Ubuntu 10.10 and above. I suppose one way to avoid…
Jeff Bauer
  • 13,890
  • 9
  • 51
  • 73
27
votes
4 answers

Emacs - regular expressions in Lisp need to be double-escaped - why?

I've been playing around with emacs lisp, and I wanted to write a little function to do a regular expression search and replace. I had a heck of a time getting the regular expression to work correctly because I didn't realize that all the special…
Kevin Tighe
  • 20,181
  • 4
  • 35
  • 36
27
votes
1 answer

Grab current line in buffer as a string in elisp

How can i collect the buffer's current line as a string value in elisp? i can do this, (let (p1 p2 myLine) (setq p1 (line-beginning-position) ) (setq p2 (line-end-position) ) (setq myLine (buffer-substring-no-properties p1 p2)) ) but is there…
user2879704
26
votes
4 answers

How can I get the keyboard shortcut for a given emacs command?

Is there any function to do this? something like the inverse of "describe-key"?
Pedro Rolo
  • 28,273
  • 12
  • 60
  • 94
26
votes
4 answers

Download a File with Emacs Lisp

Does elisp have a function that takes a url and a destination and downloads that url off the internet? I've discovered url-retrieve and url-retrieve-synchronously but url-retrieve takes a callback and url-retrieve-synchronously puts everything into…
Cristian
  • 42,563
  • 25
  • 88
  • 99
26
votes
5 answers

Useful keyboard shortcuts and tips for ESS/R

I would like to ask regular ESS/R users what key bindings do they use frequently and tips on using ESS/R.
ggg
  • 1,857
  • 2
  • 21
  • 33
26
votes
5 answers

Emacs: adding 1 to every number made of 2 digits inside a marked region

Imagine I've got the following in a text file opened under Emacs: some 34 word 30 another 38 thing 59 to 39 say 10 here 47 and I want to turn into this, adding 1 to every number made of 2 digits: some 35 word 31 another…
SyntaxT3rr0r
  • 27,745
  • 21
  • 87
  • 120
26
votes
6 answers

In emacs, how do I save without running save hooks?

I have various things set up in my 'before-save-hook. For example, I run 'delete-trailing-whitespace. This is what I want in almost all occasions. But sometimes, I'm working on files that are shared with other people, and the file already has a…
zck
  • 2,712
  • 2
  • 25
  • 44