about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdrián Medraño Calvo <adrian@medranocalvo.com>2023-10-06T00·00+0000
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2023-10-06T00·00+0000
commit56db521a3ed6a2ccc1193110a56545a1992e9654 (patch)
tree6ca280760bf878d3846df8e7b380c714f97a2270
parent86f43494ebd056cd732fb1d10d440e0eba547228 (diff)
parent31f0f0a9c7b8e1b7edf0309fc523d67ec90874f2 (diff)
Merge branch 'arnebab.github.com/master' into externals/exwm
-rw-r--r--exwm-input.el22
1 files changed, 20 insertions, 2 deletions
diff --git a/exwm-input.el b/exwm-input.el
index be3e8f465f71..05b021093c20 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -668,8 +668,26 @@ Current buffer must be an `exwm-mode' buffer."
 (defun exwm-input--fake-last-command ()
   "Fool some packages into thinking there is a change in the buffer."
   (setq last-command #'exwm-input--noop)
-  (run-hooks 'pre-command-hook)
-  (run-hooks 'post-command-hook))
+  ;; The Emacs manual says:
+  ;; > Quitting is suppressed while running pre-command-hook and
+  ;; > post-command-hook. If an error happens while executing one of these
+  ;; > hooks, it does not terminate execution of the hook; instead the error is
+  ;; > silenced and the function in which the error occurred is removed from the
+  ;; > hook.
+  ;; We supress errors but neither continue execution nor we remove from the
+  ;; hook.
+  (condition-case err
+      (run-hooks 'pre-command-hook)
+    ((error)
+     (exwm--log "Error occurred while running pre-command-hook: %s"
+                (error-message-string err))
+     (xcb-debug:backtrace)))
+  (condition-case err
+      (run-hooks 'post-command-hook)
+    ((error)
+     (exwm--log "Error occurred while running post-command-hook: %s"
+                (error-message-string err))
+     (xcb-debug:backtrace))))
 
 (defun exwm-input--on-KeyPress-line-mode (key-press raw-data)
   "Parse X KeyPress event to Emacs key event and then feed the command loop."