]> git.eshelyaron.com Git - emacs.git/commitdiff
(comment-region): Delete spaces only if we
authorRichard M. Stallman <rms@gnu.org>
Fri, 8 Jan 1999 04:29:20 +0000 (04:29 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 8 Jan 1999 04:29:20 +0000 (04:29 +0000)
deleted a comment starter.

lisp/simple.el

index ce6f31d1fffbe878a2db56967fbe0d0495b1323d..c0be05d9e18c3e8f11b6007b075b1d65a877c788 100644 (file)
@@ -2804,18 +2804,21 @@ not end the comment.  Blank lines do not get comments."
        (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