all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 20663@debbugs.gnu.org, ambrevar@gmail.com
Subject: bug#20663: page.el (forward-page): Avoid skipping pages
Date: Wed, 13 Apr 2016 19:53:31 +0200	[thread overview]
Message-ID: <87a8kxcs4k.fsf@mbork.pl> (raw)
In-Reply-To: <8337qsgnvc.fsf@gnu.org>


On 2016-04-11, at 15:35, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Marcin Borkowski <mbork@mbork.pl>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  20663@debbugs.gnu.org
>> Date: Mon, 11 Apr 2016 12:20:07 +0200
>> 
>> I spent a few minutes on this with Edebug and Git today.
>
> Thanks.
>
>> > - All the patch does it make the code consistent with its comments, that is:
>> >
>> > 	;; In case the page-delimiter matches the null string,
>> > 	;; don't find a match without moving.
>> 
>> Seems ok.
>> 
>> > - If you try the recipe (I just did on Emacs 24.5.1, don't have time to check
>> > now on upstream), you'll see that a page gets skipped, which is not the desired
>> > behaviour.
>> 
>> Condirmed.  And it doesn't happen with the patch installed.
>
> Can one of you please explain why the original code misbehaves?

Quoting from the original report:

--8<---------------cut here---------------start------------->8---
> 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.
--8<---------------cut here---------------end--------------->8---

>> For instance, when the point is -!-, is the point on the first or
>> second page here?  Emacs with and without the patch has different
>> opinions on that.
>
> Good point.

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?

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





  reply	other threads:[~2016-04-13 17:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-26 17:14 bug#20663: page.el (forward-page): Avoid skipping pages Pierre Neidhardt
2016-04-09 10:13 ` Marcin Borkowski
2016-04-09 12:00   ` Eli Zaretskii
2016-04-09 18:16     ` Marcin Borkowski
2016-04-09 19:34       ` Eli Zaretskii
2016-04-10  1:29         ` Pierre Neidhardt
2016-04-11 10:20           ` Marcin Borkowski
2016-04-11 15:35             ` Eli Zaretskii
2016-04-13 17:53               ` Marcin Borkowski [this message]
2016-04-13 20:14                 ` John Mastro
2016-04-13 20:54                   ` Marcin Borkowski
2016-04-16 11:03                 ` Marcin Borkowski
2016-04-16 11:26                 ` Eli Zaretskii
2016-04-20  7:32                   ` Marcin Borkowski
2016-04-27  7:57                     ` Pierre Neidhardt
2016-05-02 20:42                       ` Marcin Borkowski
2016-06-04  9:55                         ` Pierre Neidhardt
2016-06-04 20:36                           ` Marcin Borkowski
2020-09-15 13:53                             ` Lars Ingebrigtsen
2022-04-22 12:05 ` Lars Ingebrigtsen
     [not found]   ` <87pmjje5mt.fsf@kraus.my>
2022-06-09 10:21     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8kxcs4k.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=20663@debbugs.gnu.org \
    --cc=ambrevar@gmail.com \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.