GNU bug report logs - #55983
29.0.50; If xref-goto-xref pops up a frame, it doesn't set its input focus

Previous Next

Package: emacs;

Reported by: miha <at> kamnitnik.top

Date: Tue, 14 Jun 2022 20:06:01 UTC

Severity: normal

Found in version 29.0.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: <miha <at> kamnitnik.top>
To: Dmitry Gutov <dgutov <at> yandex.ru>, 55983 <at> debbugs.gnu.org
Subject: bug#55983: 29.0.50; If xref-goto-xref pops up a frame, it doesn't set its input focus
Date: Sun, 19 Jun 2022 15:37:45 +0200
[Message part 1 (text/plain, inline)]
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> Hi!
>
> Thanks for the report.
>
> On 14.06.2022 23:17, miha--- via Bug reports for GNU Emacs, the Swiss 
> army knife of text editors wrote:
>> To reproduce, customize pop-up-frames to non-nil and set up your window
>> manager such that it doesn't automatically set input focus on newly
>> created frames.
>
> TBH I'm not sure how to setup GNOME Shell to do this.
>
>> Now in an xref-mode buffer, press RET on a search result
>> (xref-goto-xref) and notice that the newly created frame doesn't receive
>> input focus. That is because xref-goto-xref uses `display-buffer',
>> followed by a `select-window'.
>> 
>> To contrast this behaviour with grep-mode, pressing RET in a grep-mode
>> buffer (compile-goto-error) does set input focus to the newly created
>> frame. That is because compile-goto-error uses `pop-to-buffer`, which
>> also calls `select-frame-set-input-focus'.
>
> Window management in Emacs is a tricky business, and the current 
> implementation is a result of https://debbugs.gnu.org/28814 which 
> implemented a particular kind of behavior and 
> https://debbugs.gnu.org/33870 which did try to make it more customizable 
> through display-buffer-alist. See both discussions for more detail.
>
> I don't have the time at the moment to try to rework it myself.
>
> Patches welcome, though. But please mind the original implementation
> intent.

Please see the attached patch. The only thing it adds is setting frame
input focus if necessary before calling `select-window'. Other behaviour
should remain the same as before. (The code and the comment is lifted
from the function `pop-to-buffer'.)

Best regards.

[0001-xref-goto-xref-Set-input-focus-in-addition-to-select.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 2 years and 335 days ago.

Previous Next


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