From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ian Zimmerman Newsgroups: gmane.emacs.help Subject: Re: comment-kill and the state of the world Date: 23 Oct 2003 15:01:30 -0700 Organization: http://extra.newsguy.com Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87vfqfd35x.fsf@newsguy.com> References: <878ynldq65.fsf@newsguy.com> <87r81byg53.fsf@newsguy.com> <87brsejvdc.fsf@newsguy.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1066948367 28394 80.91.224.253 (23 Oct 2003 22:32:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 23 Oct 2003 22:32:47 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 24 00:32:41 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ACo0X-0007sS-00 for ; Fri, 24 Oct 2003 00:32:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ACnzk-00020C-MR for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Oct 2003 18:31:52 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!elnk-pas-nf1!newsfeed.earthlink.net!newsfeed2.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!pln-e!spln!dex!extra.newsguy.com!newsp.newsguy.com!enews1 Original-Newsgroups: gnu.emacs.help Original-Lines: 74 Original-NNTP-Posting-Host: p-615.newsdawg.com User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:117573 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13504 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13504 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.