Ignore mistyping when no candidates available

Fixes #256
This commit is contained in:
whatacold 2018-11-05 23:14:33 +08:00 committed by Oleh Krehel
parent 4f1b8a17d8
commit 24b51374be

7
avy.el
View File

@ -459,9 +459,8 @@ KEYS is the path from the root of `avy-tree' to LEAF."
((mouse-event-p char) ((mouse-event-p char)
(signal 'user-error (list "Mouse event not handled" char))) (signal 'user-error (list "Mouse event not handled" char)))
(t (t
(signal 'user-error (list "No such candidate" (message "No such candidate: %s, hit `C-g' to quit."
(if (characterp char) (string char) char))) (if (characterp char) (string char) char))))))
(throw 'done nil)))))
(defvar avy-handler-function 'avy-handler-default (defvar avy-handler-function 'avy-handler-default
"A function to call for a bad `read-key' in `avy-read'.") "A function to call for a bad `read-key' in `avy-read'.")
@ -480,7 +479,7 @@ Return nil if not a mouse event."
(t (selected-window))))) (t (selected-window)))))
(defun avy-read (tree display-fn cleanup-fn) (defun avy-read (tree display-fn cleanup-fn)
"Select a leaf from TREE using consecutive `read-char'. "Select a leaf from TREE using consecutive `read-key'.
DISPLAY-FN should take CHAR and LEAF and signify that LEAFs DISPLAY-FN should take CHAR and LEAF and signify that LEAFs
associated with CHAR will be selected if CHAR is pressed. This is associated with CHAR will be selected if CHAR is pressed. This is