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-07-31T05·14+0800
committerChris Feng <chris.w.feng@gmail.com>2016-07-31T05·14+0800
commita3dba8edd9001e89e24c204b9186fdf8b444e78c (patch)
tree1862f4665fc293bf5c9b27d26dd8f0898867f878 /exwm-workspace.el
parent1e78045f958edbb2f3ef7c21953f8b55b3bbae42 (diff)
Fix restarting issues
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs):
* exwm.el (exwm-restart): Run `kill-emacs-hook' early; do not check for
X windows before restarting.
Diffstat (limited to 'exwm-workspace.el')
-rw-r--r--exwm-workspace.el15
1 files changed, 10 insertions, 5 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index b73059ab4d19..3e2fe1abb591 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -1039,12 +1039,17 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
 (declare-function exwm-manage--unmanage-window "exwm-manage.el")
 (declare-function exwm--exit "exwm.el")
 
-(defun exwm-workspace--confirm-kill-emacs (prompt)
+(defun exwm-workspace--confirm-kill-emacs (prompt &optional force)
   "Confirm before exiting Emacs."
-  (when (pcase (length exwm--id-buffer-alist)
-          (0 (y-or-n-p prompt))
-          (x (yes-or-no-p (format "[EXWM] %d window%s currently alive. %s"
-                                  x (if (= x 1) "" "s") prompt))))
+  (when (or (and force (not (eq force 'no-check)))
+            (and (or (eq force 'no-check) (not exwm--id-buffer-alist))
+                 (y-or-n-p prompt))
+            (yes-or-no-p (format "[EXWM] %d window(s) will be destroyed.  %s"
+                                 (length exwm--id-buffer-alist) prompt)))
+    ;; Run `kill-emacs-hook' before Emacs frames are unmapped so that
+    ;; errors can be visible.
+    (run-hooks 'kill-emacs-hook)
+    (setq kill-emacs-hook nil)
     ;; Hide & reparent out all frames (save-set can't be used here since
     ;; X windows will be re-mapped).
     (when (exwm-workspace--minibuffer-own-frame-p)