GNU bug report logs - #35613
Cursor returns to wrong article!

Previous Next

Packages: gnus, emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Tue, 7 May 2019 01:42:01 UTC

Severity: minor

Tags: fixed, patch

Found in version 5.13

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35613 in the body.
You can then email your comments to 35613 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#35613; Package emacs,gnus. (Tue, 07 May 2019 01:42:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org. (Tue, 07 May 2019 01:42:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: submit <at> debbugs.gnu.org (The Gnus Bugfixing Girls + Boys)
Subject: Cursor returns to wrong article!
Date: Tue, 07 May 2019 09:41:18 +0800
I discovered a massive bug. A bug that could cause the user to lose mail.

In the *Summary* buffer use a few
 <down> [next-line]
until the cursor is upon call it, article A.
 <return> [gnus-summary-scroll-up]
 <down> [next-line] (once or more)
 <return> [gnus-summary-scroll-up]
 <tab> [gnus-summary-widget-forward]
 = [gnus-article-read-summary-keys]
Even though the ">" arrow at left and the underline are on a different article,
but the cursor now returns to Article A!!

Now if he hits e.g., the E key, he will mark the wrong article!
Or if he forwards it to his grandmother, she will die because he
forwarded the wrong article and she had a heart attack. See, gnus kills people!

Sure you will argue that that is a feature, however I used the same
 <return> [gnus-summary-scroll-up]
twice and for no good reason you remember the first one.

Gnus v5.13
GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.4)
 of 2019-02-03, modified by Debian




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#35613; Package emacs,gnus. (Tue, 07 May 2019 13:11:01 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 35613 <at> debbugs.gnu.org
Subject: Re: bug#35613: Cursor returns to wrong article!
Date: Tue, 07 May 2019 14:10:47 +0100
[Message part 1 (text/plain, inline)]
tags 35613 + patch
quit

積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:

> I discovered a massive bug. A bug that could cause the user to lose mail.
>
> In the *Summary* buffer use a few
>  <down> [next-line]
> until the cursor is upon call it, article A.
>  <return> [gnus-summary-scroll-up]
>  <down> [next-line] (once or more)
>  <return> [gnus-summary-scroll-up]
>  <tab> [gnus-summary-widget-forward]
>  = [gnus-article-read-summary-keys]
> Even though the ">" arrow at left and the underline are on a different article,
> but the cursor now returns to Article A!!
>
> Now if he hits e.g., the E key, he will mark the wrong article!
> Or if he forwards it to his grandmother, she will die because he
> forwarded the wrong article and she had a heart attack. See, gnus kills people!
>
> Sure you will argue that that is a feature, however I used the same
>  <return> [gnus-summary-scroll-up]
> twice and for no good reason you remember the first one.
>
> Gnus v5.13
> GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.4)
>  of 2019-02-03, modified by Debian

This is the user option switch-to-buffer-preserve-window-point in
action.  If you customise it to nil, the behaviour you describe should
go away.

This is why Elisp programs should usually use pop-to-buffer et
al. instead of switch-to-buffer et al.  The following patch should fix
that for this case:

[0001-Fix-gnus-summary-expand-window-placement-of-point.patch (text/x-diff, inline)]
From 1d7a51d2e3a1c3d5caa77587b3e612feda8bdd59 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Date: Tue, 7 May 2019 13:46:22 +0100
Subject: [PATCH] Fix gnus-summary-expand-window placement of point

* lisp/gnus/gnus-win.el (gnus-configure-frame): Replace
switch-to-buffer with pop-to-buffer-same-window to avoid messing
with point. (bug#35613)
---
 lisp/gnus/gnus-win.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el
index 5f7154c545..c6469f4937 100644
--- a/lisp/gnus/gnus-win.el
+++ b/lisp/gnus/gnus-win.el
@@ -284,7 +284,7 @@ gnus-configure-frame
                 ;; from a hard-dedicated frame, it creates (and
                 ;; configures) a new frame, leaving the dedicated frame alone.
                 (pop-to-buffer buf))
