* 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".
(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."
(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)
(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)
"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))
(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))))
(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)
(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)."