[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-escape 47d2031f62 046/133: Fix `f is undefined`
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-escape 47d2031f62 046/133: Fix `f is undefined` |
Date: |
Wed, 3 Jan 2024 21:59:51 -0500 (EST) |
branch: elpa/evil-escape
commit 47d2031f626e3f48bf945d4710957a5868dadbb1
Author: syl20bnr <sylvain.benner@gmail.com>
Commit: syl20bnr <sylvain.benner@gmail.com>
Fix `f is undefined`
Properly execute the shadowed function
---
evil-escape.el | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/evil-escape.el b/evil-escape.el
index 5008c1d486..0c18cb7993 100644
--- a/evil-escape.el
+++ b/evil-escape.el
@@ -169,10 +169,11 @@ with a key sequence."
',map
,evil-escape-key-sequence
',command
+ ',shadowed-func
',insert-func
',delete-func)
;; not called by the user (i.e. via a macro)
- (evil-escape--setup-passthrough ,from ',map)))))))
+ (evil-escape--setup-passthrough ,from ',map ',shadowed-func)))))))
(defun evil-escape--define-keys ()
"Set the key bindings to escape _everything!_"
@@ -306,29 +307,30 @@ with a key sequence."
(minibufferp))
(call-interactively func)))
-(defun evil-escape--passthrough (from key map hfunc)
+(defun evil-escape--passthrough (from key map shadowed passthrough)
"Allow the next command KEY to pass through MAP so they can reach
the underlying major or minor modes map.
Once the command KEY passed through MAP the function HFUNC is removed
from the `post-command-hook'."
(if (lookup-key map key)
;; first pass
- (define-key map key nil)
+ (define-key map key shadowed)
;; second pass
(let ((escape-func (evil-escape--escape-function-symbol from)))
(define-key map key escape-func)
- (remove-hook 'post-command-hook hfunc))))
+ (remove-hook 'post-command-hook passthrough))))
-(defun evil-escape--setup-passthrough (from map)
+(defun evil-escape--setup-passthrough (from map &optional shadowed-func)
"Setup a pass through for the next command"
- (let ((hfunc (intern (format "evil-escape--%s-passthrough" from))))
- (eval `(defun ,hfunc ()
+ (let ((passthrough (intern (format "evil-escape--%s-passthrough" from))))
+ (eval `(defun ,passthrough ()
,(format "Setup an evil-escape passthrough for wrapper %s" from)
(evil-escape--passthrough ,from
(evil-escape--first-key)
,map
- ',hfunc)))
- (add-hook 'post-command-hook hfunc)
+ ',shadowed-func
+ ',passthrough)))
+ (add-hook 'post-command-hook passthrough)
(unless (or (and (boundp 'isearch-mode) (symbol-value 'isearch-mode))
(minibufferp))
(setq unread-command-events
@@ -336,9 +338,14 @@ from the `post-command-hook'."
(evil-escape--first-key)))))))
(defun evil-escape--escape
- (from map keys callback &optional insert-func delete-func)
+ (from map keys callback
+ &optional shadowed-func insert-func delete-func)
"Execute the passed CALLBACK using KEYS. KEYS is a cons cell of 2 characters.
+If the first key insertion shadowed a function then pass the shadowed function
+in SHADOWED-FUNC and it will be executed if the key sequence was not
+ successfull.
+
If INSERT-FUNC is not nil then the first key pressed is inserted using the
function INSERT-FUNC.
@@ -353,7 +360,7 @@ DELETE-FUNC when calling CALLBACK. "
(cond
((null evt)
(unless insert-func
- (evil-escape--setup-passthrough from map)))
+ (evil-escape--setup-passthrough from map shadowed-func)))
((and (integerp evt)
(char-equal evt skey))
;; remove the f character
@@ -364,7 +371,7 @@ DELETE-FUNC when calling CALLBACK. "
(call-interactively callback))
(t ; otherwise
(unless insert-func
- (evil-escape--setup-passthrough from map))
+ (evil-escape--setup-passthrough from map shadowed-func))
(setq unread-command-events
(append unread-command-events (list evt))))))))
- [nongnu] elpa/evil-escape 04b6e9c0cf 126/133: Depend on latest Evil release, (continued)
- [nongnu] elpa/evil-escape 04b6e9c0cf 126/133: Depend on latest Evil release, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 1c8fc8b46b 129/133: Reindent code that font-locked highlighted as problematic, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 65756d4a8d 077/133: Make it possible to assign a key binding to evil-escape, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 8f8b58db5e 121/133: Fix compiler warnings, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape bdb1e69971 133/133: Correct treemacs integration (#5), ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape fd1f59d4ab 131/133: Add non-matching events to unread-post-input-method-events, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape a04305aa74 028/133: typos in comments, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 7e0b99467f 061/133: Use `self-insert-command` instead of `insert`, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 5a8704e6a6 066/133: Add missing docstring, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 509e39d3a0 088/133: Declare function for compiler, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 47d2031f62 046/133: Fix `f is undefined`,
ELPA Syncer <=
- [nongnu] elpa/evil-escape 8012e3d21f 054/133: Correctly escape in evil replace state, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 8af706a87c 013/133: Fixes #4 evil-escape confuse evil's minibuffer echo system, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape b33a5c722d 012/133: Fixes #5 fd-escaping makes 'df<char>' motion work, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 4779435d94 001/133: Initial commit, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 0fbedcbd86 016/133: Version 1.5.0, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape ca4c6f6065 017/133: Correctly restore bindings when the mode is disabled, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 3e3920f524 008/133: Version 1.01, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 2def4a3b54 006/133: Merge pull request #1 from purcell/patch-1, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape f85416cc7c 015/133: Escape apropos buffers, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 177eccdd92 022/133: Fix byte-compilation error: void function evil-escape--first-key, ELPA Syncer, 2024/01/03