[slime-devel] Re: [patch] a way to specify custom Emacs indentation right in the Lisp source
Michael Livshin
gmane at cmm.kakpryg.net
Sun Aug 26 06:56:21 UTC 2007
Matthias Koeppe <mkoeppe+slime at mail.math.uni-magdeburg.de> writes:
> 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):
>
> [ snipped ]
>
> 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.
this is nice, but if you decide to already require SWANK for
compilation (so that you can use the macro), you can do even better
using the underappreciated CL feature called "symbol property lists"
(why haven't I though of that from the start?):
<example>
(setf (get 'my-macro 'swank:emacs-indentation)
'(6 4 (&whole 2 &rest (&whole 1 &lambda &body))))
</example>
which has the nice property of storing the relevant information
completely regardless of Swank's presence in the image at load time.
indeed, while we are at it, why require Swank for compilation?
there's no technical reason to have the magic property designator
reside in the Swank package: it could instead be provided by a
separate small library (which would be namespace-correct, but probably
too much hassle for such a small feature), or simply be the
:EMACS-INDENTATION keyword (which name-conflict-concious people will
surely balk at, but which is dead simple and maximally effective!).
hmm,
--m
More information about the slime-devel
mailing list