Next: , Previous: , Up: Editing Lisp   [Contents][Index]


8.5 Indentation

One of the most important features provided by Lisp mode is automatic indentation of Lisp code. Since unindented Lisp is unreadable, poorly indented Lisp is hard to manage, and inconsistently indented Lisp is subtly misleading. See section indentation for a description of the general-purpose indentation commands. Lisp mode uses these indentation rules:

Command: Indent Form (bound to C-M-q)

This command indents all the lines in the current form, leaving the point unmoved. This is undo-able.

Command: Fill Lisp Comment Paragraph (bound to M-q in Lisp mode)
Hemlock Variable: Fill Lisp Comment Paragraph Confirm (initial value t)

This fills a flushleft or indented Lisp comment. This also fills Lisp string literals using the proper indentation as a filling prefix. When invoked outside of a comment or string, this tries to fill all contiguous lines beginning with the same initial, non-empty blankspace. When filling a comment, the current line is used to determine a fill prefix by taking all the initial whitespace on the line, the semicolons, and any whitespace following the semicolons.

When invoked outside of a comment or string, this command prompts for confirmation before filling. It is useful to use this for filling long export lists or other indented text or symbols, but since this is a less common use, this command tries to make sure that is what you wanted. Setting Fill Lisp Comment Paragraph Confirm to nil inhibits the confirmation prompt.

Command: Defindent (bound to C-M-#)

This command prompts for the number of special arguments to associate with the symbol at the beginning of the current or containing list.

Hemlock Variable: Indent Defanything (initial value 2)

This is the number of special arguments implicitly assumed to be supplied in calls to functions whose names begin with "def". If set to nil, this feature is disabled.

Command: Move Over ) (bound to M-))

This command moves past the next close parenthesis and then does the equivalent of Indent New Line.


Next: Parenthesis Matching, Previous: Defun Manipulation, Up: Editing Lisp   [Contents][Index]