Subject: bug#8150: 23.2; cperl-uncomment-region is NOT an inverse of cperl-comment-region

From: Lawrence Mitchell <[email-masked]>
Date: Fri, 17 Feb 2012 12:47:10 +0000

I'm chasing up open bugs I've participated in, probably too late
for 24.1, but just to see if anything's doing.  Is there any
objection to applying the patch in this bug report?

Lawrence Mitchell wrote:

[...]

> Note that the problem is that (uncomment-region A B 1) is not the
> inverse of (comment-region A B 1).  Irrespective of the major
> mode in effect:

> emacs -Q

> C-x h
> C-1 M-x comment-region RET
> C-x h
> C-1 M-x uncomment-region RET

> Note how there is now a space at the beginning of every line in
> the *scratch* buffer.

> This is due to the following code in uncomment-region-default:

> |	  (if (null arg) (delete-region (point-min) (point))
> |	    (skip-syntax-backward " ")
> |	    (delete-char (- numarg))

>    # foo bar
>      ^ point is here when the above code is called.

> If an argument is supplied, arg is non-nil and so to delete the
> comment we first move backwards over whitespace and then delete
> as many comment characters as specified by the argument (1 in
> this case).