diff options
author | Glenn Morris <rgm@gnu.org> | 2007-11-28 05:20:33 +0000 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2007-11-28 05:20:33 +0000 |
commit | 53dd1d5387118581452983cefee8ed801c4e8079 (patch) | |
tree | 03c0c68ed5ff969488a5b34ea4155079cbc966f5 /lisp/newcomment.el | |
parent | d0aa78bc6e0249f342a0f1d35b1af024e6c8b55b (diff) | |
download | emacs-53dd1d5387118581452983cefee8ed801c4e8079.tar.gz |
Martin Rudalics <rudalics at gmx.at>
(comment-region-internal): Fix newline insertion in `block' case.
Diffstat (limited to 'lisp/newcomment.el')
-rw-r--r-- | lisp/newcomment.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 2de4fa025fd..1841b51e305 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -969,9 +969,11 @@ INDENT indicates to put CS and CCS at the current indentation of the region rather than at left margin." ;;(assert (< beg end)) (let ((no-empty (not (or (eq comment-empty-lines t) - (and comment-empty-lines (zerop (length ce))))))) + (and comment-empty-lines (zerop (length ce)))))) + ce-sanitized) ;; Sanitize CE and CCE. (if (and (stringp ce) (string= "" ce)) (setq ce nil)) + (setq ce-sanitized ce) (if (and (stringp cce) (string= "" cce)) (setq cce nil)) ;; If CE is empty, multiline cannot be used. (unless ce (setq ccs nil cce nil)) @@ -988,7 +990,7 @@ the region rather than at left margin." (goto-char end) ;; If the end is not at the end of a line and the comment-end ;; is implicit (i.e. a newline), explicitly insert a newline. - (unless (or ce (eolp)) (insert "\n") (indent-according-to-mode)) + (unless (or ce-sanitized (eolp)) (insert "\n") (indent-according-to-mode)) (comment-with-narrowing beg end (let ((min-indent (point-max)) (max-indent 0)) |