-               (t (switch-to-buffer buf)))))
+               (t (pop-to-buffer-same-window buf)))))
 	  (when (memq 'frame-focus split)
 	    (setq gnus-window-frame-focus window))
 	  ;; We return the window if it has the `point' spec.
-- 
2.20.1

[Message part 3 (text/plain, inline)]
I'll push it to master in a week or so if there are no objections before
then.

Thanks,

-- 
Basil

Added tag(s) patch. Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Tue, 07 May 2019 13:11:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#35613; Package emacs,gnus. (Wed, 08 May 2019 06:23:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35613 <at> debbugs.gnu.org
Subject: Re: bug#35613: Cursor returns to wrong article!
Date: Wed, 08 May 2019 11:43:40 +0800
Thanks. I suppose the temporary workaround is
(add-hook 'gnus-summary-mode-hook
 (lambda ()
   (setq switch-to-buffer-preserve-window-point nil))) ;until bug#35613 fixed




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#35613; Package emacs,gnus. (Wed, 08 May 2019 12:10:01 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 35613 <at> debbugs.gnu.org
Subject: Re: bug#35613: Cursor returns to wrong article!
Date: Wed, 08 May 2019 13:09:38 +0100
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:

> Thanks. I suppose the temporary workaround is
> (add-hook 'gnus-summary-mode-hook
>  (lambda ()
>    (setq switch-to-buffer-preserve-window-point nil))) ;until bug#35613 fixed

Doing that will change the global value of
switch-to-buffer-preserve-window-point.  If you're okay with doing that,
why bother with gnus-summary-mode-hook at all?  Just set the user option
once and for all.

Alternatively, if you want to localise the change, you can instead:

(add-hook 'gnus-article-mode-hook
          (lambda ()
            (setq-local switch-to-buffer-preserve-window-point nil)))

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#35613; Package emacs,gnus. (Wed, 08 May 2019 12:28:01 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35613 <at> debbugs.gnu.org
Subject: Re: bug#35613: Cursor returns to wrong article!
Date: Wed, 08 May 2019 20:27:42 +0800
I just hope somebody will publish the correct workaround for people to
use while waiting for their distribution to update the .debs involved.
OK, I'll assume it is

BLC> (add-hook 'gnus-article-mode-hook
BLC>           (lambda ()
BLC>             (setq-local switch-to-buffer-preserve-window-point nil)))

Thanks.




Added tag(s) fixed. Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Fri, 17 May 2019 00:01:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 35613 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Fri, 17 May 2019 00:01:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#35613; Package emacs,gnus. (Fri, 17 May 2019 00:01:02 GMT) Full text and rfc822 format available.

Message #26 received at 35613-done <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 35613-done <at> debbugs.gnu.org
Subject: Re: bug#35613: Cursor returns to wrong article!
Date: Fri, 17 May 2019 01:00:34 +0100
tags 35613 fixed
close 35613
quit

"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> From 1d7a51d2e3a1c3d5caa77587b3e612feda8bdd59 Mon Sep 17 00:00:00 2001
> From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
> Date: Tue, 7 May 2019 13:46:22 +0100
> Subject: [PATCH] Fix gnus-summary-expand-window placement of point
>
> * lisp/gnus/gnus-win.el (gnus-configure-frame): Replace
> switch-to-buffer with pop-to-buffer-same-window to avoid messing
> with point. (bug#35613)
> ---
>  lisp/gnus/gnus-win.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el
> index 5f7154c545..c6469f4937 100644
> --- a/lisp/gnus/gnus-win.el
> +++ b/lisp/gnus/gnus-win.el
> @@ -284,7 +284,7 @@ gnus-configure-frame
>                  ;; from a hard-dedicated frame, it creates (and
>                  ;; configures) a new frame, leaving the dedicated frame alone.
>                  (pop-to-buffer buf))
> -               (t (switch-to-buffer buf)))))
> +               (t (pop-to-buffer-same-window buf)))))
>  	  (when (memq 'frame-focus split)
>  	    (setq gnus-window-frame-focus window))
>  	  ;; We return the window if it has the `point' spec.
> -- 
> 2.20.1
>
>
> I'll push it to master in a week or so if there are no objections before
> then.

Now done[1], so I'm closing this report.

[1: 9408e36b84]: Fix gnus-summary-expand-window placement of point
  2019-05-17 00:55:58 +0100
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=9408e36b84b8e81dd9f4d1465c4f20f125d4bd06

-- 
Basil




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 14 Jun 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 289 days ago.

Previous Next


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