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#70949: display-buffer-choose-some-window Date: Tue, 28 May 2024 19:19:06 +0300 Organization: LINKOV.NET Message-ID: <86zfsaaqm1.fsf@mail.linkov.net> References: <86jzjwqqmd.fsf@mail.linkov.net> <8d1947c7-a4d1-4920-8638-f8ae17acfe65@gmx.at> <86r0e32fnj.fsf@mail.linkov.net> <867cft0xt2.fsf@mail.linkov.net> <86ed9xvz3o.fsf@mail.linkov.net> <73251208-1e4c-4231-ae58-faf82363f241@gmx.at> <86jzjoo23l.fsf@mail.linkov.net> <9e29cbbc-65ee-4dd8-8a41-539946e19a7c@gmx.at> <86cypfm6s7.fsf@mail.linkov.net> <86o78xm9y5.fsf@mail.linkov.net> <78dfee56-80b4-4ba7-a012-df31abd21743@gmx.at> <86sey8jv66.fsf@mail.linkov.net> <86zfsfqgtl.fsf@mail.linkov.net> <86plt7dyvu.fsf@mail.linkov.net> <963412d9-85b9-4afe-a29f-52981f24aa5b@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="28706"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 70949@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 28 18:33:43 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 1sBzlf-0007I2-1N for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 May 2024 18:33:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBzkx-0004no-Ow; Tue, 28 May 2024 12:32:59 -0400 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 1sBzkr-0004mc-Ue for bug-gnu-emacs@gnu.org; Tue, 28 May 2024 12:32:57 -0400 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 1sBzkq-0003oY-SR for bug-gnu-emacs@gnu.org; Tue, 28 May 2024 12:32:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sBzl0-0006Jt-7f for bug-gnu-emacs@gnu.org; Tue, 28 May 2024 12:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 May 2024 16:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70949 X-GNU-PR-Package: emacs Original-Received: via spool by 70949-submit@debbugs.gnu.org id=B70949.171691393724242 (code B ref 70949); Tue, 28 May 2024 16:33:02 +0000 Original-Received: (at 70949) by debbugs.gnu.org; 28 May 2024 16:32:17 +0000 Original-Received: from localhost ([127.0.0.1]:46855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sBzkG-0006Iw-Lo for submit@debbugs.gnu.org; Tue, 28 May 2024 12:32:16 -0400 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:57245) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sBzkF-0006If-RC for 70949@debbugs.gnu.org; Tue, 28 May 2024 12:32:16 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 6287E1C0007; Tue, 28 May 2024 16:31:39 +0000 (UTC) In-Reply-To: <963412d9-85b9-4afe-a29f-52981f24aa5b@gmx.at> (martin rudalics's message of "Tue, 28 May 2024 10:05:41 +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" 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:286098 Archived-At: >> Currently the main question is where to add display-buffer-in-related-window? >> It should be added to display-buffer-fallback-action between >> display-buffer-in-previous-window and display-buffer-use-some-window? >> If not, then users should add it by customizing display-buffer-base-action? > > Hopefully it can be merged into 'display-buffer-in-previous-window'. This is exactly what I already use in ~/.emacs, and it works nicely. Any chance to add something like this optionally to window.el? (defvar-local display-buffer-previous-window nil) (add-to-list 'display-buffer-alist '((category . compilation) display-buffer-in-previous-window (previous-window . display-buffer-previous-window))) (define-advice compile-goto-error (: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))))) The main problem is where to set this buffer-local variable (I think better to use the buffer-local variable instead of the window parameter since visiting results from rgrep is a property of the buffer, not the window). Instead of the advice like above, 'display-buffer-previous-window' should be set in every buffer displayed by 'display-buffer'. Isn't setting this variable in all buffers too excessive? But I see no other way because the user might want to force displaying the results in the same rgrep window, then display-buffer-in-previous-window should reuse the same window.