aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1999-01-08 04:29:20 +0000
committerRichard M. Stallman1999-01-08 04:29:20 +0000
commit7be272f43c5e7d8fbfb47e8e1a7ce49d83a94ff2 (patch)
treeb6d8ac34318588940b5d2a8b6552f467346c5b88
parentbc10f81b82bad77ff1b3717af899108d5b1feb7c (diff)
downloademacs-7be272f43c5e7d8fbfb47e8e1a7ce49d83a94ff2.tar.gz
emacs-7be272f43c5e7d8fbfb47e8e1a7ce49d83a94ff2.zip
(comment-region): Delete spaces only if we
deleted a comment starter.
-rw-r--r--lisp/simple.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index ce6f31d1fff..c0be05d9e18 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2804,18 +2804,21 @@ not end the comment. Blank lines do not get comments."
2804 (goto-char beg) 2804 (goto-char beg)
2805 (if (or (eq numarg t) (< numarg 0)) 2805 (if (or (eq numarg t) (< numarg 0))
2806 (while (not (eobp)) 2806 (while (not (eobp))
2807 (progn 2807 (let (found-comment)
2808 ;; Delete comment start from beginning of line. 2808 ;; Delete comment start from beginning of line.
2809 (if (eq numarg t) 2809 (if (eq numarg t)
2810 (while (looking-at (regexp-quote cs)) 2810 (while (looking-at (regexp-quote cs))
2811 (setq found-comment t)
2811 (delete-char (length cs))) 2812 (delete-char (length cs)))
2812 (let ((count numarg)) 2813 (let ((count numarg))
2813 (while (and (> 1 (setq count (1+ count))) 2814 (while (and (> 1 (setq count (1+ count)))
2814 (looking-at (regexp-quote cs))) 2815 (looking-at (regexp-quote cs)))
2816 (setq found-comment t)
2815 (delete-char (length cs))))) 2817 (delete-char (length cs)))))
2816 ;; Delete comment padding from beginning of line 2818 ;; Delete comment padding from beginning of line
2817 (when (and comment-padding (looking-at (regexp-quote cp))) 2819 (when (and found-comment comment-padding
2818 (delete-char comment-padding)) 2820 (looking-at (regexp-quote cp)))
2821 (delete-char comment-padding))
2819 ;; Delete comment end from end of line. 2822 ;; Delete comment end from end of line.
2820 (if (string= "" ce) 2823 (if (string= "" ce)
2821 nil 2824 nil