[slime-devel] [patch] a way to specify custom Emacs indentation right in the Lisp source

Michael Livshin gmane at cmm.kakpryg.net
Sat Aug 25 15:01:15 UTC 2007


hi all,

I find that sometimes the usual Slime way of determining macro
indentation based on the position of the &BODY parameter in the
argument list is not quite enough.

for example: if the body of a certain macro is really a list of
function bindings, then one would like those bindings to be indented
properly.  as it happens, Emacs (or rather
common-lisp-indent-function) can be told exactly how to do that, but
this information cannot be expressed by the macro argument list alone.

the attached patch adds a way to define and access custom indentation
specifications like this:

<example>
(defmacro my-macro (name (&rest args) &body function-bindings)
  ...)

#+swank
(setf (swank:emacs-indentation 'my-macro)
      '(6 4 (&whole 2 &rest (&whole 1 &lambda &body))))
</example>

[ which won't work exactly as written, of course, because unfortunately
  Swank does not push anything onto *FEATURES*... ]

thanks,
--m

    * swank.lisp (*emacs-indentation*): New hash table, used to hold
    custom indentation specs.
    (emacs-indentation): Accessor for the above.
    (symbol-indentation): Use it.

    * slime.el (slime-clean-indent-spec): New function, removes CL
    package prefixes from symbols sent from Lisp.
    (slime-handle-indentation-update): Use it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: text/x-diff
Size: 3200 bytes
Desc: swank:emacs-indentation
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20070825/558aeace/attachment.diff>


More information about the slime-devel mailing list