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


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 67993 <at> debbugs.gnu.org
Subject: bug#67993: Selecting buffer automatically
Date: Sun, 07 Jan 2024 18:51:04 +0200
>> Could you suggest an alternative to 'old-selected-window'
>> to select the original window that was selected before
>> the current command?
>
> In 'display-buffer' first save the selected window as
> old-selected-window, display the buffer and in your code select
> old-selected-window instead of (old-selected-window).

Unfortunately, this is not so easy to do.  'old-selected-window'
should be reinitialized before the next command is executed.

So by definition 'old-selected-window' should contain
the window that was selected before the current command
was executed.  I have no idea how to do this without hooks.

> Better, rename "select-window" to "window-to-select" so grepping won't
> confuse it with a 'select-window' call and allow for an arbitrary window
> (or even buffer, but there could be two windows showing the same buffer)
> to use as the finally selected window in 'display-buffer'.  And maybe
> have 'pop-to-buffer' and friends pass (select-window . t) instead of
> calling 'select-window' themselves

'pop-to-buffer' can't be changed because (select-window . t)
should be handled only at the end of the current command.

> and think of what has to happen when the window made or used by
> 'display-buffer' is on another frame that should be (de-)selected.

So this also need to run 'select-frame' in post-command-hook.




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

Previous Next


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