diff options
| -rw-r--r-- | lisp/newcomment.el | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 2a0f8a8ae50..66296b81828 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el | |||
| @@ -69,6 +69,9 @@ | |||
| 69 | 69 | ||
| 70 | ;;; Code: | 70 | ;;; Code: |
| 71 | 71 | ||
| 72 | (eval-when-compile | ||
| 73 | (require 'subr-x)) | ||
| 74 | |||
| 72 | ;;;###autoload | 75 | ;;;###autoload |
| 73 | (defalias 'indent-for-comment 'comment-indent) | 76 | (defalias 'indent-for-comment 'comment-indent) |
| 74 | ;;;###autoload | 77 | ;;;###autoload |
| @@ -1141,6 +1144,9 @@ the region rather than at left margin." | |||
| 1141 | 1144 | ||
| 1142 | ;; make the leading and trailing lines if requested | 1145 | ;; make the leading and trailing lines if requested |
| 1143 | (when lines | 1146 | (when lines |
| 1147 | ;; Trim trailing whitespace from cs if there's some. | ||
| 1148 | (setq cs (string-trim-right cs)) | ||
| 1149 | |||
| 1144 | (let ((csce | 1150 | (let ((csce |
| 1145 | (comment-make-extra-lines | 1151 | (comment-make-extra-lines |
| 1146 | cs ce ccs cce min-indent max-indent block))) | 1152 | cs ce ccs cce min-indent max-indent block))) |
| @@ -1211,7 +1217,7 @@ changed with `comment-style'." | |||
| 1211 | (progn (goto-char end) (end-of-line) (skip-syntax-backward " ") | 1217 | (progn (goto-char end) (end-of-line) (skip-syntax-backward " ") |
| 1212 | (<= (point) end)) | 1218 | (<= (point) end)) |
| 1213 | (or block (not (string= "" comment-end))) | 1219 | (or block (not (string= "" comment-end))) |
| 1214 | (or block (progn (goto-char beg) (search-forward "\n" end t))))) | 1220 | (or block (progn (goto-char beg) (re-search-forward "$" end t))))) |
| 1215 | 1221 | ||
| 1216 | ;; don't add end-markers just because the user asked for `block' | 1222 | ;; don't add end-markers just because the user asked for `block' |
| 1217 | (unless (or lines (string= "" comment-end)) (setq block nil)) | 1223 | (unless (or lines (string= "" comment-end)) (setq block nil)) |