branch: externals/exwm
commit 9f310dd5c16efde6f77986674768abd1ae994d72
Author: Steven Allen <ste...@stebalien.com>
Commit: GitHub <nore...@github.com>

    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.
---
 exwm-core.el      |  1 -
 exwm-input.el     | 26 --------------------------
 exwm-workspace.el |  3 +--
 3 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/exwm-core.el b/exwm-core.el
index cc6a7bb3ba..0f9b70586a 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -306,7 +306,6 @@ One of `line-mode' or `char-mode'.")
         (interactive)
         (cond
          ((or exwm-input-line-mode-passthrough
-              ;; Do not test `exwm-input--during-command'.
               (active-minibuffer-window)
               (memq last-input-event exwm-input--global-prefix-keys)
               (memq last-input-event exwm-input-prefix-keys)
diff --git a/exwm-input.el b/exwm-input.el
index e723772abd..8257cb392a 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -107,9 +107,6 @@ defined in `exwm-mode-map' here."
                                               read-event)
   "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-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.
 Current buffer must be an `exwm-mode' buffer."
   (or exwm-input-line-mode-passthrough
-      exwm-input--during-command
       ;; Forward the event when there is an incomplete key
       ;; sequence or when the minibuffer is active.
       exwm-input--line-mode-cache
@@ -1015,12 +1011,6 @@ Notes:
          (set symbol 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)
   "Read keys with PROMPT until STOP-KEY pressed."
   (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))
              ',(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 ()
   "Run in `minibuffer-setup-hook' to grab keyboard if necessary."
   (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
     (xcb:+event exwm--connection 'xcb: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.
   (add-hook 'minibuffer-setup-hook #'exwm-input--on-minibuffer-setup)
   (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)
     (advice-remove fun #'exwm-input--call-with-passthrough))
   (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-exit-hook #'exwm-input--on-minibuffer-exit)
   (when exwm-input--echo-area-timer
diff --git a/exwm-workspace.el b/exwm-workspace.el
index c86051c8e4..d8ae9d70d5 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -134,7 +134,6 @@ Please manually run the hook 
`exwm-workspace-list-change-hook' afterwards.")
 (defvar exwm-workspace--window-y-offset 0
   "Offset between Emacs first window & outer frame in Y.")
 
-(defvar exwm-input--during-command)
 (defvar exwm-input--event-hook)
 (defvar exwm-layout-show-all-buffers)
 (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--show-minibuffer)
     (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)
       (setq exwm-workspace--display-echo-area-timer
             (run-with-timer exwm-workspace-display-echo-area-timeout nil

Reply via email to