Article View: gnu.emacs.bug
Article #796Justification of paragraphs with a fill-prefix is wrong
From: Kevin Broadey
Date: Thu, 01 Oct 1992 14:18
Date: Thu, 01 Oct 1992 14:18
51 lines
2386 bytes
2386 bytes
Emacs version is 18.57.
I came across this problem while using Barry Warsaw's Supercite 2.2. I
filled a cited paragraph with justification turned on and it was
justified to the wrong column. After a bit of digging around I found
the fault was in Emacs' fill.el package.
Reproduce as follows:-
Switch to a buffer in fundamental mode, set a fill column, turn on
auto-fill (for convenience), type in a few letters (eg "xxx> ") and make
this the fill prefix with C-x .
Now type in a few lines of gibberish...
xxx> gibberish gibberish gibberish gibberish gibberish gibberish
xxx> gibberish gibberish gibberish gibberish gibberish gibberish
xxx> gibberish gibberish gibberish gibberish gibberish gibberish
xxx> gibberish gibberish gibberish gibberish gibberish gibberish
Now position point within the paragraph and do M-1 M-q to fill and
justify...
xxx> gibberish gibberish gibberish gibberish gibberish gibberish
xxx> gibberish gibberish gibberish gibberish gibberish gibberish
xxx> gibberish gibberish gibberish gibberish gibberish gibberish
xxx> gibberish gibberish gibberish gibberish gibberish gibberish
I did the above with fill-column set to 72. It's been justified to
xxx> column 77, which is (+ fill-column (length fill-prefix)).
The fault is in `justify-current-line' in fill.el. This does a
`narrow-to-region' on the text from the end of the fill prefix to the
end of the line, then pads that out to fill-column. Hence the extra
characters.
The fix is to change the LET line from:-
(let (ncols beg)
to:-
(let ((fill-column (- fill-column (length fill-prefix)))
ncols beg)
(if (< fill-column 1)
(error "Fill prefix is too long for fill column."))
This compensates for the extra characters on the line.
Kevin
Technical Details
Message-ID:
<9210011418.AA11313@edscom.demon.co.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!edscom.demon.co.uk!kevinShow Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug Path: arc1-ca.pugleaf.net!sparky!uunet!convex!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!edscom.demon.co.uk!kevin From: kevin@edscom.demon.co.uk (Kevin Broadey) Subject: Justification of paragraphs with a fill-prefix is wrong Message-ID: <9210011418.AA11313@edscom.demon.co.uk> Sender: gnulists@ai.mit.edu Reply-To: Kevin Broadey <kbroadey@edscom.demon.co.uk> Organization: EDS-Scicon, Milton Keynes, UK Distribution: gnu Date: Thu, 1 Oct 1992 14:18:10 GMT Approved: bug-gnu-emacs@prep.ai.mit.edu Lines: 52