]> code.delx.au - gnu-emacs-elpa/commitdiff
ivy.el (ivy-avy): Make "C-g" cancel gracefully
authorOleh Krehel <ohwoeowho@gmail.com>
Sat, 26 Mar 2016 13:22:40 +0000 (14:22 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Sat, 26 Mar 2016 13:22:40 +0000 (14:22 +0100)
Fixes abo-abo/avy#140

ivy.el

diff --git a/ivy.el b/ivy.el
index 37648bb8d77f863850eac803f1b6beca9f1d8459..d082c8e0599a689a357e92e57e228e077174fe80 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1080,9 +1080,10 @@ On error (read-only), call `ivy-on-del-error-function'."
             (avy--process
              (nreverse candidates)
              (avy--style-fn avy-style)))))
-    (ivy-set-index (- (line-number-at-pos candidate) 2))
-    (ivy--exhibit)
-    (ivy-done)))
+    (when (numberp candidate)
+      (ivy-set-index (- (line-number-at-pos candidate) 2))
+      (ivy--exhibit)
+      (ivy-done))))
 
 (defun ivy-sort-file-function-default (x y)
   "Compare two files X and Y.