From df70ed6a34307e75788cad05dc5f85a69ab5012d Mon Sep 17 00:00:00 2001 From: Daniel Koning Date: Sat, 13 Jun 2020 17:10:46 -0500 Subject: [PATCH 1/3] Account for input method of keyboard event Since an event not matched by the `cond' form now goes in `unread-post-input-method-events' rather than `unread-command-events', turn on the appropriate argument of the initial `read-event' (INHERIT-INPUT-METHOD) to make sure the event doesn't get queued without its input method ever being handled. --- evil-escape.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evil-escape.el b/evil-escape.el index 9155785..0564311 100644 --- a/evil-escape.el +++ b/evil-escape.el @@ -189,7 +189,7 @@ with a key sequence." (inserted (evil-escape--insert)) (fkey (elt evil-escape-key-sequence 0)) (skey (elt evil-escape-key-sequence 1)) - (evt (read-event nil nil evil-escape-delay))) + (evt (read-event nil t evil-escape-delay))) (when inserted (evil-escape--delete)) ;; NOTE Add syl20bnr/evil-escape#91: replace `set-buffer-modified-p' ;; with `restore-buffer-modified-p', which doesn't redisplay the From b0a2f6035865483d75bf28e3510906a751506bcc Mon Sep 17 00:00:00 2001 From: Daniel Koning Date: Sat, 13 Jun 2020 17:26:48 -0500 Subject: [PATCH 2/3] Recognize non-ASCII escape sequences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As suggested in section 21.7.15 of the elisp manual, handle keyboard events internally as vectors across the board, rather than preferring strings when possible. This commit, in combination with the one before it, fixes syl20bnr/evil-escape#51: `this-command-keys' returns a vector for most key sequences, so (for instance) the expression (equal (this-command-keys) "π") is always nil. --- evil-escape.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/evil-escape.el b/evil-escape.el index 0564311..c20865e 100644 --- a/evil-escape.el +++ b/evil-escape.el @@ -197,10 +197,12 @@ with a key sequence." (restore-buffer-modified-p modified) (cond ((and (characterp evt) - (or (and (equal (this-command-keys) (evil-escape--first-key)) + (or (and (equal (this-command-keys-vector) + (evil-escape--first-key)) (char-equal evt skey)) (and evil-escape-unordered-key-sequence - (equal (this-command-keys) (evil-escape--second-key)) + (equal (this-command-keys-vector) + (evil-escape--second-key)) (char-equal evt fkey)))) (evil-repeat-stop) (let ((esc-fun (evil-escape-func))) @@ -236,9 +238,9 @@ with a key sequence." (not (memq evil-state evil-escape-excluded-states)) (or (not evil-escape-enable-only-for-major-modes) (memq major-mode evil-escape-enable-only-for-major-modes)) - (or (equal (this-command-keys) (evil-escape--first-key)) + (or (equal (this-command-keys-vector) (evil-escape--first-key)) (and evil-escape-unordered-key-sequence - (equal (this-command-keys) (evil-escape--second-key)))) + (equal (this-command-keys-vector) (evil-escape--second-key)))) (not (cl-reduce (lambda (x y) (or x y)) (mapcar 'funcall evil-escape-inhibit-functions) :initial-value nil)))) @@ -283,16 +285,14 @@ with a key sequence." (t 'evil-normal-state))) (defun evil-escape--first-key () - "Return the first key string in the key sequence." - (let* ((first-key (elt evil-escape-key-sequence 0)) - (fkeystr (char-to-string first-key))) - fkeystr)) + "Return a vector containing just the first key in the key sequence." + (let ((first-key (elt evil-escape-key-sequence 0))) + (vector first-key))) (defun evil-escape--second-key () - "Return the second key string in the key sequence." - (let* ((sec-key (elt evil-escape-key-sequence 1)) - (fkeystr (char-to-string sec-key))) - fkeystr)) + "Return a vector containing just the second key in the key sequence." + (let ((second-key (elt evil-escape-key-sequence 1))) + (vector second-key))) (defun evil-escape--insert-func () "Default insert function." From fae704f2a880834ce8d796b13149f35a6274aeb6 Mon Sep 17 00:00:00 2001 From: Daniel Koning Date: Sat, 13 Jun 2020 17:42:52 -0500 Subject: [PATCH 3/3] Fix docstring typos --- evil-escape.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evil-escape.el b/evil-escape.el index c20865e..d40a1bc 100644 --- a/evil-escape.el +++ b/evil-escape.el @@ -315,7 +315,7 @@ with a key sequence." ('error nil))) (defun evil-escape--insert-2 () - "Insert character while taking into account mode specificites." + "Insert character while taking into account mode specificities." (pcase major-mode (`term-mode (call-interactively 'term-send-raw)) (_ (cond @@ -333,7 +333,7 @@ with a key sequence." (`iedit-insert (evil-escape--delete-func)))) (defun evil-escape--delete-2 () - "Delete character while taking into account mode specifities." + "Delete character while taking into account mode specificities." (pcase major-mode (`term-mode (call-interactively 'term-send-backspace)) (_ (cond