[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 8fdf210 127/167: Switch to using ivy-exit-with-action
From: |
Oleh Krehel |
Subject: |
[elpa] master 8fdf210 127/167: Switch to using ivy-exit-with-action |
Date: |
Tue, 08 Dec 2015 10:50:29 +0000 |
branch: master
commit 8fdf210c2da544ee8d6b917c438011540e10b8bb
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Switch to using ivy-exit-with-action
* ivy.el (ivy-exit-with-action): Add a missing quote.
(ivy--cd-maybe): Use `ivy-exit-with-action'.
* counsel.el (counsel-find-symbol):
(counsel--info-lookup-symbol):
(counsel-git-grep-query-replace): Use `ivy-exit-with-action'.
* swiper.el (swiper-query-replace):
(swiper-mc): Use `ivy-exit-with-action'.
The previous approach was overwriting the action list, so when
`ivy-resume' was called, only a single action was present. The new
approach doesn't have this bug.
So now it's possible to e.g. `counsel-describe-function' -> "M-o d" ->
`ivy-resume' -> "M-o o" -> `ivy-resume' -> "M-o i".
---
counsel.el | 12 ++++--------
ivy.el | 11 ++++-------
swiper.el | 19 ++++++++-----------
3 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/counsel.el b/counsel.el
index 9b208c7..bee493b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -159,14 +159,12 @@
(defun counsel-find-symbol ()
"Jump to the definition of the current symbol."
(interactive)
- (ivy-set-action #'counsel--find-symbol)
- (ivy-done))
+ (ivy-exit-with-action #'counsel--find-symbol))
(defun counsel--info-lookup-symbol ()
"Lookup the current symbol in the info docs."
(interactive)
- (ivy-set-action #'counsel-info-lookup-symbol)
- (ivy-done))
+ (ivy-exit-with-action #'counsel-info-lookup-symbol))
(defun counsel--find-symbol (x)
"Find symbol definition that corresponds to string X."
@@ -392,7 +390,7 @@
(let* ((enable-recursive-minibuffers t)
(from (ivy--regex ivy-text))
(to (query-replace-read-to from "Query replace" t)))
- (ivy-set-action
+ (ivy-exit-with-action
(lambda (_)
(let (done-buffers)
(dolist (cand ivy--old-cands)
@@ -404,9 +402,7 @@
(push file-name done-buffers)
(find-file file-name)
(goto-char (point-min)))
- (perform-replace from to t t nil))))))))
- (setq ivy-exit 'done)
- (exit-minibuffer))))
+ (perform-replace from to t t nil)))))))))))
(defun counsel-git-grep-recenter ()
(interactive)
diff --git a/ivy.el b/ivy.el
index fe2d125..7f79406 100644
--- a/ivy.el
+++ b/ivy.el
@@ -285,7 +285,7 @@ When non-nil, it should contain one %d.")
"Quit the minibuffer and call ACTION afterwards."
(ivy-set-action
`(lambda (x)
- (funcall ,action x)
+ (funcall ',action x)
(ivy-set-action ',(ivy-state-action ivy-last))))
(setq ivy-exit 'done)
(exit-minibuffer))
@@ -736,12 +736,9 @@ If so, move to that directory, while keeping only the file
name."
(let ((input (ivy--input))
url)
(if (setq url (ffap-url-p input))
- (progn
- (ivy-set-action
- (lambda (_)
- (funcall ffap-url-fetcher url)))
- (setq ivy-exit 'done)
- (exit-minibuffer))
+ (ivy-exit-with-action
+ (lambda (_)
+ (funcall ffap-url-fetcher url)))
(setq input (expand-file-name input))
(let ((file (file-name-nondirectory input))
(dir (expand-file-name (file-name-directory input))))
diff --git a/swiper.el b/swiper.el
index f2fe31f..b504f19 100644
--- a/swiper.el
+++ b/swiper.el
@@ -105,14 +105,13 @@
(let* ((enable-recursive-minibuffers t)
(from (ivy--regex ivy-text))
(to (query-replace-read-to from "Query replace" t)))
- (delete-minibuffer-contents)
- (ivy-set-action (lambda (_)
- (with-ivy-window
- (move-beginning-of-line 1)
- (perform-replace from to
- t t nil))))
(swiper--cleanup)
- (exit-minibuffer))))
+ (ivy-exit-with-action
+ (lambda (_)
+ (with-ivy-window
+ (move-beginning-of-line 1)
+ (perform-replace from to
+ t t nil)))))))
(defvar avy-background)
(defvar avy-all-windows)
@@ -185,16 +184,14 @@
(error "multiple-cursors isn't installed"))
(let ((cands (nreverse ivy--old-cands)))
(unless (string= ivy-text "")
- (ivy-set-action
+ (ivy-exit-with-action
(lambda (_)
(let (cand)
(while (setq cand (pop cands))
(swiper--action cand)
(when cands
(mc/create-fake-cursor-at-point))))
- (multiple-cursors-mode 1)))
- (setq ivy-exit 'done)
- (exit-minibuffer))))
+ (multiple-cursors-mode 1))))))
(defun swiper-recenter-top-bottom (&optional arg)
"Call (`recenter-top-bottom' ARG)."
- [elpa] master c4c1878 121/167: Fix swiper preselect issue with similar or identical lines, (continued)
- [elpa] master c4c1878 121/167: Fix swiper preselect issue with similar or identical lines, Oleh Krehel, 2015/12/08
- [elpa] master 7397bec 114/167: Allow user-specified matched candidate sorting, Oleh Krehel, 2015/12/08
- [elpa] master ce557d1 119/167: swiper.el (swiper--candidates): Replace "\t" with " ", Oleh Krehel, 2015/12/08
- [elpa] master 5a99dda 118/167: ivy.el (ivy--truncate-string): New defun, Oleh Krehel, 2015/12/08
- [elpa] master 3101efd 136/167: swiper.el (swiper--action): push-mark only if exited the minibuffer, Oleh Krehel, 2015/12/08
- [elpa] master 63f3498 123/167: Add precise preselect for swiper with visual-line-mode, Oleh Krehel, 2015/12/08
- [elpa] master 74bb138 144/167: Update ivy format functions., Oleh Krehel, 2015/12/08
- [elpa] master 39e6733 129/167: Improve ivy TRAMP support, Oleh Krehel, 2015/12/08
- [elpa] master 63e714c 130/167: Allow access to TRAMP from "// C-j", Oleh Krehel, 2015/12/08
- [elpa] master 85bd44b 125/167: swiper.el: Modify the behavior with org-mode and visual-line-mode, Oleh Krehel, 2015/12/08
- [elpa] master 8fdf210 127/167: Switch to using ivy-exit-with-action,
Oleh Krehel <=
- [elpa] master ce6ab7a 135/167: Perform string-match in the original buffer, Oleh Krehel, 2015/12/08
- [elpa] master bc00eaf 137/167: Fix `counsel-ag` on Windows, Oleh Krehel, 2015/12/08
- [elpa] master ed2367b 134/167: swiper.el (swiper--candidates): Require outline, Oleh Krehel, 2015/12/08
- [elpa] master 80d4dde 141/167: Fix broken candidate index in ivy-resume, Oleh Krehel, 2015/12/08
- [elpa] master d9ecd2e 133/167: Fix the preselect for (swiper "one"), Oleh Krehel, 2015/12/08
- [elpa] master 073b071 115/167: Allow to sort files by last modification time., Oleh Krehel, 2015/12/08
- [elpa] master 0c62f7e 132/167: ivy.el (ivy-alt-done): Split into smaller defuns, Oleh Krehel, 2015/12/08
- [elpa] master 59df2e9 131/167: ivy.el (ivy-alt-done): Refactor, Oleh Krehel, 2015/12/08
- [elpa] master 2bec99d 146/167: Ease production of functions like ivy-format-function-default, Oleh Krehel, 2015/12/08
- [elpa] master c546ae4 150/167: Enable recursive swiper calls, Oleh Krehel, 2015/12/08