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: Thu, 30 May 2024 09:34:38 +0300 Organization: LINKOV.NET Message-ID: <86ed9jhkox.fsf@mail.linkov.net> References: <86jzjwqqmd.fsf@mail.linkov.net> <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> <86zfsaaqm1.fsf@mail.linkov.net> <431cc3a7-141e-414f-8650-72771609c407@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="20715"; 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 Thu May 30 08:37:16 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 1sCZPY-0005H7-7C for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 May 2024 08:37:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCZPC-0000jC-6y; Thu, 30 May 2024 02:36:54 -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 1sCZPA-0000iZ-8A for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 02:36:52 -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 1sCZP9-0007WT-Vl for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 02:36:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sCZPK-00062H-3w for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 02:37: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: Thu, 30 May 2024 06:37: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.171705102023191 (code B ref 70949); Thu, 30 May 2024 06:37:02 +0000 Original-Received: (at 70949) by debbugs.gnu.org; 30 May 2024 06:37:00 +0000 Original-Received: from localhost ([127.0.0.1]:48590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCZPH-00061z-W7 for submit@debbugs.gnu.org; Thu, 30 May 2024 02:37:00 -0400 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:45619) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCZPG-00061g-6W for 70949@debbugs.gnu.org; Thu, 30 May 2024 02:36:58 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id E9D0DE0004; Thu, 30 May 2024 06:36:20 +0000 (UTC) In-Reply-To: <431cc3a7-141e-414f-8650-72771609c407@gmx.at> (martin rudalics's message of "Wed, 29 May 2024 10:49:37 +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:286197 Archived-At: > We are talking about displaying, in one and the same window, buffers > whose only relationship is that they appear in the results list of > compilation or grep output. That's why I think that a buffer-local > variable doesn't make sense here. It works for 'compile-goto-error' but > only if, as a user, you invoke 'display-buffer' from the results window. > If you are in the file window and want to display the next file, you > have to go back to the results window. If you use one window to show > results and files, you have to redisplay the results in that window > first. All this is tedious, especially given the fact that 'next-error' > already can guess from where to get the name of the next file to show. > > I think we need a unified framework that supports 'compile-goto-error' > and 'next-error' out of the box, where the later command can be invoked > from anywhere (although the key-binding in the results buffer is > obscured by 'compilation-next-error'). Which means that we should use a > global variable, say 'compilation-previous-window', that these commands > use to show the next file buffer. > > This variable should be set up by the first invocation of either > 'compile-goto-error' or 'next-error' and should be reset by > 'quit-window' and 'delete-window'. In addition, we'd need > 'grep-previous-window' and 'occur-previous-window' variables and > whatever else falls into this category. > > 'next-error' could first determine, as it does now, to which category > the user request belongs. If it's the compilation category, it consults > 'compilation-previous-window' and, if that's a live window, calls > 'display-buffer' with a 'display-buffer-in-previous-window' action and > 'compilation-previous-window' as 'previous-window' action alist entry. > If it's not a live window, it has to first find or make a suitable > window, set 'compilation-previous-window' to that window and maybe mark > the window as softly dedicated so it won't get used too soon by other > 'display-buffer' calls. > > Whether all this should be done by 'next-error' or within > 'display-buffer' is to decide. In the latter case, 'next-error' could > pass to 'display-buffer' a 'previous-window' entry whose value is > something like the symbol 'compilation-previous-window' and > 'display-buffer' would have to do the work I sketched above. This has > the advantage that 'compile-goto-error' could use the same underlying > mechanism and no code would be duplicated. The disadvantage is that > people who know about the inner working of compilation buffers and > 'next-error' would have to work within window.el. Sorry, I don't understand why the design should be limited to compile-goto-error/next-error only. I have the same problem with many other commands. For example, vc-diff from such buffers as *vc-dir*, *vc-change-log* opens the diff buffer in unpredictable windows, every time choosing another window that makes the window management unusable (need to quit the buffer displayed in the wrong window and re-run the diff command again). As a unified framework we could provide a new defcustom with a list of categories for which display-buffer will set a buffer-local variable or the window parameter 'previous-window', then the next invocations of the same command will reuse it.