Subject: Re: bug#64104: Subject: 30.0.50; uncomment-region-default-1

From: Eli Zaretskii <[email-masked]>
Date: Sat, 17 Jun 2023 11:38:24 +0300

> Date: Fri, 16 Jun 2023 10:51:24 +0200
> From: Andreas Röhler <[email-masked]>
> 
> C-u comment-dwim RET with an active region of the following Python code:
> 
> ---
> # for i in text:
> #     print("(i): {}".format(str(i)))
> ---
> 
> results in error saying
> 
> uncomment-region-default-1: Beginning of buffer

AFAICT, that's because invoking comment-dwim with C-u in this case
makes no sense: the comment delimiters have just 1 character in this
case.  Try "C-u 1 M-x comment-dwim" instead.

> comment-dwin says:
> 
> if a prefix ARG is specified, call ‘comment-kill’
> 
> which is my intended use-case.

If this is what you wanted, then you should invoke "C-u comment-dwin"
without having an active region.  The doc string says that if the
region is active, it will call comment-region or uncomment-region, and
will call comment-kill only "otherwise" (i.e. if there's no active
region).  I suggest to read the node "Comment Commands" in the Emacs
manual, it describes this in more detail.

I've now made the doc string slightly more detailed, especially wrt
how the prefix argument is used in the various use cases, but other
than that, I don't think there's a bug here.

Stefan, any comments?