From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pierre Neidhardt Newsgroups: gmane.emacs.bugs Subject: bug#20663: page.el (forward-page): Avoid skipping pages Date: Tue, 26 May 2015 19:14:40 +0200 Message-ID: <20150526171440.GG647@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="xHFwDpU9dbj6ez1V" X-Trace: ger.gmane.org 1432661004 505 80.91.229.3 (26 May 2015 17:23:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 May 2015 17:23:24 +0000 (UTC) To: 20663@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 26 19:23:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YxIZM-0007I8-Rm for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 May 2015 19:23:13 +0200 Original-Received: from localhost ([::1]:49521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxIZM-0000F7-9M for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 May 2015 13:23:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxIZI-0000Ew-9F for bug-gnu-emacs@gnu.org; Tue, 26 May 2015 13:23:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxIZD-00080N-8J for bug-gnu-emacs@gnu.org; Tue, 26 May 2015 13:23:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxIZD-00080G-4t for bug-gnu-emacs@gnu.org; Tue, 26 May 2015 13:23:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YxIZC-00064z-VF for bug-gnu-emacs@gnu.org; Tue, 26 May 2015 13:23:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pierre Neidhardt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 May 2015 17:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20663 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.143266095623325 (code B ref -1); Tue, 26 May 2015 17:23:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 May 2015 17:22:36 +0000 Original-Received: from localhost ([127.0.0.1]:57328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YxIYl-000646-2e for submit@debbugs.gnu.org; Tue, 26 May 2015 13:22:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39237) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YxIPm-0005oy-HE for submit@debbugs.gnu.org; Tue, 26 May 2015 13:13:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxIPg-0003yv-E9 for submit@debbugs.gnu.org; Tue, 26 May 2015 13:13:13 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:56969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxIPg-0003yk-Bu for submit@debbugs.gnu.org; Tue, 26 May 2015 13:13:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxIPf-0002VU-FW for bug-gnu-emacs@gnu.org; Tue, 26 May 2015 13:13:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxIPa-0003wC-Ao for bug-gnu-emacs@gnu.org; Tue, 26 May 2015 13:13:11 -0400 Original-Received: from mail-la0-x234.google.com ([2a00:1450:4010:c03::234]:32951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxIPa-0003vZ-3Z for bug-gnu-emacs@gnu.org; Tue, 26 May 2015 13:13:06 -0400 Original-Received: by lalw1 with SMTP id w1so4855463lal.0 for ; Tue, 26 May 2015 10:13:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=/VjLUp/QmN8FM16kiVUlwBdYb7Mu8l8t7LWDHCNLM9w=; b=WLgT/p5mNJVseSm/zXT1G42e90JRBlhy4acoZ4ZLdaJLJ6KA9X6UQZcHazfBkQrhJE E9O/HFHR14wCsJfyihDB4UcQttIkdSKc5hTwO0e7soI9vTsX5nPIkyhCNstJ0Yu3PMuu RPv97YdOjxEErQk720IjGd8u5wcA/YJW/ooy1GT0ZzrN41zzoMXI5ZKHhheVkyigWa7o LyzCUDa5Eb6WP2U9uSKvbR1AX55SD63NDmQQw+/dkWc4Rf26ICklPFDGuY+OvrncAtIO kqjGE4uqd0o9F4gI9Hc75jpcKeAEkgocayVwvrz1EnXZTgehInBT0uDiTD1+eq57EdsZ FCzw== X-Received: by 10.112.51.146 with SMTP id k18mr23388590lbo.91.1432660384810; Tue, 26 May 2015 10:13:04 -0700 (PDT) Original-Received: from gmail.com (c80-217-163-156.bredband.comhem.se. [80.217.163.156]) by mx.google.com with ESMTPSA id jl4sm3168349lbc.14.2015.05.26.10.13.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 May 2015 10:13:04 -0700 (PDT) Content-Disposition: inline X-Info: Simplicity is the ultimate sophistication. User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Tue, 26 May 2015 13:22:32 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103191 Archived-At: --xHFwDpU9dbj6ez1V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --xHFwDpU9dbj6ez1V Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=ChangeLog * page.el (forward-page): Avoid skipping pages --xHFwDpU9dbj6ez1V Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="example.txt" Page 1 Page 2 Page 3 --xHFwDpU9dbj6ez1V Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="page.patch" 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))) --xHFwDpU9dbj6ez1V--