about summary refs log tree commit diff
path: root/exwm-workspace.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-02-28T12·03+0800
committerChris Feng <chris.w.feng@gmail.com>2016-02-28T12·03+0800
commit74555b25c2dccacd550762d339175494d3d78562 (patch)
treeb2a03503fa9676f05dd301fcb641cdd7cf4b8657 /exwm-workspace.el
parent74fba563b82c1a4d3a589c71041a5bf370709a9e (diff)
Simplify `exwm-workspace--display-buffer'
* exwm-workspace.el (exwm-workspace--display-buffer): Make it simpler and
more reliable.
Diffstat (limited to 'exwm-workspace.el')
-rw-r--r--exwm-workspace.el21
1 files changed, 5 insertions, 16 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 283b3849db..89bb6940b0 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -495,23 +495,12 @@ The optional FORCE option is for internal use only."
         (xcb:flush exwm--connection)))))
 
 (defun exwm-workspace--display-buffer (buffer alist)
-  "Display buffer in the current workspace frame.
-
-This functions is modified from `display-buffer-reuse-window' and
-`display-buffer-pop-up-window'."
+  "Display BUFFER as if the current workspace is selected."
+  ;; Only when the floating minibuffer frame is selected.
+  ;; This also protect this functions from being recursively called.
   (when (eq (selected-frame) exwm-workspace--minibuffer)
-    (setq buffer (get-buffer buffer))   ;convert string to buffer.
-    (let (window)
-      (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))))))
+    (with-selected-frame exwm-workspace--current
+      (display-buffer buffer alist))))
 
 (defun exwm-workspace--show-minibuffer ()
   "Show the minibuffer frame."