[slime-devel] [patch] a way to specify custom Emacs indentation right in the Lisp source
Matthias Koeppe
mkoeppe+slime at mail.math.uni-magdeburg.de
Sat Aug 25 18:56:36 UTC 2007
Michael Livshin <gmane at cmm.kakpryg.net> writes:
> 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>
I am also interested in a feature like this.
In my opinion, an important consideration in implementing it is that
FASL files generated within SLIME should still be loadable into
non-SWANK images.
I am using the following code to do that (for a different customization):
;; Arrange for SLIME to use the right readtable
(when (find-package :swank)
(push (cons :guile guile-internal::*guile-readtable*)
(symbol-value (intern (symbol-name '#:*readtable-alist*)
:swank)))
(defmethod swank-backend:swank-compile-file :around (file-name load-p)
(if (string= (pathname-type file-name) "scm")
(let ((*package* (find-package :guile))
(*readtable* guile-internal::*guile-readtable*))
(call-next-method))
(call-next-method)))
)
Because all references to the SWANK package are made at load time (not
read or compile time), FASL files including the above code can still
be loaded into non-SWANK images.
A SWANK macro (SWANK:DEF-EMACS-INDENTATION?) that expands into
something similar would be useful.
Matthias
--
Matthias Köppe -- http://www.math.uni-magdeburg.de/~mkoeppe
(currently @math.ucdavis.edu)
More information about the slime-devel
mailing list