changeset 24028:7ffc86429459

(comment-region): Delete spaces only if we deleted a comment starter.
author Richard M. Stallman <rms@gnu.org>
date Fri, 08 Jan 1999 04:29:20 +0000
parents 660b6f8b7928
children 71731a549704
files lisp/simple.el
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Fri Jan 08 04:19:24 1999 +0000
+++ b/lisp/simple.el	Fri Jan 08 04:29:20 1999 +0000
@@ -2804,18 +2804,21 @@
 	(goto-char beg)
 	(if (or (eq numarg t) (< numarg 0))
 	    (while (not (eobp))
-	      (progn
+	      (let (found-comment)
 		;; Delete comment start from beginning of line.
 		(if (eq numarg t)
 		    (while (looking-at (regexp-quote cs))
+		      (setq found-comment t)
 		      (delete-char (length cs)))
 		  (let ((count numarg))
 		    (while (and (> 1 (setq count (1+ count)))
 				(looking-at (regexp-quote cs)))
+		      (setq found-comment t)
 		      (delete-char (length cs)))))
 		;; Delete comment padding from beginning of line
-		(when (and comment-padding (looking-at (regexp-quote cp)))
-		    (delete-char comment-padding))
+		(when (and found-comment comment-padding
+			   (looking-at (regexp-quote cp)))
+		  (delete-char comment-padding))
 		;; Delete comment end from end of line.
 		(if (string= "" ce)
 		    nil