Subject: bug#67249: 30.0.50; `same-frame` equivalent for `display-buffer-alist`

From: Stefan Monnier <[email-masked]>
Date: Fri, 24 Nov 2023 11:25:46 -0500

BTW, I just noticed another way to attack the problem, which is to add
a `pop-up-frames` argument which works just like the variable but takes
precedence over it, as in the PoC patch below (a real patch would
adjust other places where we use that variable, among other things).

WDYT?

        Stefan
diff --git a/lisp/window.el b/lisp/window.el
index 0c5ccf167dc..2b8c6483fe5 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8180,9 +8181,11 @@ 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)
+  (let* ((override (assq 'pop-up-frames alist))
+         (pop-up (if override (cdr override) pop-up-frames)))
+  (and (if (eq pop-up 'graphic-only)
 	   (display-graphic-p)
-	 pop-up-frames)
+	 pop-up)
        (display-buffer-pop-up-frame buffer alist)))
 
 (defun display-buffer--maybe-pop-up-window (buffer alist)