From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: comment-kill and the state of the world Date: Fri, 24 Oct 2003 15:41:30 GMT Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <878ynldq65.fsf@newsguy.com> <87r81byg53.fsf@newsguy.com> <87brsejvdc.fsf@newsguy.com> <87vfqfd35x.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 1067010435 11581 80.91.224.253 (24 Oct 2003 15:47:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Oct 2003 15:47:15 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 24 17:47:13 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 1AD49h-0005E1-00 for ; Fri, 24 Oct 2003 17:47:13 +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 1AD49F-00054z-Tj for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Oct 2003 11:46:45 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!snoopy.risq.qc.ca!charlie.risq.qc.ca!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 71 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-NNTP-Posting-Host: 132.204.24.42 Original-X-Complaints-To: abuse@umontreal.ca Original-X-Trace: charlie.risq.qc.ca 1067010090 132.204.24.42 (Fri, 24 Oct 2003 11:41:30 EDT) Original-NNTP-Posting-Date: Fri, 24 Oct 2003 11:41:30 EDT Original-Xref: shelby.stanford.edu gnu.emacs.help:117585 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:13516 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13516 > So, how _do_ people kill their comments? Using standard editing commands, I guess. I myself tend to use C-k, I think. 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. There are two parts: 1 - move the code out of comment-dwim so that comment-dwim is really just a dispatch function. 2 - move the code into comment-indent. Part 1 can be done safely and easily without any objection. Part 2 means changing the behavior of the comment-indent command (which does not bother me but might bother RMS or other users, so you'd have to report it as a bug or feature request). `comment-indent' is also used as a function called from comment-indent-new-line and that code (and its interaction with comment-indent) is pretty delicate, so the patch would have to be written carefully a thoroughly tested, which I have no intent to do unless there's a good reason for it (but feel free to do it). If the merge into comment-indent is well done it could definitely be a good thing (and who knows, it might clean things up). Could you explain why you'd want the code to be moved into 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. By "configure comment-dwim", I assume you mean "configure comment-padding". Note that if you "configure comment-dwim" by changing comment-end and comment-start instead (by setting them to "{- " and " -}" for example), it will work the same way for comment-indent. Sometimes you want it to behave the same in both case, sometimes you want it to behave differently, which is why there are two ways to configure the spacing. Admittedly, the `comment-padding' way is easier and very different from the other, so it's pretty ugly, but that's the way it worked in Emacs-20, so I had to support it in Emacs-21. RMS would probably accept a patch for a new config option something like `comment-padding-foo' which would be used for comments on non-empty lines and could be set to nil to mean use the same value as `comment-padding'. You'd have to come up with a good name for the variable, tho. It's just that the need hasn't come up yet because configuring comment-start and comment-end works as well in all the actual cases I've come across. 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. Thank you. Stefan