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))
```
This commit is contained in:
aragaer 2022-08-25 16:44:54 +03:00
parent ba5f035be3
commit fd7b02f556

13
avy.el
View File

@ -455,6 +455,9 @@ KEYS is the path from the root of `avy-tree' to LEAF."
(defvar avy-action nil (defvar avy-action nil
"Function to call at the end of select.") "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) (defun avy-handler-default (char)
"The default handler for a bad CHAR." "The default handler for a bad CHAR."
(let (dispatch) (let (dispatch)
@ -890,10 +893,12 @@ multiple OVERLAY-FN invocations."
(t (t
(funcall avy-pre-action res) (funcall avy-pre-action res)
(setq res (car res)) (setq res (car res))
(funcall (or avy-action 'avy-action-goto) (let ((action (or avy-action avy-action-oneshot 'avy-action-goto)))
(if (consp res) (setq avy-action-oneshot nil)
(car res) (funcall action
res)) (if (consp res)
(car res)
res)))
res)))) res))))
(define-obsolete-function-alias 'avy--process 'avy-process (define-obsolete-function-alias 'avy--process 'avy-process