summaryrefslogtreecommitdiff
path: root/lisp/newcomment.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2005-11-04 22:20:12 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2005-11-04 22:20:12 +0000
commit45f6a663d781920a22a7ef87cece08458b8adc83 (patch)
tree702f51774ba733cc4277775b14573b65da0d5a79 /lisp/newcomment.el
parent20b69789f39002044bb4618e0d97179d5498659a (diff)
downloademacs-45f6a663d781920a22a7ef87cece08458b8adc83.tar.gz
(comment-region-internal): Box more tightly in the
common case where there's no TAB in the boxed text.
Diffstat (limited to 'lisp/newcomment.el')
-rw-r--r--lisp/newcomment.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 6d95d3ee16e..938cd5fe141 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -943,9 +943,13 @@ the region rather than at left margin."
(setq max-indent (max max-indent (current-column)))
(not (or (eobp) (progn (forward-line) nil)))))
- ;; Inserting ccs can change max-indent by (1- tab-width).
(setq max-indent
- (+ max-indent (max (length cs) (length ccs)) tab-width -1))
+ (+ max-indent (max (length cs) (length ccs))
+ ;; Inserting ccs can change max-indent by (1- tab-width)
+ ;; but only if there are TABs in the boxed text, of course.
+ (if (save-excursion (goto-char beg)
+ (search-forward "\t" end t))
+ (1- tab-width) 0)))
(unless indent (setq min-indent 0))
;; make the leading and trailing lines if requested