From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.bugs Subject: bug#20663: page.el (forward-page): Avoid skipping pages Date: Wed, 13 Apr 2016 19:53:31 +0200 Message-ID: <87a8kxcs4k.fsf@mbork.pl> References: <20150526171440.GG647@gmail.com> <87h9fbum2w.fsf@mbork.pl> <83h9fbhu0p.fsf@gnu.org> <871t6eve9c.fsf@mbork.pl> <837fg6injl.fsf@gnu.org> <20160410012924.GA23097@gmail.com> <87fuus30rs.fsf@mbork.pl> <8337qsgnvc.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1460570077 6611 80.91.229.3 (13 Apr 2016 17:54:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Apr 2016 17:54:37 +0000 (UTC) Cc: 20663@debbugs.gnu.org, ambrevar@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 13 19:54:21 2016 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 1aqOzX-0003de-OF for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Apr 2016 19:54:15 +0200 Original-Received: from localhost ([::1]:49031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqOzT-0005zb-Rt for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Apr 2016 13:54:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqOzO-0005uy-G4 for bug-gnu-emacs@gnu.org; Wed, 13 Apr 2016 13:54:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqOzK-00068B-CH for bug-gnu-emacs@gnu.org; Wed, 13 Apr 2016 13:54:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49871) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqOzK-000686-96 for bug-gnu-emacs@gnu.org; Wed, 13 Apr 2016 13:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1aqOzK-00016o-3z for bug-gnu-emacs@gnu.org; Wed, 13 Apr 2016 13:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Marcin Borkowski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Apr 2016 17:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20663 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20663-submit@debbugs.gnu.org id=B20663.14605700214233 (code B ref 20663); Wed, 13 Apr 2016 17:54:02 +0000 Original-Received: (at 20663) by debbugs.gnu.org; 13 Apr 2016 17:53:41 +0000 Original-Received: from localhost ([127.0.0.1]:33975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqOyz-00016D-0l for submit@debbugs.gnu.org; Wed, 13 Apr 2016 13:53:41 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:34714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqOyx-000165-EP for 20663@debbugs.gnu.org; Wed, 13 Apr 2016 13:53:40 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id F1EE6ABF294; Wed, 13 Apr 2016 19:53:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zHPs4SUYW5Qu; Wed, 13 Apr 2016 19:53:35 +0200 (CEST) Original-Received: from localhost (98-171.echostar.pl [213.156.98.171]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 48A85ABF293; Wed, 13 Apr 2016 19:53:35 +0200 (CEST) User-agent: mu4e 0.9.13; emacs 25.1.50.8 In-reply-to: <8337qsgnvc.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:116440 Archived-At: On 2016-04-11, at 15:35, Eli Zaretskii wrote: >> From: Marcin Borkowski >> Cc: Eli Zaretskii , 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