emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/exwm 277377c 1/2: Fix local simulation keys


From: Chris Feng
Subject: [elpa] externals/exwm 277377c 1/2: Fix local simulation keys
Date: Sat, 3 Mar 2018 23:30:23 -0500 (EST)

branch: externals/exwm
commit 277377c718429555f75a88a85f336d80f3716dce
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>

    Fix local simulation keys
    
    * exwm-input.el (exwm-input--set-simulation-keys): Try the local
    binding first do not clear the hash table (rely on GC).
---
 exwm-input.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index e051603..3794426 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -762,16 +762,17 @@ multiple keys."
 (defun exwm-input--set-simulation-keys (simulation-keys &optional no-refresh)
   "Set simulation keys."
   (unless no-refresh
-    ;; Clear keymaps and the hash table.
-    (when (hash-table-p exwm-input--simulation-keys)
-      (maphash (lambda (key _value)
-                 (when (sequencep key)
-                   (if exwm-input--local-simulation-keys
-                       (local-unset-key key)
-                     (define-key exwm-mode-map key nil))))
-               exwm-input--simulation-keys)
-      (clrhash exwm-input--simulation-keys))
-    ;; Update the hash table.
+    ;; Unbind simulation keys.
+    (let ((hash (buffer-local-value 'exwm-input--simulation-keys
+                                    (current-buffer))))
+      (when (hash-table-p hash)
+        (maphash (lambda (key _value)
+                   (when (sequencep key)
+                     (if exwm-input--local-simulation-keys
+                         (local-unset-key key)
+                       (define-key exwm-mode-map key nil))))
+                 hash)))
+    ;; Abandon the old hash table.
     (setq exwm-input--simulation-keys (make-hash-table :test #'equal)))
   (dolist (i simulation-keys)
     (let ((original (vconcat (car i)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]