[slime-devel] Re: Macro indentation redux

Peter Seibel peter at javamonkey.com
Mon Oct 18 20:08:17 UTC 2004


Helmut Eller <e9626484 at stud3.tuwien.ac.at> writes:

> Peter Seibel <peter at javamonkey.com> writes:
>
>> And more. I guess I hadn't loaded the definitions that time (though
>> I thought I had). So I restarted emacs and SLIME *and*
>> slime-compile'd the files containing the macros and I was back to
>> uses of once-only indenting correctly while uses of with-gensyms
>> are incorrectly indented. Sorry for all the confusion--i.e. welcome
>> to my world.
>
> I knew it.  Changing the indentation is problematic.
>
> This is caused by the new cl-indent.el file. The modified indent
> function disables the "with-*" thing by default, so with-gensyms is
> indented like a function call. If you load the macro definition,
> Lisp will tell Emacs that once-only and with-gensyms are macros and
> how to indent them. You probably have
> slime-conservative-indentation=t, so that SLIME ignores the indent
> hint for with-gensyms. Setting it to nil should help here.

Yes. That seems to fix my problem. So when
slime-conservative-indentation is T it doesn't use any information
from Common Lisp? And since you disabled the with-* heuristic it
doesn't get it right just using elisp? But then why did once-only get
indented correctly?

> We still have the problem that the macro definition must be loaded
> on the Lisp side before it is indented correctly. Perhaps the
> "with-*" heuristic wasn't that bad after all.

Well. I'm actually quite okay with requiring that Lisp know about
macros in order for them to be indented as long as they get indented
correctly based on the lambda list. In fact, when I originally
proposed forking cl-indent.el it was with an eye toward getting rid of
kludges like the with-* heuristic in favor of letting Common Lisp tell
us how things should be indented. Though if you go down that path
we'll probably diverge enough from the standard Emacs cl-indent.el
that the issue of sending them patches will become moot. (I'm also
interested in seeing if there's some simplification of cl-indent.el to
be had by abandoning backwards compatibility--there are a ton of
comments in there about things that are done only for backwards
compatibility. So, my points are these:

  - SLIME is going to get blamed for bad indentation by
    non-emacs-wizard users, even it it's really being handled by emacs
    so we might as well control our own destiny.

  - cl-indent.el looks like a mess. (I.e. I can barely understand it
    every time I look at it) Some of that is no doubt due to the
    inherent complexity of the problem. Some is due to the difficulty
    of solving the problem purely in emacs. And some is due to
    historical cruft. By moving to a slime-indent.el we have a chance
    to get rid of the second and third categories of complexity.

  - Someday I'm going to write (unless someone beats me to it) a LOOP
    indenter that works the way I want. But I'd rather implement it in
    Common Lisp so I need an indentation mode that knows how to talk
    to Common Lisp.

In other words, I'm much more interested in having an indentation mode
that I can a) understand, b) extend/customize with Common Lisp code
rather than more crufty elisp than I am in fixing emacs out-of-the box
indentation. But that's just me and until I have time to actually cut
code I'm just babbling.

-Peter

-- 
Peter Seibel                                      peter at javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp





More information about the slime-devel mailing list