Subject: Re: bug#8150: 23.2; cperl-uncomment-region is NOT an inverse of cperl-comment-region
From: Stefan Monnier <[email-masked]>
To: Lawrence Mitchell <[email-masked]>
Cc: [email-masked]
Date: Fri, 17 Feb 2012 10:45:23 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

> 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?

I've simplified the patch and installed it (see below),

        Stefan

--- lisp/newcomment.el	2012-01-19 07:21:25 +0000
+++ lisp/newcomment.el	2012-02-17 15:41:15 +0000
@@ -872,14 +872,15 @@
 	  (when (and sre (looking-at (concat "\\s-*\n\\s-*" srei)))
 	    (goto-char (match-end 0)))
 	  (if (null arg) (delete-region (point-min) (point))
-	    (skip-syntax-backward " ")
+            (let* ((opoint (point-marker))
+                   (nchar (skip-syntax-backward " ")))
 	    (delete-char (- numarg))
-	    (unless (or (bobp)
+              (unless (and (not (bobp))
 			(save-excursion (goto-char (point-min))
 					(looking-at comment-start-skip)))
 	      ;; If there's something left but it doesn't look like
 	      ;; a comment-start any more, just remove it.
-	      (delete-region (point-min) (point))))
+                (delete-region (point-min) opoint))))
 
 	  ;; Remove the end-comment (and leading padding and such).
 	  (goto-char (point-max)) (comment-enter-backward)