[slime-devel] Indentation question

Pascal J. Bourguignon pjb at informatimago.com
Fri Apr 1 00:28:05 UTC 2011


Nikodemus Siivola <nikodemus at random-state.net> writes:

> On 30 March 2011 19:22, Madhu <enometh at meer.net> wrote:
>
>> With Emacs you could try the appended Kludge (incomplete), which would
>
>> --- cl-indent.el.orig   2011-01-28 21:36:00.000000000 +0530
>> +++ cl-indent.el        2011-03-30 21:33:07.000000000 +0530
>
> Actually this gets me
>
> (deffoo foo (stuff)
>   (:bar (a b)
>         (cons a b))
>   (:zot (a b c)
>         (fii a b c))
>   (:default
>    42)
>   (:error
>    (crap)))
>
> which /is/ better, but not I'm looking for. More importantly, it
> doesn't help anyone else.
>
> The question isn't how to do this for myself -- I can put
>
> (setf (get ':bar 'common-lisp-indent-function) '1)
> (setf (get ':zot 'common-lisp-indent-function) '1)
> (setf (get ':default 'common-lisp-indent-function) '0)
> (setf (get ':error 'common-lisp-indent-function) '0)
>
> in my .emacs. The question is how to make it automatically right for
> everyone. If I write a library that provides a DEFFOO like this, I
> would like it to be correctly indented for all Slime users.

Use Common Lisp.  Put in the source file:


(cl:declaim (cl:declaration cl-user::indentation))
(cl:declaim (cl-user::indentation (:bar 1)
                                  (:zot 1)
                                  (:default 0)
                                  (:error 0)))

and have slime parse it.


I use this technique to declare package dependencies in addition to
what's specified in defpackage (ie. qualified symbols, and dynamic
INTERN).  Then my make-depend script can parse it easily, to generate
the ASD file.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.





More information about the slime-devel mailing list