branch: externals/exwm
commit 450b69af60b3d8c7e4ce9ef73b95ad85667f0047
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>

    exwm--init: Make sure that exwm-wm-mode is disabled on error
    
    Throw an error when not running on X or if another window manager is 
detected.
    
    * exwm.el (exwm--init): Throw if not running on X, also handle user errors.
    (exwm--wmsn-acquire): Throw error if other WM is running and not replaced.
---
 exwm.el | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/exwm.el b/exwm.el
index 7c95e53654..eec4114359 100644
--- a/exwm.el
+++ b/exwm.el
@@ -847,7 +847,7 @@ manager.  If t, replace it, if nil, abort and ask the user 
if `ask'."
       (when (eq replace 'ask)
         (setq replace (yes-or-no-p "Replace existing window manager? ")))
       (unless replace
-        (user-error "Other window manager detected")))
+        (error "Other window manager detected")))
     (let ((new-owner (xcb:generate-id exwm--connection)))
       (xcb:+request exwm--connection
           (make-instance 'xcb:CreateWindow
@@ -915,13 +915,12 @@ FRAME, if given, indicates the X display EXWM should 
manage."
   (exwm--log "%s" frame)
   (cl-assert (not exwm--connection))
   (setq frame (or frame (exwm--find-x-frame)))
-  (unless (eq 'x (framep frame))
-    (message "[EXWM] Not running under X environment")
-    (cl-return-from exwm--init))
   ;; The frame might not be selected if it's created by emacsclient.
   (select-frame-set-input-focus frame)
   (condition-case err
       (progn
+        (unless (eq 'x (framep frame))
+          (error "Not running under X environment"))
         ;; Never initialize again
         (remove-hook 'window-setup-hook #'exwm--init)
         (remove-hook 'after-make-frame-functions #'exwm--init)
@@ -977,7 +976,6 @@ FRAME, if given, indicates the X display EXWM should 
manage."
         (run-hooks 'exwm-init-hook)
         ;; Manage existing windows
         (exwm-manage--scan))
-    (user-error)
     ((quit error)
      (exwm-wm-mode -1)
      ;; Rethrow error

Reply via email to