aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2010-08-02 12:25:27 +0200
committerStefan Monnier2010-08-02 12:25:27 +0200
commit3311d1c27f57fcc757b5c4f2c9c814008f6cb003 (patch)
treec99d9109cd14f782de0fbbdec1d9f16ebfa450b7
parent0798a8d85cbb4c6d5948243869bfb137782eaeeb (diff)
downloademacs-3311d1c27f57fcc757b5c4f2c9c814008f6cb003.tar.gz
emacs-3311d1c27f57fcc757b5c4f2c9c814008f6cb003.zip
* 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
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/textmodes/fill.el22
2 files changed, 13 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4837023ba3b..e475a152e38 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12010-08-02 Stefan Monnier <monnier@iro.umontreal.ca> 12010-08-02 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * textmodes/fill.el (justify-current-line): Don't add 1 to nspaces
4 when justifying. It seems useless and harmful for ncols=1 (bug#6738).
5
3 * emacs-lisp/timer.el (timer-event-handler): Protect against timers 6 * emacs-lisp/timer.el (timer-event-handler): Protect against timers
4 that change current buffer. 7 that change current buffer.
5 8
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."
1289 (skip-chars-backward " ")) 1289 (skip-chars-backward " "))
1290 (setq ncols (- fc endcol)) 1290 (setq ncols (- fc endcol))
1291 ;; Ncols is number of additional space chars needed 1291 ;; Ncols is number of additional space chars needed
1292 (if (and (> ncols 0) (> nspaces 0) (not eop)) 1292 (when (and (> ncols 0) (> nspaces 0) (not eop))
1293 (progn 1293 (setq curr-fracspace (+ ncols (/ nspaces 2))
1294 (setq curr-fracspace (+ ncols (/ (1+ nspaces) 2)) 1294 count nspaces)
1295 count nspaces) 1295 (while (> count 0)
1296 (while (> count 0) 1296 (skip-chars-forward " ")
1297 (skip-chars-forward " ") 1297 (insert-char ?\s (/ curr-fracspace nspaces) t)
1298 (insert-and-inherit 1298 (search-forward " " nil t)
1299 (make-string (/ curr-fracspace nspaces) ?\s)) 1299 (setq count (1- count)
1300 (search-forward " " nil t) 1300 curr-fracspace
1301 (setq count (1- count) 1301 (+ (% curr-fracspace nspaces) ncols))))))
1302 curr-fracspace
1303 (+ (% curr-fracspace nspaces) ncols)))))))
1304 (t (error "Unknown justification value")))) 1302 (t (error "Unknown justification value"))))
1305 (goto-char pos) 1303 (goto-char pos)
1306 (move-marker pos nil))) 1304 (move-marker pos nil)))