]> code.delx.au - gnu-emacs-elpa/commitdiff
swiper.el (swiper-avy): Don't start on empty input
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 25 May 2015 20:27:42 +0000 (22:27 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 25 May 2015 20:27:42 +0000 (22:27 +0200)
Fixes abo-abo/avy#50

swiper.el

index 6f98989333e8a759972803a77a8e9bc28461576c..698e5dddec98921e47a1dc0be9a7757a2bf61fd0 100644 (file)
--- a/swiper.el
+++ b/swiper.el
 (defun swiper-avy ()
   "Jump to one of the current swiper candidates."
   (interactive)
-  (with-selected-window (ivy-state-window ivy-last)
-    (let* ((avy-all-windows nil)
-           (candidates
-            (avy--regex-candidates
-             (ivy--regex ivy-text)))
-           (avy-background nil)
-           (candidate
-            (avy--process candidates #'avy--overlay-post)))
-      (ivy-quit-and-run
-       (avy--goto candidate)))))
+  (unless (string= ivy-text "")
+    (with-selected-window (ivy-state-window ivy-last)
+      (let* ((avy-all-windows nil)
+             (candidates
+              (avy--regex-candidates
+               (ivy--regex ivy-text)))
+             (avy-background nil)
+             (candidate
+              (avy--process candidates #'avy--overlay-post)))
+        (ivy-quit-and-run
+         (avy--goto candidate))))))
 
 (defun swiper-recenter-top-bottom (&optional arg)
   "Call (`recenter-top-bottom' ARG) in `swiper--window'."