mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-27 14:57:59 +01:00
Simplify `exwm-workspace--display-buffer'
* exwm-workspace.el (exwm-workspace--display-buffer): Make it simpler and more reliable.
This commit is contained in:
parent
74fba563b8
commit
74555b25c2
1 changed files with 5 additions and 16 deletions
|
@ -495,23 +495,12 @@ The optional FORCE option is for internal use only."
|
||||||
(xcb:flush exwm--connection)))))
|
(xcb:flush exwm--connection)))))
|
||||||
|
|
||||||
(defun exwm-workspace--display-buffer (buffer alist)
|
(defun exwm-workspace--display-buffer (buffer alist)
|
||||||
"Display buffer in the current workspace frame.
|
"Display BUFFER as if the current workspace is selected."
|
||||||
|
;; Only when the floating minibuffer frame is selected.
|
||||||
This functions is modified from `display-buffer-reuse-window' and
|
;; This also protect this functions from being recursively called.
|
||||||
`display-buffer-pop-up-window'."
|
|
||||||
(when (eq (selected-frame) exwm-workspace--minibuffer)
|
(when (eq (selected-frame) exwm-workspace--minibuffer)
|
||||||
(setq buffer (get-buffer buffer)) ;convert string to buffer.
|
(with-selected-frame exwm-workspace--current
|
||||||
(let (window)
|
(display-buffer buffer alist))))
|
||||||
(if (setq window (get-buffer-window buffer exwm-workspace--current))
|
|
||||||
(window--display-buffer buffer window 'reuse alist)
|
|
||||||
(when (setq window (or (window--try-to-split-window
|
|
||||||
(get-largest-window exwm-workspace--current t)
|
|
||||||
alist)
|
|
||||||
(window--try-to-split-window
|
|
||||||
(get-lru-window exwm-workspace--current t)
|
|
||||||
alist)))
|
|
||||||
(window--display-buffer
|
|
||||||
buffer window 'window alist display-buffer-mark-dedicated))))))
|
|
||||||
|
|
||||||
(defun exwm-workspace--show-minibuffer ()
|
(defun exwm-workspace--show-minibuffer ()
|
||||||
"Show the minibuffer frame."
|
"Show the minibuffer frame."
|
||||||
|
|
Loading…
Reference in a new issue