From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#67249: 30.0.50; `same-frame` equivalent for `display-buffer-alist` Date: Sun, 19 Nov 2023 09:57:51 -0500 Message-ID: References: <159cd3c2-a0c4-63e2-ebb2-ce0f5f8c343e@gmx.at> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25364"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 67249@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 19 15:59:17 2023 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 1r4jGW-0006Mi-9O for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Nov 2023 15:59:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4jGI-00032e-PA; Sun, 19 Nov 2023 09:59:02 -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 1r4jGH-00032A-7A for bug-gnu-emacs@gnu.org; Sun, 19 Nov 2023 09:59:01 -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 1r4jGG-00044X-VY for bug-gnu-emacs@gnu.org; Sun, 19 Nov 2023 09:59:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r4jGI-0000gZ-DR for bug-gnu-emacs@gnu.org; Sun, 19 Nov 2023 09:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Nov 2023 14:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67249 X-GNU-PR-Package: emacs Original-Received: via spool by 67249-submit@debbugs.gnu.org id=B67249.17004058842567 (code B ref 67249); Sun, 19 Nov 2023 14:59:02 +0000 Original-Received: (at 67249) by debbugs.gnu.org; 19 Nov 2023 14:58:04 +0000 Original-Received: from localhost ([127.0.0.1]:51899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4jFL-0000fC-H6 for submit@debbugs.gnu.org; Sun, 19 Nov 2023 09:58:04 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4jFJ-0000eP-37 for 67249@debbugs.gnu.org; Sun, 19 Nov 2023 09:58:02 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id AA281440B62; Sun, 19 Nov 2023 09:57:53 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1700405872; bh=FBCIVNDP+5UTPgW0zmXU9oluA1Ky4lr5FFypbC2RRIo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=A6jfP5nQ8iYHzrO7zc2JFBs+fL2SNwtg1vqlBD1HMXmFOqStxOflNQClLyZzFjg3q sM3bTh8f0/jv8te/MC+2VVUm34Zy/v0nx8FECnpH4h6Zzwxkw6Qq0ukMc7azvR1Zh7 TBfIUtLrB6w/PVSFuYDzAWeP10Fmuri8dKMc8KRJHv8El339WmqT/76guNiFSC0504 4lU+NTw+0+MUUEnAXDflE3nY1cemiTRw+9DIfdtv6oQrSo+5VtFXZjc9BFDrdT0JLu eyT0oIPtZExGbDmhmgRTF9yd0MYdTF/jvvOvsTdVyh5lc+0XZulAM9YkxmE1KF4Xgr 1Ch+PopAUC+kQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3AD65440452; Sun, 19 Nov 2023 09:57:52 -0500 (EST) Original-Received: from pastel (unknown [45.72.227.120]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0C5B4120352; Sun, 19 Nov 2023 09:57:52 -0500 (EST) In-Reply-To: (martin rudalics's message of "Sun, 19 Nov 2023 11:35:06 +0100") 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:274621 Archived-At: >> Are you referring to whether it's OK to (re)use a window on another >> frame if it shows the buffer already? > (Re)use any window on another frame. Right, so it should probably have been called something like "no new frame". > The action alist is flat - whichever entry comes first is used even if > it is not pertinent to the action chosen. If the action chosen is say > 'display-buffer-in-previous-window', the frames to investigate are > currently specified by a 'reusable-frames' entry. If no such entry is > present, we could check for a 'same-frame' entry. But what should > 'display-buffer' do when both entries are present with 'same-frame' > coming first? I don't see a big problem here: we could choose `same-frame` to imply that `reusable-frames` is nil, or we could choose to ignore `same-frame`. Since the code that adds `(same-frame . t)` could just as well also add `(reusable-frames)`, the first choice is less flexible than the second (tho it allows overriding a higher-precedence `reusable-frames` setting), so I'd go with the first choice, which also has the advantage of not requiring any code modification :-) > And how would 'display-buffer-use-some-window' and > 'display-buffer-use-least-recent-window' handle the similar case with a > 'lru-frames' and a 'same-frame' entry both present? Same reasoning here. > If you want 'same-frame' to not prevail in these cases, you probably I don't necessarily want a particular behavior. I want to provide a similar functionality, within the constraints of what we can define and implement sanely. So no, I don't necessarily want it to prevail over those other entries. > mean that it should only inhibit popping up a new frame via > 'display-buffer-pop-up-frame'. That was my conclusion when I looked at the code (concretized in my PoC patch). Another approach is to provide a new action. This could be a `display-buffer-same-frame` action which tries its best to use the selected frame. I suspect in many cases the actual intention of `same-frame` was to keep the buffer nearby, so I suspect we could also replace `same-frame` with a `display-buffer-nearby` action. The advantage of an action is that we don't need to decide how existing actions interact with it. > Again applications that want to pop up a new frame would then have to > provide a (same-frame . nil) entry. That would seem fair game, IMO. > The proof of this pudding is in clarifying the "if at all possible" and > explaining any new special behavior in the manual. I suspect the main exception would be minibuffer-only frames, but we could get fancier if we feel like it (like when the selected frame can't accommodate the `window-min-width` and `window-min-height`, or when we set `inhibit-same-window` (or the selected window is dedicated) and the frame's sole window can't be split). Stefan