summaryrefslogtreecommitdiff
path: root/lisp/textmodes/fill.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2010-08-02 12:25:27 +0200
committerStefan Monnier <monnier@iro.umontreal.ca>2010-08-02 12:25:27 +0200
commit3311d1c27f57fcc757b5c4f2c9c814008f6cb003 (patch)
treec99d9109cd14f782de0fbbdec1d9f16ebfa450b7 /lisp/textmodes/fill.el
parent0798a8d85cbb4c6d5948243869bfb137782eaeeb (diff)
downloademacs-3311d1c27f57fcc757b5c4f2c9c814008f6cb003.tar.gz
* lisp/textmodes/fill.el (justify-current-line): Don't add 1 to nspaces
when justifying. It seems useless and harmful for ncols=1. Fixes: debbugs:6738
Diffstat (limited to 'lisp/textmodes/fill.el')
-rw-r--r--lisp/textmodes/fill.el22
1 files changed, 10 insertions, 12 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 605f3f8c101..a9eb45939b2 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -1289,18 +1289,16 @@ otherwise it is made canonical."
(skip-chars-backward " "))
(setq ncols (- fc endcol))
;; Ncols is number of additional space chars needed
- (if (and (> ncols 0) (> nspaces 0) (not eop))
- (progn
- (setq curr-fracspace (+ ncols (/ (1+ nspaces) 2))
- count nspaces)
- (while (> count 0)
- (skip-chars-forward " ")
- (insert-and-inherit
- (make-string (/ curr-fracspace nspaces) ?\s))
- (search-forward " " nil t)
- (setq count (1- count)
- curr-fracspace
- (+ (% curr-fracspace nspaces) ncols)))))))
+ (when (and (> ncols 0) (> nspaces 0) (not eop))
+ (setq curr-fracspace (+ ncols (/ nspaces 2))
+ count nspaces)
+ (while (> count 0)
+ (skip-chars-forward " ")
+ (insert-char ?\s (/ curr-fracspace nspaces) t)
+ (search-forward " " nil t)
+ (setq count (1- count)
+ curr-fracspace
+ (+ (% curr-fracspace nspaces) ncols))))))
(t (error "Unknown justification value"))))
(goto-char pos)
(move-marker pos nil)))