[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comment-kill and the state of the world
From: |
Ian Zimmerman |
Subject: |
Re: comment-kill and the state of the world |
Date: |
23 Oct 2003 15:01:30 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Ian> Ah, but you get the same thing with comment-dwim with an argument
Ian> on a line with an existing comment. Is that any better?
Stefan> The command throuh which you reach the code is not very
Stefan> relevant.
Ian> I don't understand. Are you saying people delete comments by hand
Ian> with, say, M-; C-p C-p C-k ? Or is there some other way I don't
Ian> know about?
Stefan> Looks like I don't understand either. You complained about a
Stefan> behavior of comment-kill and I replied that I had no idea why
Stefan> the behavior was like that and that I didn't know anybody who
Stefan> used comment-kill. Then you said "but the same applies to
Stefan> comment-dwim", at which point I tried to clear up the fact that
Stefan> my earlier answer applied to the comment-kill function as much
Stefan> as the command.
So, how _do_ people kill their comments?
Ian> It comes down to comment-dwim. It really tries to do too much.
Ian> The different situations should be separated, and then common
Ian> patterns will emerge to make into subroutines.
Stefan> Huh? They are separate. You can call comment-indent or
Stefan> comment-region or uncomment-region or comment-kill directly.
Ian> Yes. But comment-dwim does more than just dispatch to them. If
Ian> you call them directly, you lose the benefit of that additional
Ian> code, whatever it is.
Stefan> The only non-dispatch part of the code is the part that inserts
Stefan> a comment on an empty line. Are you saying that we should move
Stefan> that code out into its own function? That'd be fine by me.
I think it should be moved to comment-indent.
Ian> Second, do you have any advice for me when I _want_ them to behave
Ian> the same?
Stefan> Which difference are you referring to ? Since I have trouble
Stefan> understanding your problems, please try to be very precise and
Stefan> concrete.
Let's say the language's comment delimiters look like this: {- -} . I
can configure comment-dwim to leave appropriate amount of whitespace and
put the point in the right place, so the situation after an empty
comment is inserted looks like this: {- | -} . But that won't affect
non-empty lines, because that is handled by comment-indent. And vice
versa.
Ian> BTW, another bug is that comment-indent uses
Ian> (indent-according-to-mode) to position the comment when
Ian> comment-indent-function returns nil. That makes no sense when
Ian> there's preceding code on the line
Stefan> Indeed, that's a clear bug. Does the patch below fix it for you
Stefan> ?
Yes.
Ian> (which is always, now that comment-dwim handles the empty case
Ian> itself).
Stefan> It's not always: comment-indent can still be called directly by
Stefan> the user, and (more importantly), it is called by
Stefan> comment-indent-new-line, i.e. by the auto-fill code.
Ok, good point.
--
Wer Schoenheit angeschaut mit Augen, hat dem Tode schon Anheim gegeben.
Von Platen.
- comment-kill and the state of the world, Ian Zimmerman, 2003/10/16
- Re: comment-kill and the state of the world, Stefan Monnier, 2003/10/16
- Re: comment-kill and the state of the world, Ian Zimmerman, 2003/10/17
- Re: comment-kill and the state of the world, Stefan Monnier, 2003/10/17
- Re: comment-kill and the state of the world, Ian Zimmerman, 2003/10/18
- Re: comment-kill and the state of the world, Stefan Monnier, 2003/10/19
- Re: comment-kill and the state of the world,
Ian Zimmerman <=
- Re: comment-kill and the state of the world, Stefan Monnier, 2003/10/24
- Re: comment-kill and the state of the world, Ian Zimmerman, 2003/10/24
- Re: comment-kill and the state of the world, Stefan Monnier, 2003/10/24
- Re: comment-kill and the state of the world, Ian Zimmerman, 2003/10/30