[slime-devel] Re: Indenting macro bodies

Pascal J.Bourguignon pjb at informatimago.com
Thu Oct 7 06:55:53 UTC 2004


Ivan Toshkov writes:
> I vote for it.  I'd like to have some way to tell emacs how to indent the 
> macro from the macro definition.  Don't know if this is possible and probably 
> it won't be portable but one can dream, right?
> 
> Generally, I think putting meta info in comments is a poor practice, and am 
> sure in Common Lisp there are better ways, but currently I can think of two 
> alternatives:
> 
>  1. Put the meta info in a property.
> 
>  2. Use something like:
> #+slime-indent (slime-set-macro-indentation 'macro 'info)
> 
> I don't know the SLIME internals, so I guess I'm missing an easier and better 
> way to do this.

Normally, in emacs this is done with local variables. Put at the end
of your source a comment like:

;; Local Variables:
;; eval: (put 'comment-with-narrowing 'lisp-indent-function 2)
;; End:

(with any number of eval: lines and any emacs lisp expression).

Usually, in my Common-Lisp code I rather use my own cl-indent function
that puts the property to both the low-case and the up-case version of
the symbol (since emacs is case sensitive and Common-Lisp code can
appear in either case):

;; Local Variables:
;; eval: (cl-indent 'while 1)
;; eval: (cl-indent 'until 1)
;; End:


But this is not enought to get a pretty indentation.  As you can see
from my patch to lisp-indent-function, you need to be slighly more
intelligent to heuristically correctly indent sexps.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Voting Democrat or Republican is like choosing a cabin in the Titanic.





More information about the slime-devel mailing list