]> code.delx.au - gnu-emacs-elpa/commitdiff
swiper.el (swiper-from-isearch): New command
authorOleh Krehel <ohwoeowho@gmail.com>
Tue, 28 Jul 2015 07:32:42 +0000 (09:32 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Tue, 28 Jul 2015 07:32:42 +0000 (09:32 +0200)
Fixes #180

swiper.el

index 5b22b78e51461c7ee9bf2ec4d7216cdf1f23ec44..e7bd574c353d68882ab1a158d715a151bdfb8483 100644 (file)
--- a/swiper.el
+++ b/swiper.el
@@ -360,6 +360,16 @@ BEG and END, when specified, are the point bounds."
         (push-mark swiper--opoint t)
         (message "Mark saved where search started")))))
 
+;; (define-key isearch-mode-map (kbd "C-o") 'swiper-from-isearch)
+(defun swiper-from-isearch ()
+  "Invoke `swiper' from isearch."
+  (interactive)
+  (let ((query (if isearch-regexp
+                   isearch-string
+                 (regexp-quote isearch-string))))
+    (isearch-exit)
+    (swiper query)))
+
 (provide 'swiper)
 
 ;;; swiper.el ends here