As a user of bleeding-edge emacs builds (where lexical-binding: t in
slime.el actually matters), I'd like to warn SLIME developers than
LEXICAL-LET and LEXICAL-LET* macros are now broken in this mode. They
expand into code that mixes (symbol-value) with let-bindings on a
dynamically-generated name, assuming that it will be accessed as special,
not lexical, variable.
If lexical-binding is actually available in emacs, bare LET and LET*
should be used instead (tried and worked).
I worked around it within my local emacsen by redefinieng lexical-let[*],
so they examine `lexical-binding' at expansion time, and expand into
LET[*] if appropriate.
The same thing could be done in slime.el (and something should be done,
IMHO -- in the worst case, removing lexical-binding: t until the issue
is fixed in Emacs). The following macros may provide a compatible
replacement for both new and old emacs versions:
;; If you know a cleaner way to test whether emacs supports
;; lexical binding, feel free to rewrite the macro below:
(defmacro lexical-bind-dispatch (lexical nolexical &rest body)
"Dispatch to `lexical' or `nolexical' depending on `lexical-binding':
Expand into (lexical...) if lexical-binding is set and supported by emacs,
and into (nolexical...) otherwise"
(if (and lexical-binding
(let (should-not-become-boundp)
(not (boundp 'should-not-become-boundp))))
`(,lexical ,@body)
`(,nolexical ,@body)))
(defmacro lex-let* (bindings &rest body)
`(lexical-bind-dispatch let* lexical-let* ,bindings ,@body))
(defmacro lex-let (bindings &rest body)
`(lexical-bind-dispatch let lexical-let ,bindings ,@body))
--
Regards, Anton Kovalenko
+7(916)345-34-02 | Elektrostal' MO, Russia