[slime-devel] SLIME altering lisp-mode indentation
heller at common-lisp.net
Wed Feb 2 16:49:52 UTC 2011
* Jeff Massung [2011-02-02 15:52] writes:
> Hello all,
> For some reason, SLIME overrides the default lisp-mode indentation and I'm
> unsure of how to fix this (I'm still learning Emacs). The indentation I'm
> speaking of is in regards to IF statements. If I don't ever load SLIME, my IF
> statements indent like so:
> Which is very much how I like them to indent. After SLIME is loaded, they
You probably see a difference between emacs-lisp-mode and lisp-mode. In
Emacs Lisp, if can have 2, 3 or more arguments and the else branch has
an implicit progn. Common Lisp allows only 2 or 3 arguments. That's
why the two modes indent if differently.
> Does anyone know how I can fix this? Thanks!
Actually, SLIME changes lisp-indent-function in to
common-lisp-indent-function. common-lisp-indent-function does a better
job at indenting flet/labels than the default.
If you want to have ELisp-style indentation you can either
do something like
(put 'if 'common-lisp-indent-function 2)
or restore the default with
(defun my-lisp-mode-hook ()
(setq lisp-indent-function 'lisp-indent-function))
(add-hook 'lisp-mode-hook 'my-lisp-mode-hook)
in your .emacs.
More information about the slime-devel