]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/textmodes/fill.el (justify-current-line): Don't add 1 to nspaces
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 2 Aug 2010 10:25:27 +0000 (12:25 +0200)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 2 Aug 2010 10:25:27 +0000 (12:25 +0200)
when justifying.  It seems useless and harmful for ncols=1.

Fixes: debbugs:6738
lisp/ChangeLog
lisp/textmodes/fill.el

index 4837023ba3b948e21be63cb8dc221fc435494589..e475a152e385df0057f9ffd26ae794906853a8bc 100644 (file)
@@ -1,5 +1,8 @@
 2010-08-02  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * textmodes/fill.el (justify-current-line): Don't add 1 to nspaces
+       when justifying.  It seems useless and harmful for ncols=1 (bug#6738).
+
        * emacs-lisp/timer.el (timer-event-handler): Protect against timers
        that change current buffer.
 
index 605f3f8c1018c370ca459d2c4566e96f50ea1d7f..a9eb45939b27460b5cae39a42d1d0670a2bce723 100644 (file)
@@ -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)))