EmacsWiki: Learn Emacs Lisp (original) (raw)
EmacsLisp (Elisp) is the language that much of Emacs is written in, and it is also the language that you can use to customize Emacs for your own use.
Don’t worry - even if you’re an EmacsNewbie, you can get the hang of it. Learning a little Emacs Lisp will help you use Emacs more effectively:
- You will better understand the documentation and online help for functions and variables.
- You will be able to consult the Lisp source code for a function or variable, in order to understand it still better.
- You will be able to convert common key sequences you use into keyboard macros or your own commands defined in Lisp.
- You will be able to take snippets of code from the standard source code or elsewhere and adapt them to create your own Emacs commands.
- You will be able to attract better guidance (and/or commiseration) from fellow Emacs users.
- You will be able to make Emacs better fit your needs and fancies.
Emacs Lisp for things you already use
- Use
‘C-x ESC ESC’
(‘repeat-complex-command’
) to repeat commands you execute, and look at the Emacs Lisp code that executes them, before hitting‘RET’
(Return) – see RepeatingComplexCommand. You can edit that code to get a variation on the last behavior. - Use
‘C-h f’
(‘describe-function’
) and‘C-h v’
(‘describe-variable’
) to understand commands and variables you use. You’ll see a description of the function or variable. If you have the Emacs source code locally, you will also see a link to the relevant definition in the code. Click the link or move the cursor to it and press‘RET’
to follow it. - Use
‘C-h k’
(‘describe-key’
) to see which command is invoked when you use a key. The description shown includes the command description (see previous).
Resources
- Read the Emacs Lisp Introduction: EmacsLispIntro. Use
‘C-h i’
(‘info’
), then choose‘Emacs Lisp Intro’
. You can also read this manual on the Web or as a portable epub book. - Read the Emacs Lisp Reference manual: EmacsLispReference. Use
‘C-h i’
(‘info’
), then choose‘Elisp’
. You can also read this manual on the Web or as a portable epub book. - Emergency Elisp: Good for people with programming backgrounds - by SteveYegge
- Learn Emacs Lisp in 15 Minutes - by BastienGuerry, Org mode Maintainer. [1][2]
- A quick guide to Emacs Lisp programming - by ChrisDone, author of structured-haskell-mode, God Mode, and etc.
- Read Lisp, Tweak Emacs: How to read Emacs Lisp so that you can customize Emacs - by SachaChua, ex-maintainer of PlannerMode, EmacsWikiMode, RememberMode and author of ErcCompletion [3].
- Practical Emacs Lisp - by Xah Lee.
- Mitch Fincher’s 50-point summary of the language: [4]
- Check out examples in ElispCookbook
- Check out existing ExampleConfigurations
- check out Awesome elisp on GitHub.
General Lisp Resources
Emacs Lisp belong to the Lisp family (WikiPedia:Lisp_programming_language), and learning it will teach you Lisp concepts, as well as learning Lisp concepts will help you with Emacs Lisp.
- Harold Abelson & Gerald Jay Sussman: MIT lectures introducing Lisp (videos): [5] is the first one, _Lecture 1A: Overview and Introduction to Lisp_… Excellent, from soup to nuts, step by step. It doesn’t get any better than this.
- Harold Abelson, Gerald Jay Sussman with Julie Sussman’s book Structure and Interpretation of Computer Programs (Scheme, not Emacs Lisp): [6] (The book for the course shown in the videos.)
- Pascal Costanza’a intro to Lisp (in general, not Emacs Lisp): [7]
- Paul Graham’s overview of Lisp (in general, not Emacs Lisp): [8]
- Paul Graham’s book ANSI Common Lisp, chapter 2 (Common Lisp, not Emacs Lisp): [9]
- Peter Norvig’s Tutorial on Good Lisp Programming Style [10]
- Peter Seibel’s book Practical Common Lisp (Common Lisp, not Emacs Lisp): [11]
- Steve Losh’s article A Road to Common Lisp (Common Lisp, not Emacs Lisp): [12]
- David B. Lamkin’s book Successful Lisp (Common Lisp, not Emacs Lisp): [13] (The book is downloadable from his webpage.)
- Jos ́e Antonio Ortega Ruiz’s article A Scheme bookshelf (Scheme, not Emacs Lisp): [14]