Mercurial > emacs
comparison lisp/textmodes/fill.el @ 109614:e20f769083f9
* lisp/textmodes/fill.el (justify-current-line): Don't add 1 to nspaces
when justifying. It seems useless and harmful for ncols=1.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 02 Aug 2010 12:25:27 +0200 |
parents | d835100c3e8b |
children | 280c8ae2476d |
comparison
equal
deleted
inserted
replaced
109613:faf7d069c517 | 109614:e20f769083f9 |
---|---|
1287 (while (search-backward " " nil t) | 1287 (while (search-backward " " nil t) |
1288 (setq nspaces (1+ nspaces)) | 1288 (setq nspaces (1+ nspaces)) |
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))) |
1307 nil) | 1305 nil) |
1308 | 1306 |