From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#74361: [PATCH] New option xref-navigation-display-window-action Date: Wed, 04 Dec 2024 19:14:42 +0200 Organization: LINKOV.NET Message-ID: <8734j3l69p.fsf@mail.linkov.net> 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20610"; 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: Dmitry Gutov , 74361@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 04 18:33:22 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 1tItFZ-0005DC-SH for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Dec 2024 18:33:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tItFM-00011W-Cs; Wed, 04 Dec 2024 12:33:08 -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 1tItFI-000113-2P for bug-gnu-emacs@gnu.org; Wed, 04 Dec 2024 12:33: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 1tItFH-0001ZZ-QW for bug-gnu-emacs@gnu.org; Wed, 04 Dec 2024 12:33:03 -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=+u3rpg4qacqCMjDGi3t2bMly79gDVzyoto8We53MyIU=; b=Rp6rHbmeQbhpELLZkL531NpKkHa203J7Q+xp/yDzzn2iyQOuxyQZ28ZcU1RV5AF67VDjnXhUGDdXZbzEuhavuOlgu0vpiyqLNZUxfacnaScfGOO0uhg6mPNmPRFPxumuXQS7J2O0S+SpYFZYOx4IhgqYV0bbQa2sQfQccVsPTlmwPWsHE6V1wD0tKVHM0JaOB8Ryye+xCJefyX/FO+BgMoXfRXxlfKtex2+CkFWAHkd+xuGw7UQ150ccp8GS7gnlEONTXlFhZEXaEa/uagvbS+7WO/FmFb+HV2d8GOejbm4nVPmgJ9GVBeIwOPys/5XKqffcLNpA6jLDEgR7s6VvQg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tItFH-0005VQ-BP for bug-gnu-emacs@gnu.org; Wed, 04 Dec 2024 12:33:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Dec 2024 17:33:03 +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.173333358221143 (code B ref 74361); Wed, 04 Dec 2024 17:33:03 +0000 Original-Received: (at 74361) by debbugs.gnu.org; 4 Dec 2024 17:33:02 +0000 Original-Received: from localhost ([127.0.0.1]:36653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tItFF-0005Uu-Fc for submit@debbugs.gnu.org; Wed, 04 Dec 2024 12:33:01 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:56269) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tItFE-0005Ub-A2 for 74361@debbugs.gnu.org; Wed, 04 Dec 2024 12:33:00 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 123DC1BF206; Wed, 4 Dec 2024 17:32:31 +0000 (UTC) In-Reply-To: <4a81429a-ef9e-473c-989f-cff1314f5633@gmx.at> (martin rudalics's message of "Wed, 4 Dec 2024 09:00:09 +0100") 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" 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:296419 Archived-At: >> I see no problems with this patch. Even better would be if Martin agrees >> to modify 'display-buffer-use-some-window' to accept a window in >> '(some-window . WINDOW)'. > > He obviously agrees (provided WINDOW is a live window). 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))) (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. 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) (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))))) (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))