]> code.delx.au - gnu-emacs/commitdiff
Add support for 'inhibit-same-window in 'display-buffer-use-some-frame'
authorStephen Leake <stephen_leake@stephe-leake.org>
Fri, 7 Aug 2015 15:03:59 +0000 (10:03 -0500)
committerStephen Leake <stephen_leake@stephe-leake.org>
Fri, 7 Aug 2015 15:03:59 +0000 (10:03 -0500)
* lisp/window.el (display-buffer-use-some-frame): Add support for
'inhibit-same-window in alist.

* doc/windows.texi (display-buffer-use-some-frame): Doc support for
'inhibit-same-window in alist.

doc/lispref/windows.texi
lisp/window.el

index 41f02aabaa8f52aca6cd7aa8702a4c67f0641144..ccfe7ffb7bc6dcbcec44417fe5243081dfb5a168 100644 (file)
@@ -2306,16 +2306,18 @@ This function tries to ``display'' @var{buffer} by trying to find a
 frame that meets a predicate (by default any frame other than the
 current frame).
 
-If @var{alist} has a non-@code{nil} @code{`inhibit-switch-frame} entry,
-avoid raising the frame.
+If this function chooses a window on another frame, it makes that frame
+visible and, unless @var{alist} contains an @code{inhibit-switch-frame}
+entry (@pxref{Choosing Window Options}), raises that frame if necessary.
 
 If @var{alist} has a non-nil @code{frame-predicate} entry, its value is a
 function taking one argument (a frame), returning non-nil if the
 frame is a candidate; this function replaces the default predicate.
 
-If this function chooses a window on another frame, it makes that frame
-visible and, unless @var{alist} contains an @code{inhibit-switch-frame}
-entry (@pxref{Choosing Window Options}), raises that frame if necessary.
+If @var{alist} has a non-@code{nil} @code{inhibit-same-window} entry,
+the selected window is used; thus if the selected frame has a single
+window, it is not used.
+
 @end defun
 
 @defun display-buffer-pop-up-window buffer alist
index 238e53ca76a900e12cdbdd4d861b87c5918b7474..22fcd981e18eede0a29bdc61bc5367398bec9504 100644 (file)
@@ -1,4 +1,4 @@
-;;; window.el --- GNU Emacs window commands aside from those written in C
+e;;; window.el --- GNU Emacs window commands aside from those written in C
 
 ;; Copyright (C) 1985, 1989, 1992-1994, 2000-2015 Free Software
 ;; Foundation, Inc.
@@ -6490,7 +6490,7 @@ its documentation for additional customization information."
 
 (defun display-buffer-use-some-frame (buffer alist)
   "Display BUFFER in an existing frame that meets a predicate
-(by default any frame other than the current frame).  If
+\(by default any frame other than the current frame).  If
 successful, return the window used; otherwise return nil.
 
 If ALIST has a non-nil `inhibit-switch-frame' entry, avoid
@@ -6499,8 +6499,12 @@ raising the frame.
 If ALIST has a non-nil `frame-predicate' entry, its value is a
 function taking one argument (a frame), returning non-nil if the
 frame is a candidate; this function replaces the default
-predicate."
-  (let* ((predicate (or (cdr (assoc 'frame-predicate alist))
+predicate.
+
+If ALIST has a non-nil `inhibit-same-window' entry, avoid using
+the currently selected window (only useful with a frame-predicate
+that allows the selected frame)."
+  (let* ((predicate (or (cdr (assq 'frame-predicate alist))
                         (lambda (frame)
                           (and
                            (not (eq frame (selected-frame)))
@@ -6510,7 +6514,7 @@ predicate."
                                   (frame-first-window frame)))))
                           )))
          (frame (car (filtered-frame-list predicate)))
-         (window (and frame (get-lru-window frame))))
+         (window (and frame (get-lru-window frame nil (cdr (assq 'inhibit-same-window alist))))))
     (when window
       (prog1
           (window--display-buffer