From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74361: [PATCH] New option xref-navigation-display-window-action Date: Thu, 5 Dec 2024 10:23:15 +0100 Message-ID: References: <87sernhxoa.fsf@mail.linkov.net> <1d08c589-2d0e-4f10-8c2e-e21c206ac118@gmx.at> <78a96965-31c1-4688-b808-2de09d1832c4@gmx.at> <878qt9pz4w.fsf@mail.linkov.net> <05452bef-dd2e-4e93-abdd-6eb391027197@gmx.at> <87y118cyyk.fsf@mail.linkov.net> <871pyzp6br.fsf@mail.linkov.net> <25443bb1-788a-4f06-9350-5d2c666f6795@gmx.at> <32b8cc56-afa1-40f6-933f-6de0df2b9f63@gutov.dev> <688d5119-0900-46a4-86c7-32a9b06cc349@gmx.at> <87ed2v1aec.fsf@mail.linkov.net> <19124901-e749-4daa-bf47-27e12ea619aa@gutov.dev> <87mshbj4lk.fsf@mail.linkov.net> <4a81429a-ef9e-473c-989f-cff1314f5633@gmx.at> <8734j3l69p.fsf@mail.linkov.net> Reply-To: martin rudalics 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="28818"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Dmitry Gutov , 74361@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 05 10:24:29 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 1tJ85u-0007EJ-0K for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Dec 2024 10:24:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJ85h-0006X5-1U; Thu, 05 Dec 2024 04:24:09 -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 1tJ85b-0006WP-BN for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 04:24: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 1tJ85b-0004Kx-2o for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 04:24: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=TraqunPv0M3Ba09oLPNzH2RF7tvV2vB1nMGFFTK/itk=; b=h5DVuUdZkylzGXT/Wu8G7mGCFetXgzuGkjeE1qePqg0fgp9ksnZpME2NH1AtIE/IDh+xE/guCJTdlkvQzBmFVV86g47LrxeAUYFiUL7YCCKtWOrPaGS65QleL8m11G4lPUWbqjIb1GVmDFJze1QaqIjnTBAwq7Xj0SaWx6feZ5FxH2EtTJFqIwWJ0i5/AYbpHVn1YzNdUco4Yn8QaNNqC4XEQ5ytfXQEbCLSXvDLfNVA6WyBOPx1GmkLa1OF8EbIurlvgXlyVcauy4vHIp1ApoftHtUHMdS0WKf9XzW1pBUIsZluDlCA6X8lZrwsbnGnhARWFU2l2Etco2MQPg5d8Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tJ85a-0001q7-UF for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 04:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Dec 2024 09:24: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.17333906097005 (code B ref 74361); Thu, 05 Dec 2024 09:24:02 +0000 Original-Received: (at 74361) by debbugs.gnu.org; 5 Dec 2024 09:23:29 +0000 Original-Received: from localhost ([127.0.0.1]:38252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJ853-0001ov-Ds for submit@debbugs.gnu.org; Thu, 05 Dec 2024 04:23:29 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:46365) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJ851-0001og-SJ for 74361@debbugs.gnu.org; Thu, 05 Dec 2024 04:23:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at; s=s31663417; t=1733390596; x=1733995396; i=rudalics@gmx.at; bh=TraqunPv0M3Ba09oLPNzH2RF7tvV2vB1nMGFFTK/itk=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=hpcyYFhyV6UlBv+ttckFb+rFJm4tSj33GEtGf4gPgIvO4m+lWLdNpnAUyYiWulxG Cvu+l7QxD0cP4NgKo/2LYavefrfyldOKPNISf4sDNDMNq5mHWL5XpzoqvhpMxZa7y ZrT4SE+HRT3Mj8MVxs39powBblVXm4HYyVbUD3UEgwj1lOZQ27M/ArS49kJ6UTR2q xCT36Ly3NC2oncF65JcL7gzMZflYbgVSVhBQEQtgWKiii8d4ZA425Ylsjf9OAQ2wd bm2Iwz++Meno4JS1Nzg/E+hgico9dnqFF4qxh9kUPjveWNhl7ouCwc/T0CU2zZ22a ZbLz2e0JpR7j526X3g== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.31.113] ([213.142.97.121]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MMGN2-1t37OU2U7i-00R25A; Thu, 05 Dec 2024 10:23:16 +0100 Content-Language: en-US In-Reply-To: <8734j3l69p.fsf@mail.linkov.net> X-Provags-ID: V03:K1:B1K7U5ngjh68mCmZuDeWjUGxr52My59II3CfkHA9fhN99BlnA05 dpAkn4eEVFunm8lGkQvJ+yAx6eX+c5SoEgfkuFByJPg8hfC21afO9asckEjGA9fq03pcfK1 x8bjVHYiEpkHHACwlLz5Ik9GJzsl4GIxQLwvU1RG6J7GObVQRDvSuQz+caetsDphHiLWus0 TaeCWxXaRtQg0j7P72Q1w== UI-OutboundReport: notjunk:1;M01:P0:T5PW91LEr3Y=;5oug21+l0Fvyadm9XFQdgLHBhhp dfdOOD7AwEvNWGIbQ5MlTZagFxrtgaVpknpVk9t7yBrf1vQiEAr78y8ZS/S3nJOGIN45+EHze DTK/lTmxyNHY0CrexY8h6QMHjwxHLZSZmn3Bxtv0Shn+QKP07YvybzohZ/TQQizDJAt/kYUMK fyk19EJLo8FiwXWZf6i2HV8UIFNdb7UvLWG+adT7pXqd8cMg1ANDIAcF9r2TqxnoBrDD5OKAj oAJ5B10SJCG2Qjq8CCqRMd+d6+Ib111r4mFcrJS+T0flcQzDXesgUZAPuWSQ5FGEJxAagSBai VZgcotj0OXC8QJMaP7z0SUtOhuV2JIzqknkGp+a70dur2wp7ET8gKrHzXcO0/73inYI89/9XB 6pYlyc7T1ibWnpK8PIvn4OpBAaaup4lQrUnPv1eiVoESzToYwc6s5MWtvW9uwuqfaAB+hmw2/ OFPruyoETPknxx8jZXQl1zrUyELGMK+LQfXElBDo/HCZCIYIip7lNy7JS45K5ume+nF/pn3BH txoBlj9y1n5Fpa8xMr+S/OdskeIkG9aWTwW1wOpFn/OvZXf8H1ZbHtP9HVgS1y0hXlX1j6YPm l8qffVyFfPYbRBLY/f5yf8LNkXLXhssra/ER7HojcyF02GlrIiqWGSYWBLFVccNpz4DDA14Pt gIs8RkEqRzMq9gHnfM603jn2UUNKgj74Jyef0g98b0XAxyR4wwsk5UzEOpCw5eT58SNeSEvHZ 2ENKa4k0KkVK3q4uqPC0/PnlEJf/jA5LAdXijwjOPdKiWkmN6VCms0OxfXwDmeclAiLQybO0 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:296461 Archived-At: > Ok. This reminds me adding '(previous-window . WINDOW)' > to 'display-buffer-in-previous-window' with: > > (when (and previous-window (symbolp previous-window) > (boundp previous-window)) > (setq previous-window (symbol-value previous-window))) Where and how is or would this be used? In the sources all I see is `((previous-window . ,debugger-previous-window)))))) so I suppose the symbol value would be used in customizations only. > (when (and (setq window previous-window) > (window-live-p window) > > Probably we should support both a symbol and a value for 'some-window' > as well. Where and how would this be used? > BTW, here is an example of using 'previous-window' with an advice on > 'window--display-buffer' that could be combined with 'some-window': > > (defvar-local display-buffer-previous-window nil) > > (add-to-list 'display-buffer-alist > '((category . xref-jump) > display-buffer-in-previous-window > (previous-window . display-buffer-previous-window) So here 'display-buffer' would retrieve the symbol-value of whatever is in the buffer-local value of 'display-buffer-previous-window'. Right? > (inhibit-same-window . nil)) > ;; Append to not override display-buffer-same-window > 'append) > > (define-advice xref-goto-xref (:around (ofun &rest args) previous-window) > (let ((buffer (current-buffer))) > (apply ofun args) > (with-current-buffer buffer > (setq-local display-buffer-previous-window (selected-window))))) This relies on 'ofun' selecting a window and would not work for plain 'display-buffer'. Right? > (define-advice window--display-buffer (:around (ofun &rest args) previous-window) > (let ((buffer (current-buffer)) > (window (apply ofun args))) > (with-current-buffer buffer > (setq-local display-buffer-previous-window window)) > window)) And this assumes that the current buffer is the one where to set the variable. Would this work with a function calling 'xref-goto-xref', bound to a key and called interactively with an arbitrary window selected? martin