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: 18 Oct 2003 10:42:07 -0700 Organization: http://extra.newsguy.com Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87brsejvdc.fsf@newsguy.com> References: <878ynldq65.fsf@newsguy.com> <87r81byg53.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 1066500980 3891 80.91.224.253 (18 Oct 2003 18:16:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 18 Oct 2003 18:16:20 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 18 20:16:18 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 1AAvcf-0000dw-00 for ; Sat, 18 Oct 2003 20:16:17 +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 1AAvcG-0006fu-Q8 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Oct 2003 14:15:52 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!pln-w!spln!dex!extra.newsguy.com!newsp.newsguy.com!enews1 Original-Newsgroups: gnu.emacs.help Original-Lines: 89 Original-NNTP-Posting-Host: p-678.newsdawg.com User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:117395 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:13327 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13327 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. I don't understand. Are you saying people delete comments by hand with, say, M-; C-p C-p C-k ? Or is there some other way I don't know about? 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. Yes. But comment-dwim does more than just dispatch to them. If you call them directly, you lose the benefit of that additional code, whatever it is. Stefan> It's just that after many years of using those commands (they Stefan> were there in Emacs-18 already), it appeared that most of their Stefan> combined functionality could be provided with a single key Stefan> binding. Feel free not to use it or to criticize it Stefan> constructively. How am I not being constructive? I am driven by desire to improve the code. I feel that comment-dwim, unless changed into a dispatch routine and nothing else, is a bad idea and getting rid of it would be an improvement. Maybe I should clarify: my point of view is not an end user's one, but a Lisp programmer's one, specifically one writing a major mode for a programing language. I'd like to use the existing generic comment code, but I find its complexity gets in the way. Ian> Right now, comment-dwim calls comment-indent if not a blank line, Ian> but inserts a comment itself on a blank one. The two braches are Ian> quite different, use different customization variables, etc. Stefan> They don't use the same settings because experience indicates Stefan> that they should behave differently. For example, in Lisp, Stefan> comment-indent should use a single `;' whereas when inserting a Stefan> comment on a blank line to be indented at the same level as Stefan> code, it should use `;;'. Also in one circumstance a space Stefan> might be desired but not in the other, ... First, comment-indent already tests for an empty line. Why not add the special code there, rather than in comment-dwim? Second, do you have any advice for me when I _want_ them to behave the same? (Perhaps with the exception of indentation, but comment-indent-function should take care of that). Just ignoring comment-dwim doesn't solve it because comment-region also uses the "other" settings. Stefan> The way to customize those could be improved. It is currently Stefan> mostly due to historical baggage. For example, the number of Stefan> spaces to put after the comment marker in comment-indent can Stefan> only be specified directly in `comment-start', whereas comments Stefan> on their own line specify it with `comment-add' (which Stefan> incidentally cannot remove space from `comment-start'). Stefan> Suggestions are welcome, but don't forget that supporting Stefan> people's current settings (embedded in packages written in 1997, Stefan> for example) is important. Isn't that exactly what I wrote in my first post? And you seemed to indicate it wans't as important as I thought. Ian> And, let me repeat myself, the reindent in comment-kill is a bug. Stefan> You can repeat it all you want here, but it will only get heard Stefan> by the powers that be if you post it via M-x report-emacs-bug. Stefan> I'd tend to agree, BTW, after thinking about it a bit more. OK. But please, let's stop the acrimonious tone. Again, all I want is to improve Emacs. BTW, another bug is that comment-indent uses (indent-according-to-mode) to position the comment when comment-indent-function returns nil. That makes no sense when there's preceding code on the line (which is always, now that comment-dwim handles the empty case itself). Fortunately, this is easy to work around, I just make sure my comment-indent-function _never_ returns nil. -- Wer Schoenheit angeschaut mit Augen, hat dem Tode schon Anheim gegeben. Von Platen.