Remove exwm-input--during-command logic (#94)

`exwm-input--duration-command' isn't reliably unset when exiting
commands initiated by emacsclient causing Emacs to swallow one key
press. See ch11ng/exwm#253 and emacs-exwm/exwm#93.

However, `exwm-input--duration-command' appears to be no longer
necessary now that bind `exwm-input-line-mode-passthrough' around all
input commands (via advice).

fixes #93

* exwm-core.el (exwm--kmacro-map): remove obsolete comment.
* exwm-input.el (exwm-input--during-command): Remove variable.
(exwm-input--event-passthrough-p): Remove reference to variable.
(exwm-input-pre-post-command-blacklist): Remove newly unused option.
(exwm-input--on-pre-command, exwm-input--on-post-command): Remove hooks.
(exwm-input--init, exwm-input--exit): Remove references to the above
hooks.
* exwm-workspace.el (exwm-input--during-command): Remove reference to
removed variable.
(exwm-workspace--on-echo-area-dirty): Use real-this-command to detect
in-progress commands.
This commit is contained in:
Steven Allen 2024-12-16 01:30:18 +00:00 committed by GitHub
parent 369b4171e8
commit 9f310dd5c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 29 deletions

View file

@ -306,7 +306,6 @@ One of `line-mode' or `char-mode'.")
(interactive) (interactive)
(cond (cond
((or exwm-input-line-mode-passthrough ((or exwm-input-line-mode-passthrough
;; Do not test `exwm-input--during-command'.
(active-minibuffer-window) (active-minibuffer-window)
(memq last-input-event exwm-input--global-prefix-keys) (memq last-input-event exwm-input--global-prefix-keys)
(memq last-input-event exwm-input-prefix-keys) (memq last-input-event exwm-input-prefix-keys)

View file

@ -107,9 +107,6 @@ defined in `exwm-mode-map' here."
read-event) read-event)
"Low-level read functions that must be exempted from EXWM input handling.") "Low-level read functions that must be exempted from EXWM input handling.")
(defvar exwm-input--during-command nil
"Indicate whether between `pre-command-hook' and `post-command-hook'.")
(defvar exwm-input--global-keys nil "Global key bindings.") (defvar exwm-input--global-keys nil "Global key bindings.")
(defvar exwm-input--global-prefix-keys nil (defvar exwm-input--global-prefix-keys nil
@ -645,7 +642,6 @@ When non-nil, TEMP-LINE-MODE temporarily puts the window in line mode."
"Whether EVENT should be passed to Emacs. "Whether EVENT should be passed to Emacs.
Current buffer must be an `exwm-mode' buffer." Current buffer must be an `exwm-mode' buffer."
(or exwm-input-line-mode-passthrough (or exwm-input-line-mode-passthrough
exwm-input--during-command
;; Forward the event when there is an incomplete key ;; Forward the event when there is an incomplete key
;; sequence or when the minibuffer is active. ;; sequence or when the minibuffer is active.
exwm-input--line-mode-cache exwm-input--line-mode-cache
@ -1015,12 +1011,6 @@ Notes:
(set symbol value) (set symbol value)
(exwm-input--set-simulation-keys value))) (exwm-input--set-simulation-keys value)))
(defcustom exwm-input-pre-post-command-blacklist '(exit-minibuffer
abort-recursive-edit
minibuffer-keyboard-quit)
"Commands impossible to detect with `post-command-hook'."
:type '(repeat function))
(cl-defun exwm-input--read-keys (prompt stop-key) (cl-defun exwm-input--read-keys (prompt stop-key)
"Read keys with PROMPT until STOP-KEY pressed." "Read keys with PROMPT until STOP-KEY pressed."
(let ((cursor-in-echo-area t) (let ((cursor-in-echo-area t)
@ -1106,17 +1096,6 @@ One use is to access the keymap bound to KEYS (as prefix keys) in `char-mode'."
(exwm-input--unread-event key)) (exwm-input--unread-event key))
',(listify-key-sequence keys))))) ',(listify-key-sequence keys)))))
(defun exwm-input--on-pre-command ()
"Run in `pre-command-hook'."
(unless (or (eq this-command #'exwm-input--noop)
(memq this-command exwm-input-pre-post-command-blacklist))
(setq exwm-input--during-command t)))
(defun exwm-input--on-post-command ()
"Run in `post-command-hook'."
(unless (eq this-command #'exwm-input--noop)
(setq exwm-input--during-command nil)))
(defun exwm-input--on-minibuffer-setup () (defun exwm-input--on-minibuffer-setup ()
"Run in `minibuffer-setup-hook' to grab keyboard if necessary." "Run in `minibuffer-setup-hook' to grab keyboard if necessary."
(let* ((window (or (minibuffer-selected-window) ; minibuffer-setup-hook (let* ((window (or (minibuffer-selected-window) ; minibuffer-setup-hook
@ -1205,9 +1184,6 @@ One use is to access the keymap bound to KEYS (as prefix keys) in `char-mode'."
(when mouse-autoselect-window (when mouse-autoselect-window
(xcb:+event exwm--connection 'xcb:EnterNotify (xcb:+event exwm--connection 'xcb:EnterNotify
#'exwm-input--on-EnterNotify)) #'exwm-input--on-EnterNotify))
;; Control `exwm-input--during-command'
(add-hook 'pre-command-hook #'exwm-input--on-pre-command)
(add-hook 'post-command-hook #'exwm-input--on-post-command)
;; Grab/Release keyboard when minibuffer/echo becomes active/inactive. ;; Grab/Release keyboard when minibuffer/echo becomes active/inactive.
(add-hook 'minibuffer-setup-hook #'exwm-input--on-minibuffer-setup) (add-hook 'minibuffer-setup-hook #'exwm-input--on-minibuffer-setup)
(add-hook 'minibuffer-exit-hook #'exwm-input--on-minibuffer-exit) (add-hook 'minibuffer-exit-hook #'exwm-input--on-minibuffer-exit)
@ -1231,8 +1207,6 @@ One use is to access the keymap bound to KEYS (as prefix keys) in `char-mode'."
(dolist (fun exwm-input--passthrough-functions) (dolist (fun exwm-input--passthrough-functions)
(advice-remove fun #'exwm-input--call-with-passthrough)) (advice-remove fun #'exwm-input--call-with-passthrough))
(exwm-input--unset-simulation-keys) (exwm-input--unset-simulation-keys)
(remove-hook 'pre-command-hook #'exwm-input--on-pre-command)
(remove-hook 'post-command-hook #'exwm-input--on-post-command)
(remove-hook 'minibuffer-setup-hook #'exwm-input--on-minibuffer-setup) (remove-hook 'minibuffer-setup-hook #'exwm-input--on-minibuffer-setup)
(remove-hook 'minibuffer-exit-hook #'exwm-input--on-minibuffer-exit) (remove-hook 'minibuffer-exit-hook #'exwm-input--on-minibuffer-exit)
(when exwm-input--echo-area-timer (when exwm-input--echo-area-timer

View file

@ -134,7 +134,6 @@ Please manually run the hook `exwm-workspace-list-change-hook' afterwards.")
(defvar exwm-workspace--window-y-offset 0 (defvar exwm-workspace--window-y-offset 0
"Offset between Emacs first window & outer frame in Y.") "Offset between Emacs first window & outer frame in Y.")
(defvar exwm-input--during-command)
(defvar exwm-input--event-hook) (defvar exwm-input--event-hook)
(defvar exwm-layout-show-all-buffers) (defvar exwm-layout-show-all-buffers)
(defvar exwm-manage--desktop) (defvar exwm-manage--desktop)
@ -1284,7 +1283,7 @@ ALIST is an action alist, as accepted by function `display-buffer'."
(exwm-workspace--update-minibuffer-height t) (exwm-workspace--update-minibuffer-height t)
(exwm-workspace--show-minibuffer) (exwm-workspace--show-minibuffer)
(unless (or (not exwm-workspace-display-echo-area-timeout) (unless (or (not exwm-workspace-display-echo-area-timeout)
exwm-input--during-command ;e.g. read-event real-this-command ;e.g. read-event
input-method-use-echo-area) input-method-use-echo-area)
(setq exwm-workspace--display-echo-area-timer (setq exwm-workspace--display-echo-area-timer
(run-with-timer exwm-workspace-display-echo-area-timeout nil (run-with-timer exwm-workspace-display-echo-area-timeout nil