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

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 09 Jun 2022 12:21:55 +0200

Daniel Kraus <[email-masked]> writes:

>>> When `page-delimiter` starts at the beginning of the line and the position is
>>> also at the beginning of the line, calling `forward-page` will skip one page.
>>>
>>> Running `emacs -Q example.txt`:
>>>
>>> 	M-<
>>> 	C-x n p
>>> 	M->
>>> 	M-1 C-x n p
>>>
>>> This should bring us from page 1 to page 2, but page 3 gets
>>> displayed instead.

[...]

> This patch seems to change the behavior of `forward-page` compared to before.
> Before when the point was inside (/beginning) of the page-delimiter regex
> it would jump imho correctly to the next page.
>
> Now it just skips the page delimiter and goes to the end.

Well, that was the point of the change, really

The problem with the old behaviour was most obvious when narrowing to a
page.  If you're narrowed to page 1 (with point at the end of the
buffer), issuing a "go to the next page" would take you to page 3.

I.e., there was a disconnect between what it was considering the
"current page" and how narrowing to a page would display that, and the
change made these things match up -- now (with point just before the
page delimiter) it says that it's on the previous page, not the next
page.

Perhaps this should be tweaked for longer page delimiters, so that we're
on the next page when point is inside the delimiter?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no