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
On 18 May 2011 12:48, Nikodemus Siivola nikodemus@random-state.net wrote:
;; -*- common-lisp-style: stylename -*-
This has now matured sufficiently for my taste, and I've committed it to CVS in the slime-indentation contrib.
`define-common-lisp-style' to define your own styles.
Customize `common-lisp-style-default' to set styles for buffers that don't explicitly specify one.
Call `common-lisp-set-style' to manually set the style for a buffer.
Predefined styles are "basic", "classic", "modern", and "sbcl". If you define your own styles for use in open source projects, consider submitting the style for inclusion in Slime.
Comments much appreciated.
Cheers,
-- nikodemus