I have a macro I use quite frequently that has a definition:
(defmacro defpage (name title url &body body) ...)
Even when I set lisp-prefix-match-indentation to nil (*see below), slime/emacs insists on indenting a call to defpage as
(defpage test-page "Test Page" "/url/to" (div (div "the rest of the forms")))
If I rename defpage to something else, like 'mkpage', the indenting works as expected:
(mkpage test-page "Test Page "/url/to" (div (div "the rest of the forms")))
I poked around in the slime source code, but I really wasn't able to make heads or tails of what is causing this unexpected (for me) behavior. If what I'm noticing is a 'feature,' what's the easiest way for me to work around this?
Much appreciated,
-- Travis
(SBCL 0.8.15 / Slime CVS / GNU Emacs 21.3.1 / Gentoo)
* though interestingly, when I use other test macros, it is evident that turning off lisp-prefix-match-indentation does have some effect. The macro (defmacro deftest (x y z) ...) will be indented: (deftest x y z) with lisp-prefix-match-indent on, but (deftest x y z) with the switch off. It seems that with lisp-prefix-match-indentation set to nil, slime/emacs completely ignores &body clues in the definition. If I redefine deftest as: (defmacro deftest (x y &body z) ...) it will still be indented incorrectly (as far as I can tell).
Setting slime-conservative-indentation to nil seemed to solve my problem with defpage (I noticed the `macro indentation' thread after I posted).
Since the &body syntax seems to cover the ways you might implement macros similar to defun or dotimes, it seems superfluous to have a special case for do* and def* prefixes, and the current defaults cause a bit of astonishment when you first implement a macro like defpage in slime.
Is there a reason that slime-conservative-indentation defaults to t (or any disadvantage to setting this to nil)?
Thanks,
-- Travis
Travis Cross travis@crosswirecorp.com writes:
Is there a reason that slime-conservative-indentation defaults to t (or any disadvantage to setting this to nil)?
If you have written some code without SLIME and you edit it now with SLIME there's a chance that some macros will be indented differently. This might be annoying ... or not. It certainly annoyed me for some time, but now I just set the 'common-lisp-indent-function properties in my .emacs. That's more predictable than relying on SLIME or def* heuristics.
As slime-conservative-indentation seems to be a commons source of confusion, I will change the default to t.
Thanks for the suggestion.
Helmut.
Helmut Eller e9626484@stud3.tuwien.ac.at writes:
Travis Cross travis@crosswirecorp.com writes:
Is there a reason that slime-conservative-indentation defaults to t (or any disadvantage to setting this to nil)?
If you have written some code without SLIME and you edit it now with SLIME there's a chance that some macros will be indented differently. This might be annoying ... or not. It certainly annoyed me for some time, but now I just set the 'common-lisp-indent-function properties in my .emacs. That's more predictable than relying on SLIME or def* heuristics.
As slime-conservative-indentation seems to be a commons source of confusion, I will change the default to t.
Isn't it already t. And isn't that the source of the confusion? Or is it just me who's confused?
-Peter
Peter Seibel peter@javamonkey.com writes:
Helmut Eller e9626484@stud3.tuwien.ac.at writes:
As slime-conservative-indentation seems to be a commons source of confusion, I will change the default to t.
Isn't it already t. And isn't that the source of the confusion? Or is it just me who's confused?
You're right. It's very common to mistakenly reverse the meaning of this variable. Badly named but probably even more confusing to fix.