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.devel Subject: Re: master 18b680cfd1: Fix bug#52467 by adding a new custom variable 'display-comint-buffer-action' Date: Thu, 30 Dec 2021 18:04:15 +0200 Organization: LINKOV.NET Message-ID: <868rw2ulzs.fsf@mail.linkov.net> References: <164073060906.21430.4993248796177370312@vcs2.savannah.gnu.org> <20211228223009.6D0BAC002EE@vcs2.savannah.gnu.org> <871r1v8nhf.fsf@gnus.org> <83ilv7jqm7.fsf@gnu.org> <6a9cd581-1630-4a95-62c4-419603561072@gmx.at> <3499cedf-b170-3045-873d-d45d2972ae13@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="4056"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: Eli Zaretskii , emacs-devel@gnu.org, Lars Ingebrigtsen , sdsg@amazon.com To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 30 17:13:19 2021 Return-path: Envelope-to: ged-emacs-devel@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 1n2y3K-0000ps-TL for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Dec 2021 17:13:18 +0100 Original-Received: from localhost ([::1]:58602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2y3J-0005vG-LJ for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Dec 2021 11:13:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2y21-0004Yw-O0 for emacs-devel@gnu.org; Thu, 30 Dec 2021 11:11:57 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:51021) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2y1z-00059N-Tk; Thu, 30 Dec 2021 11:11:57 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 2F8E1240008; Thu, 30 Dec 2021 16:11:47 +0000 (UTC) In-Reply-To: (martin rudalics's message of "Thu, 30 Dec 2021 11:25:31 +0100") Received-SPF: pass client-ip=217.70.178.230; envelope-from=juri@linkov.net; helo=relay10.mail.gandi.net X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:283665 Archived-At: >> ... we need a general new display >> buffer action that preferably (1) reuses a window already showing the >> buffer (2) uses the same window and only then (3) uses another window. >> Maybe Juri has an idea. Some commands pop their windows in unexpected places anyway, so often have to resort to typing a same-window-prefix key before running such commands :-) > The attached diff should illustrate what I mean here. > [...] > +(defvar display-buffer--reuse-or-same-window-action > + '((display-buffer-reuse-window > + display-buffer-same-window) > + (inhibit-same-window . nil)) Shouldn't the first item be display-buffer--maybe-same-window before display-buffer-reuse-window? This is what is used by default in display-buffer-fallback-action, but it has a comment with a question, so probably it's really redundant: (defconst display-buffer-fallback-action '((display-buffer--maybe-same-window ;FIXME: why isn't this redundant? display-buffer-reuse-window > +(defun pop-to-buffer-reuse-or-same-window (buffer &optional norecord) > + "Select specified BUFFER in a window showing it or the same one. > +This is like `pop-to-buffer-same-window', but tries first to > +reuse a window already showing BUFFER and only if no such window > +exists behaves like `pop-to-buffer-same-window'." > + (pop-to-buffer buffer display-buffer--reuse-or-same-window-action norecord)) Grep counted 100 occurrences of pop-to-buffer-same-window in the source tree, but I guess only shell commands could use pop-to-buffer-reuse-or-same-window?