diff options
| author | Stephen Leake | 2015-07-29 18:30:36 -0500 |
|---|---|---|
| committer | Stephen Leake | 2015-07-29 18:30:36 -0500 |
| commit | 72fea2fac543558cd2c4bd55e6f714f9f43efbc3 (patch) | |
| tree | 9527af5fcfb321feec01771a2d9149a88261bffc | |
| parent | 11d40d38c809df93956b4dbad7a3be0722d066ff (diff) | |
| download | emacs-72fea2fac543558cd2c4bd55e6f714f9f43efbc3.tar.gz emacs-72fea2fac543558cd2c4bd55e6f714f9f43efbc3.zip | |
Add display-buffer action display-buffer-use-some-frame
* lisp/window.el (display-buffer-use-some-frame): new
| -rw-r--r-- | lisp/window.el | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lisp/window.el b/lisp/window.el index f15dd9b7355..986c55380d0 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -6488,6 +6488,39 @@ its documentation for additional customization information." | |||
| 6488 | 6488 | ||
| 6489 | ;;; `display-buffer' action functions: | 6489 | ;;; `display-buffer' action functions: |
| 6490 | 6490 | ||
| 6491 | (defun display-buffer-use-some-frame (buffer alist) | ||
| 6492 | "Display BUFFER in an existing frame other than the current frame. | ||
| 6493 | If successful, return the window used; otherwise return nil. | ||
| 6494 | |||
| 6495 | If ALIST has a non-nil `inhibit-switch-frame' entry, avoid | ||
| 6496 | raising the frame. | ||
| 6497 | |||
| 6498 | If ALIST has a non-nil `pop-up-frame-parameters' entry, the | ||
| 6499 | corresponding value is an alist of frame parameters to give the | ||
| 6500 | new frame. | ||
| 6501 | |||
| 6502 | If ALIST has a non-nil `frame-predicate' entry, the corresponding | ||
| 6503 | value is a function taking one argument (a frame), returning | ||
| 6504 | non-nil if the frame is a candidate." | ||
| 6505 | (let* ((predicate (or (cdr (assoc 'frame-predicate alist)) | ||
| 6506 | (lambda (frame) | ||
| 6507 | (and | ||
| 6508 | (not (eq frame (selected-frame))) | ||
| 6509 | (not (window-dedicated-p | ||
| 6510 | (or | ||
| 6511 | (get-lru-window frame) | ||
| 6512 | (frame-first-window frame))))) | ||
| 6513 | ))) | ||
| 6514 | (frame (car (filtered-frame-list predicate))) | ||
| 6515 | (window (and frame (get-lru-window frame)))) | ||
| 6516 | (when window | ||
| 6517 | (prog1 | ||
| 6518 | (window--display-buffer | ||
| 6519 | buffer window 'frame alist display-buffer-mark-dedicated) | ||
| 6520 | (unless (cdr (assq 'inhibit-switch-frame alist)) | ||
| 6521 | (window--maybe-raise-frame frame)))) | ||
| 6522 | )) | ||
| 6523 | |||
| 6491 | (defun display-buffer-same-window (buffer alist) | 6524 | (defun display-buffer-same-window (buffer alist) |
| 6492 | "Display BUFFER in the selected window. | 6525 | "Display BUFFER in the selected window. |
| 6493 | This fails if ALIST has a non-nil `inhibit-same-window' entry, or | 6526 | This fails if ALIST has a non-nil `inhibit-same-window' entry, or |