all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 35613@debbugs.gnu.org
Subject: bug#35613: Cursor returns to wrong article!
Date: Tue, 07 May 2019 14:10:47 +0100	[thread overview]
Message-ID: <87sgtqbeaw.fsf@tcd.ie> (raw)
In-Reply-To: <8736lrujlt.5.fsf@jidanni.org> ("積丹尼 Dan Jacobson"'s message of "Tue, 07 May 2019 09:41:18 +0800")

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

tags 35613 + patch
quit

積丹尼 Dan Jacobson <jidanni@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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-gnus-summary-expand-window-placement-of-point.patch --]
[-- Type: text/x-diff, Size: 1078 bytes --]

From 1d7a51d2e3a1c3d5caa77587b3e612feda8bdd59 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@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


[-- Attachment #3: Type: text/plain, Size: 100 bytes --]


I'll push it to master in a week or so if there are no objections before
then.

Thanks,

-- 
Basil

  reply	other threads:[~2019-05-07 13:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07  1:41 bug#35613: Cursor returns to wrong article! 積丹尼 Dan Jacobson
2019-05-07 13:10 ` Basil L. Contovounesios [this message]
2019-05-08  3:43   ` 積丹尼 Dan Jacobson
2019-05-08 12:09     ` Basil L. Contovounesios
2019-05-08 12:27       ` 積丹尼 Dan Jacobson
2019-05-17  0:00   ` Basil L. Contovounesios

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgtqbeaw.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=35613@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.