Learning GNU Emacs, 3rd Edition
by Debra Cameron, James Elliott, Marc Loy, Eric S. Raymond, Bill Rosenblatt
The Lisp Modes
Emacs has three Lisp modes, listed here by their command names:
- emacs-lisp-mode
Used for editing Emacs Lisp code, as covered in Chapter 11 (filename .emacs or suffix .el).
- lisp-mode
Used for editing Lisp code intended for another Lisp system (suffix .l or .lisp).
- lisp-interaction-mode
Used for editing and running Emacs Lisp code.
All three modes have the same basic functionality; they differ only in the support they give to running Lisp code.
All three Lisp modes understand the basic syntax elements common to all language modes. In addition, they have various commands that apply to the more advanced syntactic concepts of S-expressions, lists, and defuns. An S-expression (or syntactic expression) is any syntactically correct Lisp expression, be it an atom (number, symbol, variable, etc.), or parenthesized list. Lists are special cases of S-expressions, and defuns (function definitions) are special cases of lists. Several commands deal with these syntactic concepts; you will most likely become comfortable with a subset of them.
Table 9-11 shows the commands that handle S-expressions.
Table 9-11. S-expression commands
|
Keystrokes |
Command name |
Action |
|---|---|---|
|
C-M-b |
backward-sexp |
Move backward by one S-expression. |
|
C-M-f |
forward-sexp |
Move forward by one S-expression. |
|
C-M-t |
transpose-sexps |
Transpose the two S-expressions around the cursor. |
|
C-M-@ |
mark-sexp |
Set mark to the end of the current S-expression; set the cursor to the beginning. |
|
C-M-k |