[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 5a78876 5/7: In comment-dwim with style `extra-line
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 5a78876 5/7: In comment-dwim with style `extra-line', respect indent-tabs-mode. |
Date: |
Tue, 22 Mar 2016 00:06:00 +0000 |
branch: master
commit 5a78876770255ee5e4f2dd0e9b5de30389b195da
Author: Alan Mackenzie <address@hidden>
Commit: Paul Eggert <address@hidden>
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'.
[This reapplies commit 016b3d5894b8c424eab262aeefc646c6cd03a70a,
which was inadvertently lost by merge commit
7823745acbe9b87eea2db4ef434e379fc903ec35.]
---
lisp/newcomment.el | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 88ed08d..80b52ed 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -990,6 +990,14 @@ comment markers."
(goto-char (point-max))))))
(set-marker end nil))
+(defun comment-make-bol-ws (len)
+ "Make a white-space string of width LEN for use at BOL.
+When `indent-tabs-mode' is non-nil, tab characters will be used."
+ (if (and indent-tabs-mode (> tab-width 0))
+ (concat (make-string (/ len tab-width) ?\t)
+ (make-string (% len tab-width) ? ))
+ (make-string len ? )))
+
(defun comment-make-extra-lines (cs ce ccs cce min-indent max-indent &optional
block)
"Make the leading and trailing extra lines.
This 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)."
(setq cs (replace-match fill t t s)))
(string-match re e)
(setq ce (replace-match fill t t e))))
- (cons (concat cs "\n" (make-string min-indent ? ) ccs)
- (concat cce "\n" (make-string (+ min-indent eindent) ? ) ce))))
+ (cons (concat cs "\n" (comment-make-bol-ws min-indent) ccs)
+ (concat cce "\n" (comment-make-bol-ws (+ min-indent eindent)) ce))))
(defmacro comment-with-narrowing (beg end &rest body)
"Execute BODY with BEG..END narrowing.
- [Emacs-diffs] master updated (5283593 -> 515ce25), Paul Eggert, 2016/03/21
- [Emacs-diffs] master 5a78876 5/7: In comment-dwim with style `extra-line', respect indent-tabs-mode.,
Paul Eggert <=
- [Emacs-diffs] master 515ce25 7/7: Don't confuse "::" with ":" when trying to parse member initializers., Paul Eggert, 2016/03/21
- [Emacs-diffs] master fa5c69c 1/7: ; * etc/NEWS: Remove unneeded text., Paul Eggert, 2016/03/21
- [Emacs-diffs] master 1e9a122 2/7: Fix picture-mode wrt double-width characters, Paul Eggert, 2016/03/21
- [Emacs-diffs] master a17bdde 6/7: Ensure positive number of glyphs for margins of positive width, Paul Eggert, 2016/03/21
- [Emacs-diffs] master 05b6268 4/7: Merge doc fixes for 'random' lost in previous merge, Paul Eggert, 2016/03/21
- [Emacs-diffs] master a1f71da 3/7: Unhide the --no-line-directive option to 'etags', Paul Eggert, 2016/03/21