From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#74361: [PATCH] New option xref-navigation-display-window-action Date: Tue, 19 Nov 2024 21:43:21 +0200 Message-ID: References: <87msi1ueb0.fsf@mail.linkov.net> <4256f446-e11b-450c-b455-131cb75acab0@gutov.dev> <871pzbj8mq.fsf@mail.linkov.net> <87sernhxoa.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12969"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: martin rudalics , 74361@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 19 20:44:31 2024 Return-path: 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 ) id 1tDU9A-0003AI-CJ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Nov 2024 20:44:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDU8t-0004UC-2o; Tue, 19 Nov 2024 14:44:07 -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 ) id 1tDU8q-0004U0-2U for bug-gnu-emacs@gnu.org; Tue, 19 Nov 2024 14:44:04 -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 ) id 1tDU8p-0007lV-Q3 for bug-gnu-emacs@gnu.org; Tue, 19 Nov 2024 14:44:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=gTwMO1n6eB+AEql3tKIUBjEuJD1pE1ZJ/2Lnyl1sbH4=; b=ECkwfgGSPseYx6fh28TaTkZwSHes3w83saBFDIclkNwJXef5f+s0/L3PeLXYFY6OB89l7X/huTIkG1KUpPR1jhdHfvY1fM6/Esy5gn503AaZkdtR/5zoKiyNL/WeOJkv9fNwLrc6AEgt542Xyd+78qvmuxkK8QZjtfm9Cp4l2tnQ0TZc16nKzAm/eQjg0OxGuR39NVgrP8WKcH/kX/gdt9rq5vF6zsJFmnKFZ6KyuT6L133X4DD49mqxsK4I5LQ0PL80JB5bDW/dw/uP1u1WRc1UsH9J8A9E/IF8Qtf7OxWqUuLJ0ylO6IDzON/QBsytdCEEgxQvMB4iFJ64zyKwaQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tDU8o-0006VA-LU for bug-gnu-emacs@gnu.org; Tue, 19 Nov 2024 14:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Nov 2024 19:44:02 +0000 Resent-Message-ID: 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.173204541324946 (code B ref 74361); Tue, 19 Nov 2024 19:44:02 +0000 Original-Received: (at 74361) by debbugs.gnu.org; 19 Nov 2024 19:43:33 +0000 Original-Received: from localhost ([127.0.0.1]:44091 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDU8K-0006UI-JG for submit@debbugs.gnu.org; Tue, 19 Nov 2024 14:43:32 -0500 Original-Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]:34111) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDU8I-0006U3-2V for 74361@debbugs.gnu.org; Tue, 19 Nov 2024 14:43:30 -0500 Original-Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.phl.internal (Postfix) with ESMTP id 6AC951380627; Tue, 19 Nov 2024 14:43:24 -0500 (EST) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Tue, 19 Nov 2024 14:43:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1732045404; x=1732131804; bh=gTwMO1n6eB+AEql3tKIUBjEuJD1pE1ZJ/2Lnyl1sbH4=; b= gshTCbL7HeTbNeAFzuJqMHWdPBSIy7le46zSEFVv6bW5zAIeOGYtaj1Fy0NWzOa+ pEfe30smsgbNFoAQfzFKBZot0UDMnzHMOj3M+nF18VfMRDluzMT9rdiHg6vcq5Ck NOWSGFnKKu9k94BWu9vPBVUVBOOZCMvt1388o7g6x5qeJ7JRfWukzW1yaBPaSsMa YsX8nQqF6msXsKHEfiTqsa/rNvsO2/qXiMdi9qn7B1QA14cLRLpUFCetyhGeRIca LirFWKuSe/2H+3oJjV/lPBFhX8J+nCzxgoGa74pjW7W+cflXKUEisXVUO5tG2GkE LrULSziCv+ji/ICLQV6G/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1732045404; x= 1732131804; bh=gTwMO1n6eB+AEql3tKIUBjEuJD1pE1ZJ/2Lnyl1sbH4=; b=T J4gndrdialabss0gtwde08UePvirGIECmUnILtqmvnQDDZJBh5Lmh/cnFZFH/Tws 0GcNPpYje0GsyCDcj5faM334v8soQHSiO4GvAPlUgejf5vVHK8lbHg9IVsObzPuN tNKTjRw1Q6/S+vVbHn4i97Rl3O42qodOM2mZ8QXymzYK4Z8qaJXZLrU6cY78swkM Q3Ac/Y/F9lWx1l2/257MGCVUka/liOjhCDHJCEG4Q6anPm7Y7/5ITkFpv0tcbc5r F/6vL2GHa24Afn0DI0Lb1aNLZzN7pNkxNexNV22pZxNXYNxNEfyxrexe/ghVEbix rbqHlHBcqSWCu5jD9NPKw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrfedvgdduvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdrug gvvheqnecuggftrfgrthhtvghrnhepteduleejgeehtefgheegjeekueehvdevieekueef tddvtdevfefhvdevgedujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthho peefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjuhhriheslhhinhhkohhvrd hnvghtpdhrtghpthhtoheprhhuuggrlhhitghssehgmhigrdgrthdprhgtphhtthhopeej geefieduseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 19 Nov 2024 14:43:23 -0500 (EST) Content-Language: en-US In-Reply-To: <87sernhxoa.fsf@mail.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" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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:295656 Archived-At: On 19/11/2024 20:33, Juri Linkov wrote: >> Thanks! That covers the code path which uses 'display-buffer', and we also >> need to handle xref-pop-to-location, which calls switch-to-buffer now. Does >> >> (pop-to-buffer buf '((display-buffer-same-window) (category . xref))) >> >> look compatible enough? > > Maybe Martin could confirm whether this is equivalent to switch-to-buffer. display-buffer-same-window *is* the function that's ultimately used by switch-to-buffer. This does bring some incompatibilities, though, such as forcung switch-to-buffer-in-dedicated-window to nil, or the use of display-buffer-alist in the first place (normally configured by switch-to-buffer-obey-display-actions). >> Also, when using the suggested change in xref--show-pos-in-buf, if we >> simply annotate it with 'category' in the display-buffer call, this also >> extends to the scenarios where xref--original-window-intent is non-nil. >> >> See the attached patch where we make sure to exclude those cases. I suppose >> that loses the semantic consistency, though: >> xref-find-definitions-other-window and xref-find-definitions-other-frame >> are "xref" commands but they will call 'display-buffer' without 'category'. > > I agree the category should not override the window when used > from a command that specifies a window/frame. Okay then. >> The corresponding customization (described in the first message) can be: >> >> (setq display-buffer-alist '(((category . xref) >> (display-buffer-reuse-window >> display-buffer-use-some-window)))) > > 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).