GNU bug report logs - #1286
comment-dwim on a comment line does not toggle comment

Previous Next

Package: emacs;

Reported by: xah lee <xah <at> xahlee.org>

Date: Fri, 31 Oct 2008 21:35:02 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1286 in the body.
You can then email your comments to 1286 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1286; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to xah lee <xah <at> xahlee.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: xah lee <xah <at> xahlee.org>
To: bug-gnu-emacs <at> gnu.org
Subject: comment-dwim on a comment line does not toggle comment
Date: Fri, 31 Oct 2008 14:25:09 -0700
this appears to be like a bug.

in emacs-lisp-mode, if you have a comment like this:

;; This is a comment

and your cursor is somewhere on that line. Now, do comment-dwim, it  
doesn't uncomment the line. It just moves the cursor to the “T”  
in “This”.

Same behavior in cperl mode and probably all others.

I think this might be by design, but it seems counter-intuitive.

In GNU Emacs 22.2.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0)
 of 2008-04-05 on g5.tokyo.stp.isas.jaxa.jp

  Xah
∑ http://xahlee.org/

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to xah lee <xah <at> xahlee.org>:
bug acknowledged by developer. Full text and rfc822 format available.

Message #10 received at 1286-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: xah lee <xah <at> xahlee.org>
Cc: 1286-done <at> debbugs.gnu.org
Subject: Re: bug#1286: comment-dwim on a comment line does not toggle comment
Date: Fri, 31 Oct 2008 21:33:32 -0400
> this appears to be like a bug.

> in emacs-lisp-mode, if you have a comment like this:

> ;; This is a comment

> and your cursor is somewhere on that line. Now, do comment-dwim, it doesn't
> uncomment the line. It just moves the cursor to the “T”  in “This”.

> Same behavior in cperl mode and probably all others.

> I think this might be by design, but it seems counter-intuitive.

This is the way M-; has worked for as long as I can remember.
It also re-indents the comment, if needed.  If you want to uncomment,
then select the line via e.g. C-a C-SPC C-n and then M-; will do what
you asked for.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1286; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Xavier Maillard <xma <at> gnu.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #15 received at 1286 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Xavier Maillard <xma <at> gnu.org>
To: xah lee <xah <at> xahlee.org>, 1286 <at> debbugs.gnu.org
Cc: bug-gnu-emacs <at> gnu.org, bug-submit-list <at> donarmstrong.com,
        bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1286: comment-dwim on a comment line does not toggle comment
Date: Mon, 3 Nov 2008 12:25:08 +0100
   this appears to be like a bug.

   in emacs-lisp-mode, if you have a comment like this:

   ;; This is a comment

   and your cursor is somewhere on that line. Now, do comment-dwim, it  
   doesn't uncomment the line. It just moves the cursor to the  T   
   in  This .

   Same behavior in cperl mode and probably all others.

   I think this might be by design, but it seems counter-intuitive.

I am sure you read it but just in case:

comment-dwim is an interactive autoloaded Lisp function in
`newcomment.el'.

It is bound to M-;.

(comment-dwim ARG)

Call the comment command you want (Do What I Mean).
If the region is active and `transient-mark-mode' is on, call
  `comment-region' (unless it only consists of comments, in which
  case it calls `uncomment-region').
Else, if the current line is empty, call `comment-insert-comment-function'
if it is defined, otherwise insert a comment and indent it.
Else if a prefix ARG is specified, call `comment-kill'.
Else, call `comment-indent'.
You can configure `comment-style' to change the way regions are commented.

For my point of view, this is well defined here and it behaves
just as described.

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1286; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Xavier Maillard <xma <at> gnu.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1286; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to xah lee <xah <at> xahlee.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #25 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: xah lee <xah <at> xahlee.org>
To: Xavier Maillard <xma <at> gnu.org>
Cc: 1286 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org,
        bug-submit-list <at> donarmstrong.com
Subject: Re: bug#1286: comment-dwim on a comment line does not toggle comment
Date: Mon, 3 Nov 2008 13:10:24 -0800
Xavier Maillard wrote:
«For my point of view, this is well defined here and it behaves just  
as described.»

I agree it's well defined and documented. However, i think it is not  
intuitive, even people who have used emacs for 3 or more years and  
are familiar with its terminologies and behaviors.

