[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fill-paragraph bug
From: |
Chong Yidong |
Subject: |
Re: fill-paragraph bug |
Date: |
Wed, 28 Jun 2006 15:59:27 -0400 |
The problem is in fill-region-as-paragraph, and stems from the
following behavior of `let':
M-: (setq foo 1) RET
M-: (let ((foo 2)) (error "foo")) RET
M-: foo ---> 2
After an error, the `let' form gets exited too, so the global variable
isn't rebound to its original value.
In this case, fill.el is full of
(let ((fill-prefix fill-prefix))
BODY)
If this ends up callin fill-delete-prefix, which signals an error,
then fill-prefix can get screwed up.
One way to fix this is to replace every such construct with
(let ((old-fill-prefix fill-prefix))
(unwind-protect
BODY
(setq fill-prefix old-fill-prefix)))
OK?
> There is an error condition somewhere in fill-paragraph that makes
> subsequent calls to that command unusable.
>
> Insert the following text in a LaTeX buffer, and call M-q:
>
> AAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAA%AAAAAAAAAAAAAA
> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
> AAAAAAAAAAAAAAAAA
>
> the result:
>
> Debugger entered--Lisp error: (error "fill-prefix too long for specified
> width")
> signal(error ("fill-prefix too long for specified width"))
> error("fill-prefix too long for specified width")
> fill-delete-prefix(...)
> fill-region-as-paragraph(1 323 nil nil 227)
> fill-comment-paragraph(nil)
> fill-paragraph(nil)
> call-interactively(fill-paragraph)
>
> Now try to fill any other paragraph anywhere else in Emacs. This
> triggers an error:
>
> "fill-prefix too long for specified width"
>
> Probably some variable somewhere needs to be put in a condition-case.