All Manuals > Editor User Guide > 6 Advanced Features

6.2 Customizing Lisp indentation

The indentation used for Lisp forms can be modified to suit the preferences of the user.

The default indentations can be found in the file config/indents.lisp in the LispWorks library directory. If you want to alter your personal Lisp indentation, put the modifying code in your .lispworks file.

editor:setup-indent Function

editor:setup-indent form-name no-of-args &optional standard special

Modifies the indentation, in Lisp Mode, for the text following an instance of form-name. The arguments no-of-args, standard and special should all be integers. The first no-of-args forms following the form-name become indented special spaces if they are on a new line. All remaining forms within the scope of the form-name become indented standard spaces.

For example, the default indentation for if in Lisp code is established by:

(editor:setup-indent "if" 2 2 4)

This determines that the first 2 forms after the if (that is, the test and the then clauses) get indented 4 spaces relative to the if, and any further forms (here, just an else clause) are indented by 2 spaces.


Editor User Guide (Windows version) - 01 Dec 2021 19:35:28