[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Alinea filling (hanlding of explicit line-breaks)
From: |
Stefan Monnier |
Subject: |
Re: Alinea filling (hanlding of explicit line-breaks) |
Date: |
Sat, 12 Mar 2011 22:59:00 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>> Actually, no, because paragraph-separate would cause the whole line
>> that ends with \\ to be treated as not being part of a paragraph, and
>> paragraph-start wouldn't be appropriate either. Hence the "good"
>> above :-(
[...]
> I have implemented the thing locally on my machine. It works well but
> there is still something missing: the line containing the `\\' alinea
> separtor is not filled.
As you can see above, I'm not surprised.
Just don't use paragraph-separate. What I'd do is to use
a fill-forward-paragraph-function which calls forward-paragraph, then
searches for a "\\\\\\\\$" between the start and end point, and if found
adjust the end result accordingly.
If/when you come up with this function, please submit for inclusion in
tex-mode.el where it will come in handy as well.
> So, after more thinking about it the problem is the following: the
> fill-forward-paragraph has only one parameter which is the paragraph
> number --- with n = 0 => current --- but for finding the paragraph
> boundary we need *two* parameter
> => 1st argument: paragraph number
> => 2nd argument: whether we want to point at the beginning the
> paragraph or to the end of the paragraph.
AFAIK the sign of the argument gives you this information.
> => maybe paragraph-separate could be a list of 3 items (REGEXP BEG END)
> where REGEXP is the usual regexp matching the separator, and BEG and
> END when non nil are function to go the the beginning of next or to
> the end of previous assuming that the match data corresponds to a
> match of REGEXP. This way would be really the most flexible.
Could be, but once you're in fill-forward-paragraph-function, you can do
it by hand with Elisp code, so it's not that important. If/when we have
enough fill-forward-paragraph-functions we may revisit this opinion, but
I don't think we have enough experience yet to make a good design.
Stefan