GNU bug report logs - #20663
page.el (forward-page): Avoid skipping pages

Previous Next

Package: emacs;

Reported by: Pierre Neidhardt <ambrevar <at> gmail.com>

Date: Tue, 26 May 2015 17:23:02 UTC

Severity: minor

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #47 received at 20663 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <ambrevar <at> gmail.com>
To: Marcin Borkowski <mbork <at> mbork.pl>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 20663 <at> debbugs.gnu.org
Subject: Re: bug#20663: page.el (forward-page): Avoid skipping pages
Date: Wed, 27 Apr 2016 14:57:38 +0700
On 16-04-20 09:32:37, Marcin Borkowski wrote:
> And by the way, the patch the OP gave is also wrong, though in
> a different way.  (I should have noticed that earlier.)  The OP proposed
> this instead of (if (bolp) (forward-char 1)):
> 
> (if (string= page-delimiter "") (forward-char 1))
> 
> Of course, this condition should never be true: if `page-delimiter' is
> "", functions from page.el will most probably never work correctly
> anyway.  What (maybe) should have been tested would be
> 
> (eq (match-beginning 0) (match-end 0))
> 
> but anyway, since Emacs regex engine does not have a lot of zero-width
> assertions, this is not going to happen very often anyway (certainly
> never with the default value of `page-delimiter', which explains why the
> OP hasn't noticed any problems with his patch).  One possible value of
> `page-delimiter' that comes to my mind which could lead to the above
> condition holding would be "^$" -- though I can hardly see any practical
> use for it.
> 
> So my proposal would be to just delete the offending line altogether.
> I'd be very surprised if we heard any complaints afterwards.

Why disallowing "^$" as a page delimiter? I would not use it either, but I can
fathom that somebody else would. At the end of the day, the page display is like
colors: a matter of taste. So instead of removing the line, I'd use the
replacement you suggested.

> BTW, the analogous code for moving back one page seems also suspicious
> to me.  I'll look into it tomorrow.

The code for moving back first skips the page delimiter we are currently on, if
any. This is not problematic if the page was narrowed down since it is not
possible to be on the page delimiter at (point-min).

The code looks good to me if we consider that the delimiters belong to the end
of a page.

-- 
Pierre Neidhardt




This bug report was last modified 3 years and 42 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.