[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master cd083cc 18/57: Add swiper -> avy finalizer
From: |
Oleh Krehel |
Subject: |
[elpa] master cd083cc 18/57: Add swiper -> avy finalizer |
Date: |
Tue, 19 May 2015 14:21:26 +0000 |
branch: master
commit cd083cc722658fa39ff10c6601d0d4d99b44ef5f
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add swiper -> avy finalizer
* ivy.el (ivy-quit-and-run): New defmacro.
(tramp-get-completion-function): Add declare.
* swiper.el (swiper-map): Bind `avy-swiper' to "C-'".
(avy-swiper): New defun - jump to one of the currently visible swiper
candidates using avy.
---
ivy.el | 12 ++++++++++++
swiper.el | 20 ++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/ivy.el b/ivy.el
index a7e76e0..e42f8c3 100644
--- a/ivy.el
+++ b/ivy.el
@@ -182,6 +182,16 @@ When non-nil, it should contain one %d.")
(defvar Info-current-file)
+(defmacro ivy-quit-and-run (&rest body)
+ "Quit the minibuffer and run BODY afterwards."
+ `(progn
+ (put 'quit 'error-message "")
+ (run-at-time nil nil
+ (lambda ()
+ (put 'quit 'error-message "Quit")
+ ,@body))
+ (minibuffer-keyboard-quit)))
+
(defun ivy--done (text)
"Insert TEXT and exit minibuffer."
(if (and ivy--directory
@@ -224,6 +234,8 @@ Is is a cons cell, related to
`tramp-get-completion-function'."
(concat user "@" domain)
domain)))
+(declare-function tramp-get-completion-function "tramp")
+
(defun ivy-alt-done (&optional arg)
"Exit the minibuffer with the selected candidate.
When ARG is t, exit with current text, ignoring the candidates."
diff --git a/swiper.el b/swiper.el
index 0879103..3c58d59 100644
--- a/swiper.el
+++ b/swiper.el
@@ -79,6 +79,7 @@
(let ((map (make-sparse-keymap)))
(define-key map (kbd "M-q") 'swiper-query-replace)
(define-key map (kbd "C-l") 'swiper-recenter-top-bottom)
+ (define-key map (kbd "C-'") 'avy-swiper)
map)
"Keymap for swiper.")
@@ -98,6 +99,25 @@
(swiper--cleanup)
(exit-minibuffer))))
+(defvar avy-background)
+(declare-function avy--regex-candidates "ext:avy")
+(declare-function avy--process "ext:avy")
+(declare-function avy--overlay-post "ext:avy")
+(declare-function avy--goto "ext:avy")
+
+;;;###autoload
+(defun avy-swiper ()
+ "Jump to one of the current swiper candidates."
+ (interactive)
+ (with-selected-window (ivy-state-window ivy-last)
+ (let* ((candidates
+ (avy--regex-candidates ivy-text))
+ (avy-background nil)
+ (candidate
+ (avy--process candidates #'avy--overlay-post)))
+ (ivy-quit-and-run
+ (avy--goto candidate)))))
+
(defvar swiper--window nil
"Store the current window.")
- [elpa] master updated (e559638 -> 155f2a6), Oleh Krehel, 2015/05/19
- [elpa] master ca91c88 01/57: Add an option for out-of-order matching, Oleh Krehel, 2015/05/19
- [elpa] master 4ad1ab2 02/57: ivy.el (ivy-tab-space): New defcustom, Oleh Krehel, 2015/05/19
- [elpa] master 41bc3e8 03/57: Ignore case for "TAB", Oleh Krehel, 2015/05/19
- [elpa] master 2c39e10 04/57: "TAB" shouldn't delete input when no candidate, Oleh Krehel, 2015/05/19
- [elpa] master 2d7f287 09/57: Improve "TAB" interaction with `confirm-nonexistent-file-or-buffer', Oleh Krehel, 2015/05/19
- [elpa] master 03ab827 07/57: Merge ivy--collection into ivy-last, Oleh Krehel, 2015/05/19
- [elpa] master dc219b3 12/57: Add counsel-load-library, Oleh Krehel, 2015/05/19
- [elpa] master 8b08cc0 08/57: ivy.el (ivy-done): Simplify and improve, Oleh Krehel, 2015/05/19
- [elpa] master cd083cc 18/57: Add swiper -> avy finalizer,
Oleh Krehel <=
- [elpa] master f2a0966 16/57: Add ivy-partial: partial complete without exiting, Oleh Krehel, 2015/05/19
- [elpa] master 386184b 14/57: Merge ivy--update-fn into ivy-last, Oleh Krehel, 2015/05/19
- [elpa] master c5fce64 05/57: Make "TAB" switch directories properly, Oleh Krehel, 2015/05/19
- [elpa] master 6784185 17/57: Allow to use "^" in swiper, Oleh Krehel, 2015/05/19
- [elpa] master fb3fce9 13/57: Add parents using 'display for `counsel-load-library', Oleh Krehel, 2015/05/19
- [elpa] master 5601653 06/57: Require dired when completing file names, Oleh Krehel, 2015/05/19
- [elpa] master 4a7ba2f 15/57: Try to prevent the resize of minibuffer window, Oleh Krehel, 2015/05/19
- [elpa] master 5a451a9 26/57: ivy.el (ivy-read): Add a re-builder argument, Oleh Krehel, 2015/05/19
- [elpa] master f7fc3ad 11/57: Work around grep-read-files, Oleh Krehel, 2015/05/19
- [elpa] master 056614d 22/57: Rename avy-swiper to swiper-avy, Oleh Krehel, 2015/05/19