|
|
|
|
@ -266,6 +266,61 @@ |
|
|
|
|
#+begin_src emacs-lisp |
|
|
|
|
(setq switch-to-buffer-obey-display-actions t) |
|
|
|
|
#+end_src |
|
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp |
|
|
|
|
;; TODO the docstring needs to be updated |
|
|
|
|
(defun display-buffer-reuse-maybe-some-frame (buffer alist) |
|
|
|
|
"Display BUFFER in an existing frame that meets a predicate. |
|
|
|
|
The default predicate is to use any frame other than the selected |
|
|
|
|
frame. If successful, return the window used; otherwise return |
|
|
|
|
nil. |
|
|
|
|
|
|
|
|
|
ALIST is an association list of action symbols and values. See |
|
|
|
|
Info node `(elisp) Buffer Display Action Alists' for details of |
|
|
|
|
such alists. |
|
|
|
|
|
|
|
|
|
If ALIST has a non-nil `inhibit-switch-frame' entry, avoid |
|
|
|
|
raising the frame. If it 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. If ALIST has a non-nil `inhibit-same-window' |
|
|
|
|
entry, avoid using the currently selected window (only useful |
|
|
|
|
with a frame-predicate that allows using the selected frame). |
|
|
|
|
|
|
|
|
|
This is an action function for buffer display, see Info |
|
|
|
|
node `(elisp) Buffer Display Action Functions'. It should be |
|
|
|
|
called only by `display-buffer' or a function directly or |
|
|
|
|
indirectly called by the latter." |
|
|
|
|
(let* ((predicate |
|
|
|
|
(or (cdr (assq 'frame-predicate alist)) |
|
|
|
|
(lambda (frame) |
|
|
|
|
(and (not (eq frame (selected-frame))) |
|
|
|
|
(get-lru-window frame))))) |
|
|
|
|
(frames (-filter predicate (frame-list-z-order))) |
|
|
|
|
;; now frames contain all frame candidates in z-order |
|
|
|
|
(frame (car frames)) |
|
|
|
|
(window |
|
|
|
|
(and frame |
|
|
|
|
(or |
|
|
|
|
(car (get-buffer-window-list buffer 'nomini frame)) |
|
|
|
|
(get-lru-window |
|
|
|
|
frame nil (cdr (assq 'inhibit-same-window alist))))))) |
|
|
|
|
(when window |
|
|
|
|
(prog1 |
|
|
|
|
(window--display-buffer buffer window 'reuse alist) |
|
|
|
|
(unless (cdr (assq 'inhibit-switch-frame alist)) |
|
|
|
|
(window--maybe-raise-frame frame)))))) |
|
|
|
|
|
|
|
|
|
(defun frame-good-for-editing-p (frame) |
|
|
|
|
(not (string-match "DP-[36]" (cdr (assoc 'name (frame-monitor-attributes frame)))))) |
|
|
|
|
|
|
|
|
|
;(pop display-buffer-alist) |
|
|
|
|
(add-to-list 'display-buffer-alist |
|
|
|
|
'(".*.tex" |
|
|
|
|
display-buffer-reuse-maybe-some-frame |
|
|
|
|
(frame-predicate . frame-good-for-editing-p))) |
|
|
|
|
|
|
|
|
|
#+end_src |
|
|
|
|
First, treat ~mu4e-headers~ properly |
|
|
|
|
#+begin_src emacs-lisp |
|
|
|
|
(add-to-list 'display-buffer-alist |
|
|
|
|
|