Fix documentation of comment-dwim (bug#64104)
* lisp/newcomment.el (comment-dwim): Doc fix. * doc/emacs/programs.texi (Comment Commands): More accurate description of what 'M-;' does when there's no active region.
This commit is contained in:
parent
71b27779a9
commit
3b0bf359e9
2 changed files with 18 additions and 10 deletions
|
@ -1095,14 +1095,17 @@ were negated.
|
||||||
|
|
||||||
@findex comment-kill
|
@findex comment-kill
|
||||||
@kindex C-u M-;
|
@kindex C-u M-;
|
||||||
@kbd{C-u M-;} (@code{comment-dwim} with a prefix argument) kills any
|
@kbd{C-u M-;} (@code{comment-dwim} with a prefix argument) when the
|
||||||
comment on the current line, along with the whitespace before it.
|
region is not active kills any comment on the current line, along with
|
||||||
Since the comment is saved to the kill ring, you can reinsert it on
|
the whitespace before it. Since the comment is saved to the kill
|
||||||
another line by moving to the end of that line, doing @kbd{C-y}, and
|
ring, you can reinsert it on another line by moving to the end of that
|
||||||
then @kbd{M-;} to realign the comment. You can achieve the same
|
line, doing @kbd{C-y}, and then @kbd{M-;} to realign the comment. You
|
||||||
effect as @kbd{C-u M-;} by typing @kbd{M-x comment-kill}
|
can achieve the same effect as @kbd{C-u M-;} by typing @kbd{M-x
|
||||||
(@code{comment-dwim} actually calls @code{comment-kill} as a
|
comment-kill} (@code{comment-dwim} actually calls @code{comment-kill}
|
||||||
subroutine when it is given a prefix argument).
|
as a subroutine when it is given a prefix argument). Invoking
|
||||||
|
@code{comment-dwim} with a prefix numeric argument, as in @w{@kbd{C-u
|
||||||
|
@var{n} M-;}}, when there's no active region, tells
|
||||||
|
@code{comment-kill} to kill comments on @var{n} lines.
|
||||||
|
|
||||||
@kindex C-c C-c @r{(C mode)}
|
@kindex C-c C-c @r{(C mode)}
|
||||||
@findex comment-region
|
@findex comment-region
|
||||||
|
|
|
@ -1356,10 +1356,15 @@ is passed on to the respective function."
|
||||||
"Call the comment command you want (Do What I Mean).
|
"Call the comment command you want (Do What I Mean).
|
||||||
If the region is active and `transient-mark-mode' is on, call
|
If the region is active and `transient-mark-mode' is on, call
|
||||||
`comment-region' (unless it only consists of comments, in which
|
`comment-region' (unless it only consists of comments, in which
|
||||||
case it calls `uncomment-region').
|
case it calls `uncomment-region'); in this case, prefix numeric
|
||||||
|
argument ARG specifies how many characters to remove from each
|
||||||
|
comment delimiter (so don't specify a prefix argument whose value
|
||||||
|
is greater than the total length of the comment delimiters).
|
||||||
Else, if the current line is empty, call `comment-insert-comment-function'
|
Else, if the current line is empty, call `comment-insert-comment-function'
|
||||||
if it is defined, otherwise insert a comment and indent it.
|
if it is defined, otherwise insert a comment and indent it.
|
||||||
Else if a prefix ARG is specified, call `comment-kill'.
|
Else, if a prefix ARG is specified, call `comment-kill'; in this
|
||||||
|
case, prefix numeric argument ARG specifies on how many lines to kill
|
||||||
|
the comments.
|
||||||
Else, call `comment-indent'.
|
Else, call `comment-indent'.
|
||||||
You can configure `comment-style' to change the way regions are commented."
|
You can configure `comment-style' to change the way regions are commented."
|
||||||
(interactive "*P")
|
(interactive "*P")
|
||||||
|
|
Loading…
Add table
Reference in a new issue