GNU bug report logs - #71616
switch-to-buffer behaves inconsistently when switch-to-buffer-obey-display-actions is t and nil .

Previous Next

Package: emacs;

Reported by: Siyuan Chen <chansey97 <at> gmail.com>

Date: Mon, 17 Jun 2024 18:18:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Siyuan Chen <chansey97 <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 71616 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: bug#71616: switch-to-buffer behaves inconsistently when switch-to-buffer-obey-display-actions is t and nil .
Date: Sun, 23 Jun 2024 13:44:07 +0800
[Message part 1 (text/plain, inline)]
This patch fixed my original use case, which did not touch
'set-window-buffer'.

Thanks.

Best regards,
Siyuan Chen

On Wed, Jun 19, 2024 at 5:37 PM martin rudalics <rudalics <at> gmx.at> wrote:

>  >> ## Test with switch-to-buffer-obey-display-actions = t
>  >> 1. Emacs -Q
>  >> 2. M-x eval-expression (setq switch-to-buffer-obey-display-actions t)
>  >> 2. Open a .el file, e.g. window.el, and keep the cursor location at 1
>  >> 3. Click buffers menu -> *scratch* to switch buffer
>  >> 4. Click buffers menu -> window.el to switch buffer back
>  >> 5. Move the current location to L24
>  >> 6. M-x switch-to-buffer window.el
>  >> The result is that the current cursor location jumps to location at 1!
>  >> This inconsistent behavior convinced me that this is a bug.
>  >
>  > I confirm this in Emacs 30.  Maybe Martin could suggest how to fix
>  >> this.
>
> A recipe without involving a file is
>
> 1. M-: (setq switch-to-buffer-obey-display-actions t)
> 2. C-x b *Messages*
> 3. C-x b *scratch*
> 4. Move point
> 5. C-x b *scratch*
>
> In step 2 we record the point of *scratch*.  In 5 we go there because
> the 'set-window-buffer' called by C-x b decides that the window already
> shows buffer and does not record its current position.  I attach a patch
> that should fix this and the original scenario.  It does _not_ fix the
> case where instead of C-x b plain 'set-window-buffer' is used.  If we
> wanted to fix that, we'd have to call 'record-window-buffer' from there
> even when the old and the new buffer are the same.  I'm not sure whether
> we want to do that.
>
> martin
[Message part 2 (text/html, inline)]

This bug report was last modified 323 days ago.

Previous Next


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