Subject: Re: bug#20663: page.el (forward-page): Avoid skipping pages

From: Marcin Borkowski <[email-masked]>
Date: Sat, 16 Apr 2016 13:03:41 +0200

On 2016-04-13, at 17:53, Marcin Borkowski <[email-masked]> wrote:

> Here's the relevant excerpt from the manual:
>
> --8<---------------cut here---------------start------------->8---
>    The variable ‘page-delimiter’ controls where pages begin.  Its value
> is a regular expression that matches the beginning of a line that
> separates pages (*note Regexps::).  The normal value of this variable is
> ‘"^\f"’, which matches a formfeed character at the beginning of a line.
> --8<---------------cut here---------------end--------------->8---
>
> Is it me or is the above ambiguous?
>
>
> I'm a bit busy now, but I'll make a second attempt at this issue within
> a few days.  One of the problems is that (as the above paragraph seems
> to confirm) the very notion of a "page" in Emacs is vague.  IMHO we
> should start with a clear definition of a "page".  It is well possible
> that different functions in page.el use different interpretations of
> this notion, and the bug is just a symptom if such a mess.
>
> My proposal is that a "page separator" would be a position in the buffer
> where (looking-at-p page-delimiter) is true, and if point is at such
> a place, then we consider it on the next page.  I.e., in this situation
>
> abcabcabc
> -!-^L
> cbacbacba
>
> the point is already on the second page (unlike the default Emacs
> behavior).
>
> Then, someone should study page.el and where necessary, update it to the
> precisely defined notion of a "page".  (The mythical "someone" might be
> me.)
>
> WDYT?

OK, I got almost no responses so far:-(.  In the meantime, I started to
study this issue.  It seems that `forward-page' indeed has a bug.
Here's the recipe (slightly modified from the OP's one).  With this
buffer state:

--8<---------------cut here---------------start------------->8---
Page 1
-!-^L
Page 2
^L
Page 3
--8<---------------cut here---------------end--------------->8---

press `C-x ]' (`forward-page').  Now the point moves across /two/
form-feed characters.  Is that intentional?  Seems broken for me.

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University