[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#1286: comment-dwim on a comment line does not toggle comment
From: |
xah lee |
Subject: |
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.
-----------------------