[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Clean-up of forward-paragraph [Re: Beginingless paragraphs: second s
From: |
Alan Mackenzie |
Subject: |
Re: Clean-up of forward-paragraph [Re: Beginingless paragraphs: second stab at a patch.] |
Date: |
Thu, 20 Oct 2005 13:53:18 +0000 (GMT) |
On Thu, 20 Oct 2005, Richard M. Stallman wrote:
[ .... ]
> (ii) When `use-hard-newlines' is non-nil (i.e. Longlines Mode is
> enabled), forward-paragraph can spuriously recognise a line "in the
> middle of a paragraph" as a separator line when it "looks like" one.
> (This only shows itself with a non-blank separator line.)
>Sorry, I do not understand.
With the following text line:
First line of paragraph ;sep; second line of par third line
, turn on Longlines Mode. The line acquires two "soft" newlines, and
now looks like this:
First line of paragraph
;sep; second line of par
third line.
The middle line, beginning with ";sep;", is spuriously recognised as a
separator line by paragraph-separate. There is buggy code in
forward-paragraph which tries to detect this situation. I will fix it.
[ .... ]
> (iii) When there is a non-nil fill-prefix, f-p uses it in place of
> paragraph-start when searching backwards, but not when searching
> forwards. Half of these cases is a bug.
>I am not sure either one of them is right. What is right is to
>implement the proper criterion--see the next issue.
> Incidentally: The Elisp manual is a bit unclear on the page
> "Paragraphs", where it says:
> When there is a fill prefix, then paragraphs are delimited by all
> lines which don't start with the fill prefix.
> This doesn't make clear (? clear enough) whether this scheme of
> terminating paragraphs is in addition to or in place of
> paragraph-s\(tart\|eparate\). I think one of the words "also" and
> "instead" should be inserted before "delimited". Which one?
>It should be "in addition".
OK.
>If the fill-prefix is followed by text that would normally separate or start
>paragraphs, that does separate or start paragraphs.
Not quite: in the current implementation, paragraph-start is ignored when
there's a fill-prefix. Non-separator lines without the fill-prefix
always start paragraphs. What I've called "divider" lines below, are
normal separator lines or lines with the prefix which are otherwise
whitespace.
The current implementation doesn't test for paragraph-s\(tart\|eparate\)
on the same line as the fill-prefix. Should it? I'm trying to think of
situations where somebody might want this. Perhaps they'd want an
indentation to start a paragraph. Something like this:
**********last line of paragraph.
********** First line of new paragraph.
I've put together a tentative formulation of paragraph boundaries, (which
doesn't as yet deal with this last situation). Please give me some feedback
on it.
#########################################################################
Definitions:
(i) A @dfn{hard BOL} is the beginning of a line following a hard newline.
(ii) A @dfn{separator (line)} is a line which paragraph-separate matches after
any margin.
(iii) A @dfn{starter (line)} is a line which paragraph-start matches after any
margin, but which isn't a separator;
(iv) A @dfn{divider (line)} is a line which is either a separator or has the
fill-prefix (after any left margin) and is otherwise only whitespace. [This
definition only applies when the fill-prefix is non-null.]
(iv) The beginning and end of (the accessible portion of) the buffer always
count as paragraph boundaries. [From this point on, "ALL paragraph
boundaries" disregards BOB and EOB.]
(v) All other paragraph boundaries are always at BOL, even when there is a
left margin. (This is so that M-h C-w will always grab complete
paragraphs.)
(vi) When `use-hard-newlines' is non-nil, all paragraph boundaries are at hard
BOLs. A paragraph starts at a non-separator line, and ends at the next hard
BOL. Here, fill-prefix and paragraph-start are ignored.
(vii) Otherwise, if fill-prefix is non-null: A paragraph starts at any
non-divider line which either lacks the fill-prefix or follows a divider
line. A paragraph ends at the start of the next paragraph or a divider
line. Here, paragraph-start is ignored.
(viii) Otherwise (fill-prefix is null), a paragraph starts at a non-separator
line which is either a starter line or follows a separator line. It ends
just before the next separator or starter line.
(ix) If there happens to be a blank line before a paragraph start, this line
is NOT regarded as being part of the paragraph. [This is the problem which
was at the heart of this thread.]
#########################################################################
--
Alan Mackenzie (Munich, Germany)