* My uncomment-region broke
@ 2021-11-02 14:18 Ken Goldman
2021-11-02 14:56 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ken Goldman @ 2021-11-02 14:18 UTC (permalink / raw)
To: help-gnu-emacs
(defun uncomment-region (b e)
"Remove one level of comment around region."
(interactive "r")
(comment-region b e -1))
I've been using this for years. I select a region with the
mouse and this uncomments it. With new emacs, I get
comment-region-default-1: Wrong number of arguments: (lambda (b e) "Remove one level of comment around region." (interactive "r") (comment-region b e -1)), 3
I'm not an elisp programmer. Can someone supply a replacement?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: My uncomment-region broke
2021-11-02 14:18 My uncomment-region broke Ken Goldman
@ 2021-11-02 14:56 ` Eli Zaretskii
2021-11-02 15:14 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-02 15:17 ` Stephen Berman
2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2021-11-02 14:56 UTC (permalink / raw)
To: help-gnu-emacs
> From: Ken Goldman <kgoldman@us.ibm.com>
> Date: Tue, 2 Nov 2021 10:18:08 -0400
>
> (defun uncomment-region (b e)
> "Remove one level of comment around region."
> (interactive "r")
> (comment-region b e -1))
>
> I've been using this for years. I select a region with the
> mouse and this uncomments it. With new emacs, I get
>
> comment-region-default-1: Wrong number of arguments: (lambda (b e) "Remove one level of comment around region." (interactive "r") (comment-region b e -1)), 3
>
> I'm not an elisp programmer. Can someone supply a replacement?
You want
(comment-region b e '(4))
instead of the last line.
(Or just say "C-u M-x comment-region RET".)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: My uncomment-region broke
2021-11-02 14:18 My uncomment-region broke Ken Goldman
2021-11-02 14:56 ` Eli Zaretskii
@ 2021-11-02 15:14 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-02 16:10 ` Ken Goldman
2021-11-02 15:17 ` Stephen Berman
2 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-11-02 15:14 UTC (permalink / raw)
To: help-gnu-emacs
Ken Goldman [2021-11-02 10:18:08] wrote:
> (defun uncomment-region (b e)
> "Remove one level of comment around region."
> (interactive "r")
> (comment-region b e -1))
This redefines Emacs's built-in `uncomment-region`, and does it in an
incompatible way.
> I'm not an elisp programmer. Can someone supply a replacement?
The empty string is a good replacement ;-)
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: My uncomment-region broke
2021-11-02 14:18 My uncomment-region broke Ken Goldman
2021-11-02 14:56 ` Eli Zaretskii
2021-11-02 15:14 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-11-02 15:17 ` Stephen Berman
2 siblings, 0 replies; 5+ messages in thread
From: Stephen Berman @ 2021-11-02 15:17 UTC (permalink / raw)
To: Ken Goldman; +Cc: help-gnu-emacs
On Tue, 2 Nov 2021 10:18:08 -0400 Ken Goldman <kgoldman@us.ibm.com> wrote:
> (defun uncomment-region (b e)
> "Remove one level of comment around region."
> (interactive "r")
> (comment-region b e -1))
>
> I've been using this for years. I select a region with the
> mouse and this uncomments it. With new emacs, I get
>
> comment-region-default-1: Wrong number of arguments: (lambda (b e) "Remove one
> level of comment around region." (interactive "r") (comment-region b e -1)), 3
>
> I'm not an elisp programmer. Can someone supply a replacement?
Rename it to e.g. kg-uncomment-region. (It raises an error because
comment-region-default-1 calls another emacs function uncomment-region
which takes an optional third argument, so it clashes with your
definition.)
Steve Berman
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: My uncomment-region broke
2021-11-02 15:14 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-11-02 16:10 ` Ken Goldman
0 siblings, 0 replies; 5+ messages in thread
From: Ken Goldman @ 2021-11-02 16:10 UTC (permalink / raw)
To: help-gnu-emacs
On 11/2/2021 11:14 AM, Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> Ken Goldman [2021-11-02 10:18:08] wrote:
>> (defun uncomment-region (b e)
>> "Remove one level of comment around region."
>> (interactive "r")
>> (comment-region b e -1))
>
> This redefines Emacs's built-in `uncomment-region`, and does it in an
> incompatible way.
>
Thanks. I think my function predates the built-in one. I see
now that I no longer need it.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-11-02 16:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-02 14:18 My uncomment-region broke Ken Goldman
2021-11-02 14:56 ` Eli Zaretskii
2021-11-02 15:14 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-02 16:10 ` Ken Goldman
2021-11-02 15:17 ` Stephen Berman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).