when a cursor is on a comment line (whole line is comment) and  
there's no active region, i don't see any reason it shouldn't just  
uncomment the line when calling comment-dwim. I would say that, any  
person, including those using emacs for 3 or more years, who are  
using comment-dwim for the first time, would expect it to uncomment it.

is there a reason why it shouldn't uncomment other than “it's that  
way for long”?

PS I only started to use comment-dwim in this or last year. In the  
past, i've always used string-rectangle and kill-rectangle. I started  
to use emacs daily in a day job since 1998, and for the first 7 years  
i use it exclusively in terminals.

  Xah
∑ http://xahlee.org/

☄
----------------------------------
On Nov 3, 2008, at 3:25 AM, Xavier Maillard wrote:


   this appears to be like a bug.

   in emacs-lisp-mode, if you have a comment like this:

   ;; This is a comment

   and your cursor is somewhere on that line. Now, do comment-dwim, it
   doesn't uncomment the line. It just moves the cursor to the  T
   in  This .

   Same behavior in cperl mode and probably all others.

   I think this might be by design, but it seems counter-intuitive.

I am sure you read it but just in case:

comment-dwim is an interactive autoloaded Lisp function in
`newcomment.el'.

It is bound to M-;.

(comment-dwim ARG)

Call the comment command you want (Do What I Mean).
If the region is active and `transient-mark-mode' is on, call
  `comment-region' (unless it only consists of comments, in which
  case it calls `uncomment-region').
Else, if the current line is empty, call `comment-insert-comment- 
function'
if it is defined, otherwise insert a comment and indent it.
Else if a prefix ARG is specified, call `comment-kill'.
Else, call `comment-indent'.
You can configure `comment-style' to change the way regions are  
commented.

For my point of view, this is well defined here and it behaves
just as described.

-----------------------






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1286; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to xah lee <xah <at> xahlee.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1286; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #35 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: xah lee <xah <at> xahlee.org>
Cc: 1286 <at> debbugs.gnu.org, Xavier Maillard <xma <at> gnu.org>,
        bug-gnu-emacs <at> gnu.org, bug-submit-list <at> donarmstrong.com
Subject: Re: bug#1286: comment-dwim on a comment line does not toggle comment
Date: Tue, 04 Nov 2008 11:34:33 -0500
> when a cursor is on a comment line (whole line is comment) and there's no
> active region, i don't see any reason it shouldn't just uncomment the line
> when calling comment-dwim. I would say that, any  person, including those

I, on the other hand, don't see why it should do that.  What would be
the logic behind it?  And according to that logic what should it do if
the line contains a comment as well as some code?

As explained, the M-; behavior you're seeing has been with us for many
many years, so there needs to be a good reason for the change (and the
previous behavior of inserting a comment marker and/or reindenting
a preexisting comment marker, should still be available somewhere).


        Stefan






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1286; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1286; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Xavier Maillard <xma <at> gnu.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #45 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Xavier Maillard <xma <at> gnu.org>
To: xah lee <xah <at> xahlee.org>
Cc: 1286 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org,
        bug-submit-list <at> donarmstrong.com
Subject: Re: bug#1286: comment-dwim on a comment line does not toggle comment
Date: Wed, 5 Nov 2008 08:25:03 +0100
   Xavier Maillard wrote:
   «For my point of view, this is well defined here and it behaves just  
   as described.»

   I agree it's well defined and documented. However, i think it is not  
   intuitive, even people who have used emacs for 3 or more years and  
   are familiar with its terminologies and behaviors.

   when a cursor is on a comment line (whole line is comment) and  
   there's no active region, i don't see any reason it shouldn't just  
   uncomment the line when calling comment-dwim. I would say that, any  
   person, including those using emacs for 3 or more years, who are  
   using comment-dwim for the first time, would expect it to uncomment it.

Speaking for myself, as a more-than-3-years emacs user, I do not
see why it should uncomment anything here. I am used to activate
a commented region and then M-; to uncomment it. M-; has always
done the right thing: comment and indent.

Dunno what other people think about that though.

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1286; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Xavier Maillard <xma <at> gnu.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Thu, 04 Dec 2008 15:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 203 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.