From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 13 12:46:43 2021 Received: (at submit) by debbugs.gnu.org; 13 Nov 2021 17:46:43 +0000 Received: from localhost ([127.0.0.1]:48005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlx6x-0003qj-7T for submit@debbugs.gnu.org; Sat, 13 Nov 2021 12:46:43 -0500 Received: from lists.gnu.org ([209.51.188.17]:36868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlx6s-0003qY-HC for submit@debbugs.gnu.org; Sat, 13 Nov 2021 12:46:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlx6s-0000OD-9D for bug-gnu-emacs@gnu.org; Sat, 13 Nov 2021 12:46:38 -0500 Received: from colin.muc.de ([193.149.48.1]:25292 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1mlx6p-0000o0-Rs for bug-gnu-emacs@gnu.org; Sat, 13 Nov 2021 12:46:38 -0500 Received: (qmail 10966 invoked by uid 3782); 13 Nov 2021 17:46:19 -0000 Received: from acm.muc.de (p4fe15fc7.dip0.t-ipconnect.de [79.225.95.199]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 13 Nov 2021 18:46:19 +0100 Received: (qmail 27491 invoked by uid 1000); 13 Nov 2021 17:46:18 -0000 Date: Sat, 13 Nov 2021 17:46:18 +0000 To: bug-gnu-emacs@gnu.org, Juri Linkov Subject: follow-scroll-down leaves point in wrong place in a corner case. Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit Cc: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Hello, Juri and Emacs. On the emacs-28 branch and master. This bug is a corner case, noted but not fixed in bug #51590. >From a post in that bug thread: [*] There is a situation which is not new, where if the buffer is too short to fill all the windows, and it is already scrolled up far, follow-scroll-down will scroll a correct amount, but leave point in a random position. I believe the following patch fixes this. Juri, could you try it out, please. As a test buffer, (i) open elisp.info in a default GUI window (34 lines); (ii) C-x 3 ; split it with a vertical divider. (iii) ] ; Move to next page in manual, "Introduction". (iv) M-x follow-mode. (v) C-u 20 C-v ; scroll-up a significant amount. (vi) Move point to the line beginning "* Caveats". (vii) M-x follow-scroll-down. Note that point is in a random place. This is a bug. The cause of the bug is that the current code is "optimised" for the case where there are enough buffer lines above point to scroll a full follow-page, yet neglects the case where this doesn't hold. The patch does away with this optimisation. diff --git a/lisp/follow.el b/lisp/follow.el index 2ca2c1f17b..3761275bbf 100644 --- a/lisp/follow.el +++ b/lisp/follow.el @@ -669,24 +669,30 @@ follow-scroll-down (t (let* ((orig-point (point)) (windows (follow-all-followers)) - (win (car (reverse windows))) - (start (window-start (car windows)))) + (start (window-start (car windows))) + (lines 0)) (if (eq start (point-min)) (if (or (null scroll-error-top-bottom) (bobp)) (signal 'beginning-of-buffer nil) (goto-char (point-min))) - (select-window win) - (goto-char start) - (vertical-motion (- (- (window-height win) - (if header-line-format 2 1) ; always mode-line - (if tab-line-format 1 0) - next-screen-context-lines))) - (set-window-start win (point)) - (if (< orig-point (window-end win t)) - (goto-char orig-point) - (goto-char start) - (vertical-motion (- next-screen-context-lines 1))) + (select-window (car windows)) + (dolist (win windows) + (setq lines + (+ lines + (- (window-height win) + (if header-line-format 2 1) ; Count mode-line, too. + (if tab-line-format 1 0))))) + (setq lines (- lines next-screen-context-lines)) + (goto-char start) + (let ((at-top (> (vertical-motion (- lines)) (- lines)))) + (set-window-start (car windows) (point)) + (if at-top + (goto-char orig-point) + (goto-char start) + (vertical-motion (- next-screen-context-lines 1)) + (if (< orig-point (point)) + (goto-char orig-point)))) (setq follow-internal-force-redisplay t)))))) (put 'follow-scroll-down 'scroll-command t) -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 13 13:00:40 2021 Received: (at 51814) by debbugs.gnu.org; 13 Nov 2021 18:00:40 +0000 Received: from localhost ([127.0.0.1]:48023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlxKS-0004Fz-4q for submit@debbugs.gnu.org; Sat, 13 Nov 2021 13:00:40 -0500 Received: from relay12.mail.gandi.net ([217.70.178.232]:35083) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlxKO-0004Fk-RG for 51814@debbugs.gnu.org; Sat, 13 Nov 2021 13:00:37 -0500 Received: (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 80F19200006; Sat, 13 Nov 2021 18:00:29 +0000 (UTC) From: Juri Linkov To: Alan Mackenzie Subject: Re: bug#51814: follow-scroll-down leaves point in wrong place in a corner case. Organization: LINKOV.NET References: Date: Sat, 13 Nov 2021 19:58:12 +0200 In-Reply-To: (Alan Mackenzie's message of "Sat, 13 Nov 2021 17:46:18 +0000") Message-ID: <864k8gdjkb.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 51814 Cc: 51814@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > I believe the following patch fixes this. Juri, could you try it out, > please. > > As a test buffer, > (i) open elisp.info in a default GUI window (34 lines); > (ii) C-x 3 ; split it with a vertical divider. > (iii) ] ; Move to next page in manual, "Introduction". > (iv) M-x follow-mode. > (v) C-u 20 C-v ; scroll-up a significant amount. > > (vi) Move point to the line beginning "* Caveats". > (vii) M-x follow-scroll-down. > > Note that point is in a random place. This is a bug. Thanks, I confirm this bug is fixed with your patch. I've tested it with and without tab-line-mode in Info with the header line. From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 13 13:42:38 2021 Received: (at 51814-done) by debbugs.gnu.org; 13 Nov 2021 18:42:38 +0000 Received: from localhost ([127.0.0.1]:48063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlxz4-0005N4-NZ for submit@debbugs.gnu.org; Sat, 13 Nov 2021 13:42:38 -0500 Received: from colin.muc.de ([193.149.48.1]:26728 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mlxz3-0005Mn-BG for 51814-done@debbugs.gnu.org; Sat, 13 Nov 2021 13:42:38 -0500 Received: (qmail 47196 invoked by uid 3782); 13 Nov 2021 18:42:30 -0000 Received: from acm.muc.de (p4fe15fc7.dip0.t-ipconnect.de [79.225.95.199]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 13 Nov 2021 19:42:30 +0100 Received: (qmail 17048 invoked by uid 1000); 13 Nov 2021 18:42:29 -0000 Date: Sat, 13 Nov 2021 18:42:29 +0000 To: Juri Linkov Subject: Re: bug#51814: follow-scroll-down leaves point in wrong place in a corner case. Message-ID: References: <864k8gdjkb.fsf@mail.linkov.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <864k8gdjkb.fsf@mail.linkov.net> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 51814-done Cc: 51814-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Juri On Sat, Nov 13, 2021 at 19:58:12 +0200, Juri Linkov wrote: > > I believe the following patch fixes this. Juri, could you try it out, > > please. > > As a test buffer, > > (i) open elisp.info in a default GUI window (34 lines); > > (ii) C-x 3 ; split it with a vertical divider. > > (iii) ] ; Move to next page in manual, "Introduction". > > (iv) M-x follow-mode. > > (v) C-u 20 C-v ; scroll-up a significant amount. > > (vi) Move point to the line beginning "* Caveats". > > (vii) M-x follow-scroll-down. > > Note that point is in a random place. This is a bug. > Thanks, I confirm this bug is fixed with your patch. > I've tested it with and without tab-line-mode in Info > with the header line. Thanks for the testing! I've committed the patch to the emacs-28 branch, and I'm closing the bug with this post. -- Alan Mackenzie (Nuremberg, Germany). From unknown Fri Aug 15 17:22:32 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 12 Dec 2021 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator