From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Juri Linkov <juri@linkov.net>
Newsgroups: gmane.emacs.bugs
Subject: bug#74361: [PATCH] New option xref-navigation-display-window-action
Date: Wed, 20 Nov 2024 09:11:09 +0200
Organization: LINKOV.NET
Message-ID: <875xoi4cei.fsf@mail.linkov.net>
References: <dfc132c1-2b1c-4c82-a996-098d83b31e8d@gutov.dev>
 <87msi1ueb0.fsf@mail.linkov.net>
 <4256f446-e11b-450c-b455-131cb75acab0@gutov.dev>
 <871pzbj8mq.fsf@mail.linkov.net>
 <c05a2b89-cc0b-4489-9011-7449f306cb19@gutov.dev>
 <87sernhxoa.fsf@mail.linkov.net>
 <fd3fe857-b1fb-41f6-ab4b-72223948b814@gutov.dev>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="2080"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
Cc: martin rudalics <rudalics@gmx.at>, 74361@debbugs.gnu.org
To: Dmitry Gutov <dmitry@gutov.dev>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 20 08:19:27 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1tDezn-0000QQ-Em
	for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Nov 2024 08:19:27 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1tDezS-0000xX-5H; Wed, 20 Nov 2024 02:19:06 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1tDezO-0000wT-Jl
 for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 02:19:02 -0500
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1tDezO-0003Tw-Ak
 for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 02:19:02 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=debbugs.gnu.org; s=debbugs-gnu-org; 
 h=MIME-Version:Date:References:In-Reply-To:From:To:Subject;
 bh=LdMrZ/NXQavsVzuwtdtLdbQr6c0VnnykeBc94hPKFUA=; 
 b=YM/pNoZJVzlS7E0hyJKhZspTcUICJ13uQ54BE9FumFBRA50+teqtlpzekO6fNzxqGNr1aIcwiUWK2q//9X4GnZNTnmkXxP6R99gYAaBapXld32I+53/tcsxAn8M4nIFp/SA8LYpNpHYH+pIHAKSYXCrITVSrpvfEjzQmiEW7hcj3KPIkoZ5V9RsJiq4XNmwH3ySl4BDgXpUWHCzyDVRYr2GuYLy2fdqBNsKc9GArK/nGCNQ3Ugk6UvtojT6Sk/KwLzL6rTLmbmf7Soen4M9k/GruTeDym92OZAX0FMGBzvnwKUNhxopbLC6ZIJ4YaBYzPobvJvT206ri9qtO7kSw8g==;
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1tDezN-00041q-UT
 for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 02:19:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Juri Linkov <juri@linkov.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 20 Nov 2024 07:19:01 +0000
Resent-Message-ID: <handler.74361.B74361.173208712815450@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 74361
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
Original-Received: via spool by 74361-submit@debbugs.gnu.org id=B74361.173208712815450
 (code B ref 74361); Wed, 20 Nov 2024 07:19:01 +0000
Original-Received: (at 74361) by debbugs.gnu.org; 20 Nov 2024 07:18:48 +0000
Original-Received: from localhost ([127.0.0.1]:45027 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1tDez9-000418-LK
 for submit@debbugs.gnu.org; Wed, 20 Nov 2024 02:18:47 -0500
Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:35699)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@linkov.net>) id 1tDez7-00040p-CM
 for 74361@debbugs.gnu.org; Wed, 20 Nov 2024 02:18:46 -0500
Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id D5911C0006;
 Wed, 20 Nov 2024 07:18:17 +0000 (UTC)
In-Reply-To: <fd3fe857-b1fb-41f6-ab4b-72223948b814@gutov.dev> (Dmitry Gutov's
 message of "Tue, 19 Nov 2024 21:43:21 +0200")
X-GND-Sasl: juri@linkov.net
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:295665
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/295665>

>> I tried your patch, and it works even with 'mru':
>> (setq display-buffer-alist '(((category . xref)
>>                                (display-buffer-reuse-window
>>                                 display-buffer-use-some-window)
>>                                (some-window . mru))))
>
> Yep, even the 'mru' strategy doesn't choose the currently selected window,
> so this should also work well, selecting "some window" in a stable fashion
> (whereas 'lru' - the default - uses a different window each time).

Unless the user customizes it to call with NOT-SELECTED=nil explicitly:

  (setq display-buffer-alist
        '(((category . xref)
           (display-buffer-use-some-window)
           (some-window . (lambda (_buffer alist)
                            (get-mru-window nil nil nil))))))

PS: after testing I noticed that in your patch
nil needs to be added as a placeholder for empty action:

                  `((xref--display-buffer-in-window)
                    (category . xref)
                    (window . ,xref--original-window)))
                 (t
-                 '((category . xref))))))
+                 '(nil (category . xref))))))