aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann1999-11-05 13:36:19 +0000
committerGerd Moellmann1999-11-05 13:36:19 +0000
commite3de129b92041bcc17d5dad0de893399162c2309 (patch)
treec14b3ea03baee9b2f0db19a70798f364f5e916d8
parentc3d00920f91cebe2b5a134c18e94fc28b9628fe3 (diff)
downloademacs-e3de129b92041bcc17d5dad0de893399162c2309.tar.gz
emacs-e3de129b92041bcc17d5dad0de893399162c2309.zip
(comment-region): Strip off white space at end of
comment-start.
-rw-r--r--lisp/simple.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 6ba3783477b..aa2ab25aa90 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2790,7 +2790,10 @@ With just C-u prefix arg, uncomment each line in region.
2790Numeric prefix arg ARG means use ARG comment characters. 2790Numeric prefix arg ARG means use ARG comment characters.
2791If ARG is negative, delete that many comment characters instead. 2791If ARG is negative, delete that many comment characters instead.
2792Comments are terminated on each line, even for syntax in which newline does 2792Comments are terminated on each line, even for syntax in which newline does
2793not end the comment. Blank lines do not get comments." 2793not end the comment. Blank lines do not get comments.
2794
2795The strings used as comment starts are build from
2796`comment-start' without trailing spaces and `comment-padding'."
2794 ;; if someone wants it to only put a comment-start at the beginning and 2797 ;; if someone wants it to only put a comment-start at the beginning and
2795 ;; comment-end at the end then typing it, C-x C-x, closing it, C-x C-x 2798 ;; comment-end at the end then typing it, C-x C-x, closing it, C-x C-x
2796 ;; is easy enough. No option is made here for other than commenting 2799 ;; is easy enough. No option is made here for other than commenting
@@ -2800,10 +2803,13 @@ not end the comment. Blank lines do not get comments."
2800 (if (> beg end) (let (mid) (setq mid beg beg end end mid))) 2803 (if (> beg end) (let (mid) (setq mid beg beg end end mid)))
2801 (save-excursion 2804 (save-excursion
2802 (save-restriction 2805 (save-restriction
2803 (let ((cs comment-start) (ce comment-end) 2806 (let* ((comment-start
2804 (cp (when comment-padding 2807 (substring comment-start 0
2805 (make-string comment-padding ? ))) 2808 (string-match "[ \t]*$" comment-start)))
2806 numarg) 2809 (cs comment-start) (ce comment-end)
2810 (cp (when comment-padding
2811 (make-string comment-padding ? )))
2812 numarg)
2807 (if (consp arg) (setq numarg t) 2813 (if (consp arg) (setq numarg t)
2808 (setq numarg (prefix-numeric-value arg)) 2814 (setq numarg (prefix-numeric-value arg))
2809 ;; For positive arg > 1, replicate the comment delims now, 2815 ;; For positive arg > 1, replicate the comment delims now,