changeset 26356:533da0020196

(comment-region): Strip off white space at end of comment-start.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 05 Nov 1999 13:36:19 +0000
parents 81dd65f1709c
children 8455090c3fb2
files lisp/simple.el
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Thu Nov 04 23:23:30 1999 +0000
+++ b/lisp/simple.el	Fri Nov 05 13:36:19 1999 +0000
@@ -2790,7 +2790,10 @@
 Numeric prefix arg ARG means use ARG comment characters.
 If ARG is negative, delete that many comment characters instead.
 Comments are terminated on each line, even for syntax in which newline does
-not end the comment.  Blank lines do not get comments."
+not end the comment.  Blank lines do not get comments.
+
+The strings used as comment starts are build from
+`comment-start' without trailing spaces and `comment-padding'."
   ;; if someone wants it to only put a comment-start at the beginning and
   ;; comment-end at the end then typing it, C-x C-x, closing it, C-x C-x
   ;; is easy enough.  No option is made here for other than commenting
@@ -2800,10 +2803,13 @@
   (if (> beg end) (let (mid) (setq mid beg beg end end mid)))
   (save-excursion
     (save-restriction
-      (let ((cs comment-start) (ce comment-end)
-	    (cp (when comment-padding
-		  (make-string comment-padding ? )))
-	    numarg)
+      (let* ((comment-start
+	      (substring comment-start 0
+			 (string-match "[ \t]*$" comment-start)))
+	     (cs comment-start) (ce comment-end)
+	     (cp (when comment-padding
+		   (make-string comment-padding ? )))
+	     numarg)
 	(if (consp arg) (setq numarg t)
 	  (setq numarg (prefix-numeric-value arg))
 	  ;; For positive arg > 1, replicate the comment delims now,