[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: comment-kill and the state of the world

From: Stefan Monnier
Subject: Re: comment-kill and the state of the world
Date: Fri, 24 Oct 2003 19:48:21 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Stefan> Note that if you "configure comment-dwim" by changing
Stefan> comment-end and comment-start instead (by setting them to "{- "
Stefan> and " -}" for example), it will work the same way for
Stefan> comment-indent.

> I'd tried that.  comment-indent then leaves point in the wrong place
> (right before the second hyphen).

But that's the case as well if you call `comment-indent' with a pre-existing
comment, right?  So it's an unrelated bug which comment-padding-foo would
not fix (one I remember fixing a while back, but probably only in
Emacs-CVS).  What was happening is that comment-indent skips the comment
starter and the leading spaces to get to the actual content of the comment,
but with an empty comment, that tends to leave you right before the
commend-end which is not what you want when there's padding.

Stefan> Sometimes you want it to behave the same in both case, sometimes
Stefan> you want it to behave differently, which is why there are two
Stefan> ways to configure the spacing.  Admittedly, the
Stefan> `comment-padding' way is easier and very different from the
Stefan> other, so it's pretty ugly, but that's the way it worked in
Stefan> Emacs-20, so I had to support it in Emacs-21.  RMS would
Stefan> probably accept a patch for a new config option something like
Stefan> `comment-padding-foo' which would be used for comments on
Stefan> non-empty lines and could be set to nil to mean use the same
Stefan> value as `comment-padding'.  You'd have to come up with a good
Stefan> name for the variable, tho.  It's just that the need hasn't come
Stefan> up yet because configuring comment-start and comment-end works
Stefan> as well in all the actual cases I've come across.
> I think it's just sound engineering.

Believe me I haven't met many people who hate redundancy as much as I do.

> Even if the two branches can be made to behave the same now, the more they
> change the harder it will be to achieve that.

Feel free to write the patch for it.  It already took significant effort
to get things as they are, such that it all works the way all the major
modes expect it, including using various combinations of comment-start,
comment-end, block-comment-start, block-comment-end, comment-multi-line,
various ways to call auto-fill, ...

And don't forget to come up with a good argument to convince RMS that it's
worth it to change the behavior of comment-indent (he happens to like
code duplication, as odd as it sounds to most of us).

A new pair of eyes will surely help to simplify the code, tho.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]