[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5f04a70 322/348: ivy.el: Move ivy-recursive-last logic to
From: |
Oleh Krehel |
Subject: |
[elpa] master 5f04a70 322/348: ivy.el: Move ivy-recursive-last logic to ivy-call |
Date: |
Sat, 8 Apr 2017 11:04:23 -0400 (EDT) |
branch: master
commit 5f04a70e0f8686c46b5f5441761df65a79d9a720
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el: Move ivy-recursive-last logic to ivy-call
The reason is that `ivy-call' needs stuff from the current `ivy-last'
for setup, i.e. deciding which action to call. But the action itself
should be called in the context of `ivy-recursive-last'.
This fixes the issue of e.g. calling `swiper', then recursively calling
`counsel-M-x' to select `ivy-done' or `ivy-alt-done'.
Fixes #924
---
ivy.el | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/ivy.el b/ivy.el
index 5824f43..ea5ce92 100644
--- a/ivy.el
+++ b/ivy.el
@@ -355,6 +355,13 @@ action functions.")
This should eventually become a stack so that you could use
`ivy-read' recursively.")
+(defvar ivy-recursive-last nil)
+
+(defvar ivy-recursive-restore t
+ "When non-nil, restore the above state when exiting the minibuffer.
+This variable is let-bound to nil by functions that take care of
+the restoring themselves.")
+
(defsubst ivy-set-action (action)
"Set the current `ivy-last' field to ACTION."
(setf (ivy-state-action ivy-last) action))
@@ -1013,6 +1020,10 @@ Example use:
(funcall action x)
(select-window (ivy--get-window ivy-last))
(prog1 (with-current-buffer (ivy-state-buffer ivy-last)
+ (when (and ivy-recursive-last
+ ivy-recursive-restore
+ (not (eq ivy-last ivy-recursive-last)))
+ (ivy--reset-state (setq ivy-last ivy-recursive-last)))
(funcall action x))
(unless (or (eq ivy-exit 'done)
(equal (selected-window)
@@ -1383,11 +1394,6 @@ Directories come first."
(cl-remove-if-not predicate seq)
seq))))
-(defvar ivy-recursive-restore t
- "When non-nil, restore the above state when exiting the minibuffer.
-This variable is let-bound to nil by functions that take care of
-the restoring themselves.")
-
;;** Entry Point
;;;###autoload
(cl-defun ivy-read (prompt collection
@@ -1472,7 +1478,7 @@ customizations apply to the current completion session."
(list (car source) (funcall (car source)))
ivy--extra-candidates))))))
(setq ivy--extra-candidates '((original-source)))))
- (let ((recursive-ivy-last (and (active-minibuffer-window) ivy-last))
+ (let ((ivy-recursive-last (and (active-minibuffer-window) ivy-last))
(transformer-fn
(plist-get ivy--display-transformers-list
(or caller (and (functionp collection)
@@ -1532,14 +1538,8 @@ customizations apply to the current completion session."
(remove-hook 'post-command-hook #'ivy--exhibit)
(ivy-overlay-cleanup)
(when (setq unwind (ivy-state-unwind ivy-last))
- (funcall unwind))
- (unless (eq ivy-exit 'done)
- (when recursive-ivy-last
- (ivy--reset-state (setq ivy-last recursive-ivy-last)))))
+ (funcall unwind)))
(ivy-call)
- (when (and recursive-ivy-last
- ivy-recursive-restore)
- (ivy--reset-state (setq ivy-last recursive-ivy-last)))
(when (> (length (ivy-state-current ivy-last)) 0)
(remove-text-properties 0 1 '(idx) (ivy-state-current ivy-last))))))
- [elpa] master 75f9ceb 286/348: Allow spaces in file names when running linux apps., (continued)
- [elpa] master 75f9ceb 286/348: Allow spaces in file names when running linux apps., Oleh Krehel, 2017/04/08
- [elpa] master 2f70c56 287/348: Revert "Add missing parameter for ag", Oleh Krehel, 2017/04/08
- [elpa] master 950545b 304/348: counsel.el (counsel-linux-apps-list): Check if dir exists, Oleh Krehel, 2017/04/08
- [elpa] master 65979f6 291/348: Heed non-sort entries in ivy-sort-functions-alist, Oleh Krehel, 2017/04/08
- [elpa] master ce3c0ec 317/348: ivy.el (ivy-completing-read): Adjust :caller, Oleh Krehel, 2017/04/08
- [elpa] master d9d7592 315/348: ivy.el (ivy-completion-in-region): Remove :require-match, Oleh Krehel, 2017/04/08
- [elpa] master 4d72dc1 327/348: ivy.el: Change recursive restore order, Oleh Krehel, 2017/04/08
- [elpa] master d82dc2c 328/348: counsel.el (counsel-colors--best-contrast-color): Return same color on error, Oleh Krehel, 2017/04/08
- [elpa] master 3fbeaa5 333/348: Define ivy-help-file with defconst, Oleh Krehel, 2017/04/08
- [elpa] master fee9810 336/348: ivy.el (ivy-partial): Fix for :dynamic-collection, Oleh Krehel, 2017/04/08
- [elpa] master 5f04a70 322/348: ivy.el: Move ivy-recursive-last logic to ivy-call,
Oleh Krehel <=
- [elpa] master ff3b696 338/348: counsel.el (counsel-find-file): Add new action counsel-find-file-as-root, Oleh Krehel, 2017/04/08
- [elpa] master 8c9f6a3 340/348: swiper.el: Silence byte-compiler, Oleh Krehel, 2017/04/08
- [elpa] master a63a935 339/348: counsel.el (counsel--find-symbol): Fix typo, Oleh Krehel, 2017/04/08
- [elpa] master cba6888 344/348: Bump version to 0.9.0, Oleh Krehel, 2017/04/08
- [elpa] master 83b00ff 346/348: doc/Changelog.org: Fix links, Oleh Krehel, 2017/04/08