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, 03 Dec 2023 14:06:53 -0500 Message-ID: References: <159cd3c2-a0c4-63e2-ebb2-ce0f5f8c343e@gmx.at> <69e6899b-9e93-9a97-a8bc-4ce9a9f0ae4c@gmx.at> <69387717-1eaa-6019-0000-4c95c61e1bc3@gmx.at> <1f026837-af56-435f-9d4e-048a18af07eb@gmx.at> <488b181f-c74e-d97b-b168-a602158c3e7b@gmx.at> <47d97021-75ea-cfc7-d439-cc38bc1044f4@gmx.at> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32794"; 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 Dec 03 20:08:03 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 1r9rov-0008ES-DO for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Dec 2023 20:08:01 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r9rop-0000Dd-2G; Sun, 03 Dec 2023 14:07:55 -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 1r9rom-0000D1-MG for bug-gnu-emacs@gnu.org; Sun, 03 Dec 2023 14:07:53 -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 1r9rom-0002Ed-EQ for bug-gnu-emacs@gnu.org; Sun, 03 Dec 2023 14:07:52 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r9row-0004Ng-GF for bug-gnu-emacs@gnu.org; Sun, 03 Dec 2023 14:08: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, 03 Dec 2023 19:08: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.170163043516768 (code B ref 67249); Sun, 03 Dec 2023 19:08:02 +0000 Original-Received: (at 67249) by debbugs.gnu.org; 3 Dec 2023 19:07:15 +0000 Original-Received: from localhost ([127.0.0.1]:32776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9roA-0004MN-Ek for submit@debbugs.gnu.org; Sun, 03 Dec 2023 14:07:14 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:18687) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9ro7-0004M9-F1 for 67249@debbugs.gnu.org; Sun, 03 Dec 2023 14:07:13 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 711A41000AD; Sun, 3 Dec 2023 14:06:55 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1701630414; bh=90HVVwx6RtfbrbytfrKGLGTKomb6glMHXpv37u2Wxws=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=JK/ClDZFjz2chUL+9n3dPIvcD5SI+hHSY4GpwNAjeeAbO6vRJwTJLcqTyxfygjOhE 8TENs6kDeaaoouXh4zZBzeQuUqw0ryLnLrx6y3A/uhH/ERPxoQ2edsff/XtKVPJOis v2uxQdjhNeC+A39/+y43KDHpZGbinjpzvSMvkgOwInEU6SSONHrbJSltGjlLfWqvHv uQAcbkWi+YuyaUqOPtOEhK+7QM6H3MCIQfHGjozlq3YXDtR+P4ZYsedaXpTAkkQF/5 zdaUvuda4Z38EED33oD/cRurshSXc55314q01Jxqee7T0hKMbO5pe8jWFYnZ8SBsvZ L3Tcktjxf3H3g== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 9AAFC100043; Sun, 3 Dec 2023 14:06:54 -0500 (EST) Original-Received: from alfajor (unknown [45.72.194.97]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 73BF51203E4; Sun, 3 Dec 2023 14:06:54 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Sat, 25 Nov 2023 09:36:05 -0500") 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:275447 Archived-At: --=-=-= Content-Type: text/plain > I'm leaning towards `pop-up-frames` right now because it avoids > introducing a new notion. Admittedly, the notion it reuses > (i.e. `pop-up-frames`) is not the cleanest around, but > `inhibit-new-frame` isn't super clean either. > > Can someone help me choose between those two bad choices? FWIW, here's my current patch. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=pop-up-frames.patch diff --git a/lisp/window.el b/lisp/window.el index fbdcd611068..58e77745280 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -6862,6 +6862,7 @@ special-display-popup-frame If ARGS is a list whose car is a symbol, use (car ARGS) as a function to do the work. Pass it BUFFER as first argument, and pass the elements of (cdr ARGS) as the remaining arguments." + (declare (obsolete display-buffer-pop-up-frame "30.1")) (if (and args (symbolp (car args))) (apply (car args) buffer (cdr args)) (let ((window (get-buffer-window buffer 0))) @@ -6881,9 +6882,8 @@ special-display-popup-frame ;; Stay on the same frame if requested. (when (or (cdr (assq 'same-frame args)) (cdr (assq 'same-window args))) (let* ((pop-up-windows t) - pop-up-frames special-display-buffer-names special-display-regexps) - (display-buffer buffer))) + (display-buffer buffer '((pop-up-frames . nil))))) ;; If no window yet, make one in a new frame. (let* ((frame (with-current-buffer buffer @@ -6996,6 +6996,13 @@ pop-up-frames (const :tag "Always" t)) :group 'windows) +(defun window--pop-up-frames (&optional alist) + (let* ((override (assq 'pop-up-frames alist)) + (pop-up (if override (cdr overriding) pop-up-frames))) + (if (eq pop-up 'graphic-only) + (display-graphic-p) + pop-up))) + (defcustom display-buffer-reuse-frames nil "Non-nil means `display-buffer' should reuse frames. If the buffer in question is already displayed in a frame, raise @@ -7830,12 +7837,12 @@ display-buffer user-action special-action action extra-action display-buffer-base-action display-buffer-fallback-action)) - (functions (apply 'append + (functions (apply #'append (mapcar (lambda (x) (setq x (car x)) (if (functionp x) (list x) x)) actions))) - (alist (apply 'append (mapcar 'cdr actions))) + (alist (apply #'append (mapcar #'cdr actions))) window) (unless (buffer-live-p buffer) (error "Invalid buffer")) @@ -7978,9 +7985,7 @@ display-buffer-reuse-window indirectly called by the latter." (let* ((alist-entry (assq 'reusable-frames alist)) (frames (cond (alist-entry (cdr alist-entry)) - ((if (eq pop-up-frames 'graphic-only) - (display-graphic-p) - pop-up-frames) + ((window--pop-up-frames alist) 0) (display-buffer-reuse-frames 0) (t (last-nonminibuffer-frame)))) @@ -8034,9 +8039,7 @@ display-buffer-reuse-mode-window (let* ((alist-entry (assq 'reusable-frames alist)) (alist-mode-entry (assq 'mode alist)) (frames (cond (alist-entry (cdr alist-entry)) - ((if (eq pop-up-frames 'graphic-only) - (display-graphic-p) - pop-up-frames) + ((window--pop-up-frames alist) 0) (display-buffer-reuse-frames 0) (t (last-nonminibuffer-frame)))) @@ -8182,9 +8185,7 @@ display-buffer--maybe-pop-up-frame ALIST is an association list of action symbols and values. See Info node `(elisp) Buffer Display Action Alists' for details of such alists." - (and (if (eq pop-up-frames 'graphic-only) - (display-graphic-p) - pop-up-frames) + (and (window--pop-up-frames alist) (display-buffer-pop-up-frame buffer alist))) (defun display-buffer--maybe-pop-up-window (buffer alist) @@ -8548,9 +8549,7 @@ display-buffer-in-previous-window (cdr (assq 'inhibit-same-window alist))) (frames (cond (alist-entry (cdr alist-entry)) - ((if (eq pop-up-frames 'graphic-only) - (display-graphic-p) - pop-up-frames) + ((window--pop-up-frames alist) 0) (display-buffer-reuse-frames 0) (t (last-nonminibuffer-frame)))) --=-=-=--