From: Ian Zimmerman <bayard@newsguy.com>
Subject: Re: comment-kill and the state of the world
Date: 23 Oct 2003 15:01:30 -0700 [thread overview]
Message-ID: <87vfqfd35x.fsf@newsguy.com> (raw)
In-Reply-To: jwvhe24dfel.fsf-monnier+gnu.emacs.help@vor.iro.umontreal.ca
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.
next prev parent reply other threads:[~2003-10-23 22:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-16 17:54 comment-kill and the state of the world Ian Zimmerman
2003-10-16 19:11 ` Stefan Monnier
2003-10-17 16:37 ` Ian Zimmerman
2003-10-17 20:01 ` Stefan Monnier
2003-10-18 17:42 ` Ian Zimmerman
2003-10-19 23:14 ` Stefan Monnier
2003-10-23 22:01 ` Ian Zimmerman [this message]
2003-10-24 15:41 ` Stefan Monnier
2003-10-24 17:17 ` Ian Zimmerman
2003-10-24 19:48 ` Stefan Monnier
2003-10-30 23:59 ` Ian Zimmerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vfqfd35x.fsf@newsguy.com \
--to=bayard@newsguy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.