diff options
| author | Stephen Leake | 2015-08-07 10:03:59 -0500 |
|---|---|---|
| committer | Stephen Leake | 2015-08-07 10:03:59 -0500 |
| commit | 4daa09e499b10e6250302341027e39ff5242fa04 (patch) | |
| tree | e1bd561adb08566bbff8de1c5ba27b821c613192 | |
| parent | 701484d524835e3461f521138399893366229ae5 (diff) | |
| download | emacs-4daa09e499b10e6250302341027e39ff5242fa04.tar.gz emacs-4daa09e499b10e6250302341027e39ff5242fa04.zip | |
Add support for 'inhibit-same-window in 'display-buffer-use-some-frame'
* 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.
| -rw-r--r-- | doc/lispref/windows.texi | 12 | ||||
| -rw-r--r-- | lisp/window.el | 14 |
2 files changed, 16 insertions, 10 deletions
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 41f02aabaa8..ccfe7ffb7bc 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -2306,16 +2306,18 @@ This function tries to ``display'' @var{buffer} by trying to find a | |||
| 2306 | frame that meets a predicate (by default any frame other than the | 2306 | frame that meets a predicate (by default any frame other than the |
| 2307 | current frame). | 2307 | current frame). |
| 2308 | 2308 | ||
| 2309 | If @var{alist} has a non-@code{nil} @code{`inhibit-switch-frame} entry, | 2309 | If this function chooses a window on another frame, it makes that frame |
| 2310 | avoid raising the frame. | 2310 | visible and, unless @var{alist} contains an @code{inhibit-switch-frame} |
| 2311 | entry (@pxref{Choosing Window Options}), raises that frame if necessary. | ||
| 2311 | 2312 | ||
| 2312 | If @var{alist} has a non-nil @code{frame-predicate} entry, its value is a | 2313 | If @var{alist} has a non-nil @code{frame-predicate} entry, its value is a |
| 2313 | function taking one argument (a frame), returning non-nil if the | 2314 | function taking one argument (a frame), returning non-nil if the |
| 2314 | frame is a candidate; this function replaces the default predicate. | 2315 | frame is a candidate; this function replaces the default predicate. |
| 2315 | 2316 | ||
| 2316 | If this function chooses a window on another frame, it makes that frame | 2317 | If @var{alist} has a non-@code{nil} @code{inhibit-same-window} entry, |
| 2317 | visible and, unless @var{alist} contains an @code{inhibit-switch-frame} | 2318 | the selected window is used; thus if the selected frame has a single |
| 2318 | entry (@pxref{Choosing Window Options}), raises that frame if necessary. | 2319 | window, it is not used. |
| 2320 | |||
| 2319 | @end defun | 2321 | @end defun |
| 2320 | 2322 | ||
| 2321 | @defun display-buffer-pop-up-window buffer alist | 2323 | @defun display-buffer-pop-up-window buffer alist |
diff --git a/lisp/window.el b/lisp/window.el index 238e53ca76a..22fcd981e18 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; window.el --- GNU Emacs window commands aside from those written in C | 1 | e;;; window.el --- GNU Emacs window commands aside from those written in C |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1989, 1992-1994, 2000-2015 Free Software | 3 | ;; Copyright (C) 1985, 1989, 1992-1994, 2000-2015 Free Software |
| 4 | ;; Foundation, Inc. | 4 | ;; Foundation, Inc. |
| @@ -6490,7 +6490,7 @@ its documentation for additional customization information." | |||
| 6490 | 6490 | ||
| 6491 | (defun display-buffer-use-some-frame (buffer alist) | 6491 | (defun display-buffer-use-some-frame (buffer alist) |
| 6492 | "Display BUFFER in an existing frame that meets a predicate | 6492 | "Display BUFFER in an existing frame that meets a predicate |
| 6493 | (by default any frame other than the current frame). If | 6493 | \(by default any frame other than the current frame). If |
| 6494 | successful, return the window used; otherwise return nil. | 6494 | successful, return the window used; otherwise return nil. |
| 6495 | 6495 | ||
| 6496 | If ALIST has a non-nil `inhibit-switch-frame' entry, avoid | 6496 | If ALIST has a non-nil `inhibit-switch-frame' entry, avoid |
| @@ -6499,8 +6499,12 @@ raising the frame. | |||
| 6499 | If ALIST has a non-nil `frame-predicate' entry, its value is a | 6499 | If ALIST has a non-nil `frame-predicate' entry, its value is a |
| 6500 | function taking one argument (a frame), returning non-nil if the | 6500 | function taking one argument (a frame), returning non-nil if the |
| 6501 | frame is a candidate; this function replaces the default | 6501 | frame is a candidate; this function replaces the default |
| 6502 | predicate." | 6502 | predicate. |
| 6503 | (let* ((predicate (or (cdr (assoc 'frame-predicate alist)) | 6503 | |
| 6504 | If ALIST has a non-nil `inhibit-same-window' entry, avoid using | ||
| 6505 | the currently selected window (only useful with a frame-predicate | ||
| 6506 | that allows the selected frame)." | ||
| 6507 | (let* ((predicate (or (cdr (assq 'frame-predicate alist)) | ||
| 6504 | (lambda (frame) | 6508 | (lambda (frame) |
| 6505 | (and | 6509 | (and |
| 6506 | (not (eq frame (selected-frame))) | 6510 | (not (eq frame (selected-frame))) |
| @@ -6510,7 +6514,7 @@ predicate." | |||
| 6510 | (frame-first-window frame))))) | 6514 | (frame-first-window frame))))) |
| 6511 | ))) | 6515 | ))) |
| 6512 | (frame (car (filtered-frame-list predicate))) | 6516 | (frame (car (filtered-frame-list predicate))) |
| 6513 | (window (and frame (get-lru-window frame)))) | 6517 | (window (and frame (get-lru-window frame nil (cdr (assq 'inhibit-same-window alist)))))) |
| 6514 | (when window | 6518 | (when window |
| 6515 | (prog1 | 6519 | (prog1 |
| 6516 | (window--display-buffer | 6520 | (window--display-buffer |