GNU bug report logs - #67993
Selecting buffer automatically

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sat, 23 Dec 2023 17:56:01 UTC

Severity: wishlist

Tags: patch

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


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

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 67993 <at> debbugs.gnu.org
Subject: Re: bug#67993: Selecting buffer automatically
Date: Wed, 10 Jan 2024 19:12:50 +0200
>>> That's why any such 'select-window' call (or its avoidance) you
>>> propose would be better handled within 'display-buffer' and not later
>>> in a 'post-command-hook'.
>>
>> No way to call 'select-window' immediately, because this will
>> break too many functions that expect a window to be selected
>> from the previous call of pop-to-buffer until the command
>> is finished.
>
> Do you mean that if I have two 'pop-to-buffer' calls within one and the
> same command, the first one has a (select-window . nil) entry and the
> second one no such entry, then the entry from the first call will cause
> the window from the second call to get deselected?  If so, then this
> deserves a special explanation in the manual.

This is what I see with the current patch:

1.
(let ((display-buffer-alist '(("1" nil (select-window . nil)))))
  (delete-other-windows) (split-window) (split-window) (balance-windows)
  (pop-to-buffer (get-buffer-create "1"))
  (pop-to-buffer (get-buffer-create "2")))

then the original window remains selected.

2.
(let ((display-buffer-alist '(("2" nil (select-window . nil)))))
  (delete-other-windows) (split-window) (split-window) (balance-windows)
  (pop-to-buffer (get-buffer-create "1"))
  (pop-to-buffer (get-buffer-create "2")))

then the window with "1" is selected after the command finishes.




This bug report was last modified 1 year and 125 days ago.

Previous Next


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