GNU bug report logs -
#6738
possible bug in fill-paragraph
Previous Next
Full log
View this message in rfc822 format
On Tue, 27 Jul 2010 01:10:37 -0700 Eric De Mund <ead-gnu-emacs <at> ixian.com> wrote:
> 0. Invoke Emacs with "emacs -nw -q"
>
> 1. Start with this 3-line paragraph:
>
> A former executive testified that David H. Brooks misused company
> funds to buy a belt buckle encrusted with rubies, pornographic videos
> for his son and prostitutes for his workers.
>
> 2. Invoke << C-u 20 C-x f >> with cursor positioned on first word "A".
>
> 3. Invoke << M-1 M-q >>.
>
> 4. Observe paragraph reformatted to this, incorrectly:
>
> A former executive
> testified that David
> H. Brooks misused
> company funds to buy
> a belt buckle
> encrusted with
> rubies, pornographic
> videos for his son
> and prostitutes for
> his workers.
>
> i.e. with the 6th line ("encrusted with") taking up 21 columns
> rather than 20 columns.
It seems that the algorithm in justify-current-line doesn't work so well
for a two-word line: it correctly calculates the number of additional
space characters needed (ncols) but expects to fractionally distribute
them, as it does in the other lines, so it adds more space, in this case
wrongly. In such a situation, it suffices to just stick with ncols, as
in the following patch (but I haven't tested this in other cases, so
maybe it isn't the best fix).
Steve Berman
***/bzr/emacs/trunk/lisp/textmodes/fill.el 2010-05-29 13:10:05.000000000 +0200
---/bzr/emacs/quickfixes/lisp/textmodes/fill.el 2010-07-29 22:48:58.000000000 +0200
***************
*** 1296,1302 ****
(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
--- 1296,1303 ----
(while (> count 0)
(skip-chars-forward " ")
(insert-and-inherit
! (make-string
! (min ncols (/ curr-fracspace nspaces)) ?\s))
(search-forward " " nil t)
(setq count (1- count)
curr-fracspace
This bug report was last modified 14 years and 291 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.