unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20663: page.el (forward-page): Avoid skipping pages
@ 2015-05-26 17:14 Pierre Neidhardt
  2016-04-09 10:13 ` Marcin Borkowski
  2022-04-22 12:05 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 21+ messages in thread
From: Pierre Neidhardt @ 2015-05-26 17:14 UTC (permalink / raw)
  To: 20663

[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]

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.

The attached patch fixes it by changing the code to actually match its
surrounding comments.


In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.2)
 of 2015-04-20 on bitzer.hoetzel.info
Windowing system distributor `The X.Org Foundation', version 11.0.11701000
System Description:	Arch Linux

Configured using:
 `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Important settings:
  value of $LC_MESSAGES: sv_SE.UTF-8
  value of $LANG: sv_SE.UTF-8
  locale-coding-system: utf-8-unix

-- 
Pierre Neidhardt

Virginia law forbids bathtubs in the house; tubs must be kept in the yard.

[-- Attachment #2: ChangeLog --]
[-- Type: text/plain, Size: 48 bytes --]

	* page.el (forward-page): Avoid skipping pages

[-- Attachment #3: example.txt --]
[-- Type: text/plain, Size: 25 bytes --]

Page 1
\f
Page 2
\f
Page 3

[-- Attachment #4: page.patch --]
[-- Type: text/x-diff, Size: 551 bytes --]

diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index 39db5bb..c875a49 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -37,7 +37,7 @@ A page boundary is any line whose beginning matches the regexp
   (while (and (> count 0) (not (eobp)))
     ;; In case the page-delimiter matches the null string,
     ;; don't find a match without moving.
-    (if (bolp) (forward-char 1))
+    (if (string= page-delimiter "") (forward-char 1))
     (if (re-search-forward page-delimiter nil t)
 	nil
       (goto-char (point-max)))

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-06-09 10:21 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).