From 3f6c609a2b1580d77a9863e205718cbba3872bcb Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Sat, 10 Mar 2018 17:28:43 +0800 Subject: [PATCH] Fix regressions (exwm-init): Do not signal an error on startup. * exwm-floating.el (exwm-floating-toggle-floating): * exwm-input (exwm-input-send-next-key) (exwm-input-send-simulation-key): * exwm-layout (exwm-layout-set-fullscreen) (exwm-layout-unset-fullscreen, exwm-layout-toggle-fullscreen): Fix incorrect use of `cl-return-from'. --- exwm-floating.el | 2 +- exwm-input.el | 4 ++-- exwm-layout.el | 6 +++--- exwm.el | 10 ++++++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/exwm-floating.el b/exwm-floating.el index 8b1612e42..0210492b1 100644 --- a/exwm-floating.el +++ b/exwm-floating.el @@ -401,7 +401,7 @@ This is also used by X window containers.") "Toggle the current window between floating and non-floating states." (interactive) (unless (derived-mode-p 'exwm-mode) - (cl-return-from 'exwm-floating-toggle-floating)) + (cl-return-from exwm-floating-toggle-floating)) (with-current-buffer (window-buffer) (if exwm--floating-frame (exwm-floating--unset-floating exwm--id) diff --git a/exwm-input.el b/exwm-input.el index 6f96d7173..4c1ce00b1 100644 --- a/exwm-input.el +++ b/exwm-input.el @@ -745,7 +745,7 @@ EXWM will prompt for the key to send. This command can be prefixed to send multiple keys." (interactive "p") (unless (derived-mode-p 'exwm-mode) - (cl-return-from 'exwm-input-send-next-key)) + (cl-return-from exwm-input-send-next-key)) (when (> times 12) (setq times 12)) (let (key keys) (dotimes (i times) @@ -893,7 +893,7 @@ where both ORIGINAL-KEY and SIMULATED-KEY are key sequences." "Fake a key event according to the last input key sequence." (interactive "p") (unless (derived-mode-p 'exwm-mode) - (cl-return-from 'exwm-input-send-simulation-key)) + (cl-return-from exwm-input-send-simulation-key)) (let ((keys (gethash (this-single-command-keys) exwm-input--simulation-keys))) (dotimes (_ times) diff --git a/exwm-layout.el b/exwm-layout.el index 19d14d114..847dd3638 100644 --- a/exwm-layout.el +++ b/exwm-layout.el @@ -147,7 +147,7 @@ (interactive) (unless (and (or id (derived-mode-p 'exwm-mode)) (not (exwm-layout--fullscreen-p))) - (cl-return-from 'exwm-layout-set-fullscreen)) + (cl-return-from exwm-layout-set-fullscreen)) (with-current-buffer (if id (exwm--id->buffer id) (window-buffer)) ;; Expand the X window to fill the whole screen. (with-slots (x y width height) (exwm-workspace--get-geometry exwm--frame) @@ -174,7 +174,7 @@ (interactive) (unless (and (or id (derived-mode-p 'exwm-mode)) (exwm-layout--fullscreen-p)) - (cl-return-from 'exwm-layout-unset-fullscreen)) + (cl-return-from exwm-layout-unset-fullscreen)) (with-current-buffer (if id (exwm--id->buffer id) (window-buffer)) (setq exwm--ewmh-state (delq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)) @@ -200,7 +200,7 @@ "Toggle fullscreen mode." (interactive (list (exwm--buffer->id (window-buffer)))) (unless (or id (derived-mode-p 'exwm-mode)) - (cl-return-from 'exwm-layout-toggle-fullscreen)) + (cl-return-from exwm-layout-toggle-fullscreen)) (when id (with-current-buffer (exwm--id->buffer id) (if (exwm-layout--fullscreen-p) diff --git a/exwm.el b/exwm.el index 379500b41..359489ff3 100644 --- a/exwm.el +++ b/exwm.el @@ -757,7 +757,7 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'." (setq exwm--wmsn-window new-owner)))) ;;;###autoload -(defun exwm-init (&optional frame) +(cl-defun exwm-init (&optional frame) "Initialize EXWM." (interactive) (if frame @@ -765,9 +765,11 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'." (select-frame-set-input-focus frame) (setq frame (selected-frame))) (when (not (eq 'x (framep frame))) - (user-error "Not running under X environment")) + (message "[EXWM] Not running under X environment") + (cl-return-from exwm-init)) (when exwm--connection - (user-error "EXWM already running")) + (exwm--log "EXWM already running") + (cl-return-from exwm-init)) (condition-case err (progn (exwm-enable 'undo) ;never initialize again @@ -809,7 +811,7 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'." ((quit error) (exwm-exit) ;; Rethrow error - (signal (car err) (cdr err))))) + (warn "[EXWM] EXWM fails to start (%s: %s)" (car err) (cdr err))))) ;;;###autoload