branch: externals/avy
commit fd7b02f556041c883bad66517ff2ea6fff3113e8
Author: aragaer <[email protected]>
Commit: aragaer <[email protected]>
Add `avy-action-oneshot` variable to redefine avy-action locally
Could be used this way:
```elisp
(let ((avy-action-oneshot #'push-button))
(avy-goto-char-timer))
```
---
avy.el | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/avy.el b/avy.el
index 5d0bc9ebb9..9e411f57f6 100644
--- a/avy.el
+++ b/avy.el
@@ -455,6 +455,9 @@ KEYS is the path from the root of `avy-tree' to LEAF."
(defvar avy-action nil
"Function to call at the end of select.")
+(defvar avy-action-oneshot nil
+ "Function to call once at the end of select.")
+
(defun avy-handler-default (char)
"The default handler for a bad CHAR."
(let (dispatch)
@@ -890,10 +893,12 @@ multiple OVERLAY-FN invocations."
(t
(funcall avy-pre-action res)
(setq res (car res))
- (funcall (or avy-action 'avy-action-goto)
- (if (consp res)
- (car res)
- res))
+ (let ((action (or avy-action avy-action-oneshot 'avy-action-goto)))
+ (setq avy-action-oneshot nil)
+ (funcall action
+ (if (consp res)
+ (car res)
+ res)))
res))))
(define-obsolete-function-alias 'avy--process 'avy-process