about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-10-27T12·24+0800
committerChris Feng <chris.w.feng@gmail.com>2015-10-27T12·26+0800
commitba536bb6e354577cd69926865aee0e6f90f7306a (patch)
tree4aaf994d5267b0f96464a13a09abcaf87b4df764
parentd05df51b0563b385da46384901c73daa073c28b9 (diff)
Delay closing minibuffer
* exwm-workspace.el (exwm-workspace-switch, exwm-workspace--on-focus-in):
  Delay closing minibuffer until Emacs is idle. This prevent nonlocal exits
  from interrupting remaining code.
-rw-r--r--exwm-workspace.el5
1 files changed, 2 insertions, 3 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 8000b0ba7fcb..d1fe6cf38161 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -139,7 +139,8 @@ The optional FORCE option is for internal use only."
                     y (/ h 2)))
             (set-mouse-pixel-position frame x y)))
         ;; Close the (possible) active minibuffer
-        (when (active-minibuffer-window) (abort-recursive-edit))
+        (when (active-minibuffer-window)
+          (run-with-idle-timer 0 nil (lambda () (abort-recursive-edit))))
         (setq default-minibuffer-frame frame)
         ;; Hide windows in other workspaces by preprending a space
         (unless exwm-workspace-show-all-buffers
@@ -168,8 +169,6 @@ The optional FORCE option is for internal use only."
       (exwm--log "Focus on workspace %s" index)
       (when (and index (/= index exwm-workspace-current-index))
         (exwm--log "Workspace was switched unexpectedly")
-        ;; Close the (possible) active minibuffer
-        (when (active-minibuffer-window) (abort-recursive-edit))
         (exwm-workspace-switch index)))))
 
 ;;;###autoload