aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2016-01-15 12:32:32 +0000
committerAlan Mackenzie2016-01-15 12:32:32 +0000
commit016b3d5894b8c424eab262aeefc646c6cd03a70a (patch)
tree4a3c57665547fb33192307f82bae4768a3b3da62
parent3ffe81e245d854a694ae1734f1b6a995bdc5e724 (diff)
downloademacs-016b3d5894b8c424eab262aeefc646c6cd03a70a.tar.gz
emacs-016b3d5894b8c424eab262aeefc646c6cd03a70a.zip
In comment-dwim with style `extra-line', respect indent-tabs-mode.
This fixes bug #22369. * lisp/newcomment.el (comment-make-bol-ws): New function. (comment-make-extra-lines): Use new function instead of a crude `make-string'.
-rw-r--r--lisp/newcomment.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 88ed08d4429..80b52ed9561 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -990,6 +990,14 @@ comment markers."
990 (goto-char (point-max)))))) 990 (goto-char (point-max))))))
991 (set-marker end nil)) 991 (set-marker end nil))
992 992
993(defun comment-make-bol-ws (len)
994 "Make a white-space string of width LEN for use at BOL.
995When `indent-tabs-mode' is non-nil, tab characters will be used."
996 (if (and indent-tabs-mode (> tab-width 0))
997 (concat (make-string (/ len tab-width) ?\t)
998 (make-string (% len tab-width) ? ))
999 (make-string len ? )))
1000
993(defun comment-make-extra-lines (cs ce ccs cce min-indent max-indent &optional block) 1001(defun comment-make-extra-lines (cs ce ccs cce min-indent max-indent &optional block)
994 "Make the leading and trailing extra lines. 1002 "Make the leading and trailing extra lines.
995This is used for `extra-line' style (or `box' style if BLOCK is specified)." 1003This is used for `extra-line' style (or `box' style if BLOCK is specified)."
@@ -1025,8 +1033,8 @@ This is used for `extra-line' style (or `box' style if BLOCK is specified)."
1025 (setq cs (replace-match fill t t s))) 1033 (setq cs (replace-match fill t t s)))
1026 (string-match re e) 1034 (string-match re e)
1027 (setq ce (replace-match fill t t e)))) 1035 (setq ce (replace-match fill t t e))))
1028 (cons (concat cs "\n" (make-string min-indent ? ) ccs) 1036 (cons (concat cs "\n" (comment-make-bol-ws min-indent) ccs)
1029 (concat cce "\n" (make-string (+ min-indent eindent) ? ) ce)))) 1037 (concat cce "\n" (comment-make-bol-ws (+ min-indent eindent)) ce))))
1030 1038
1031(defmacro comment-with-narrowing (beg end &rest body) 1039(defmacro comment-with-narrowing (beg end &rest body)
1032 "Execute BODY with BEG..END narrowing. 1040 "Execute BODY with BEG..END narrowing.