O'Reilly logo

Learning GNU Emacs, 3rd Edition by Bill Rosenblatt, Eric S. Raymond, Marc Loy, James Elliott, Debra Cameron

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required