[slime-devel] slime-indentation: common-lisp-style

Nikodemus Siivola nikodemus at random-state.net
Wed May 18 09:48:37 UTC 2011


I've added a tentative implementation of indentation styles to
slime-indentation on my Github tree:

  https://github.com/nikodemus/Slime/tree/slime-indentation

With this, you can do

 ;; -*- common-lisp-style: stylename -*-

which will then set the indentation specs and buffer-local variables
specified for that style in common-lisp-style-alist. (Or you can do
M-x set-common-lisp-style as well, of course.)

The big deal is that with this you can have eg. IF ident with 2 spaces
in one file, and with 4 in another -- as fits the project style.

Without this I need to have multiple emacses started with different
command-line options which is a huge pain -- and I expect I'm not the
only one.

Here's a sample style:

(push '("eccentric"
        (variables
         (lisp-lambda-list-keyword-alignment t)
         (lisp-lambda-list-keyword-parameter-alignment t)
         (lisp-loop-indent-subclauses nil)
         (lisp-loop-indent-forms-like-keywords t))
        (indentation
         (if (4 2 2))))
      common-lisp-style-alist)

Things I'd like to sort out before proposing this for Slime CVS:

 - tests
 - support for inheriting styles
 - define-common-lisp-style so we're not married to the alist spec
 - get someone with more emacs-fu to review this

...the last in particular I would appreciate help with. I've no idea
if the things I'm doing with buffer-local variables are kosher or not.

In particular, I feel a bit icky about

  (add-hook 'lisp-mode-hook (lambda () (hack-local-variables)))

which I needed to do because (lisp-mode) kills all local variables.

Cheers,

 -- nikodemus




More information about the slime-devel mailing list