[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e9ba89e 085/167: Make ivy work with enable-recursive-minib
From: |
Oleh Krehel |
Subject: |
[elpa] master e9ba89e 085/167: Make ivy work with enable-recursive-minibuffers |
Date: |
Tue, 08 Dec 2015 10:50:08 +0000 |
branch: master
commit e9ba89ea7fb6d3cdd30109f89aee6ab313c733ef
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Make ivy work with enable-recursive-minibuffers
* ivy.el (ivy-read): Fix the doc of DYNAMIC-COLLECTION. Store the old
`ivy-last' in case `ivy-read' is called while inside the minibuffer.
Restore it after `ivy-call'.
---
ivy.el | 110 +++++++++++++++++++++++++++++++++-------------------------------
1 files changed, 57 insertions(+), 53 deletions(-)
diff --git a/ivy.el b/ivy.el
index aacdcf4..8f993e5 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1000,8 +1000,9 @@ RE-BUILDER is a lambda that transforms text into a regex.
MATCHER can completely override matching.
-DYNAMIC-COLLECTION is a function to call to update the list of
-candidates with each input.
+DYNAMIC-COLLECTION is a boolean that determines whether to update
+the list of candidates with each input by calling COLLECTION for
+the current input.
CALLER is a symbol to uniquely identify the caller to `ivy-read'.
It's used in conjunction with COLLECTION to indentify which
@@ -1014,57 +1015,60 @@ customizations should apply to the current completion
session."
("o" ,action "default")
,@extra-actions)
(delete-dups (append action extra-actions))))))
- (setq ivy-last
- (make-ivy-state
- :prompt prompt
- :collection collection
- :predicate predicate
- :require-match require-match
- :initial-input initial-input
- :history history
- :preselect preselect
- :keymap keymap
- :update-fn update-fn
- :sort sort
- :action action
- :window (selected-window)
- :buffer (current-buffer)
- :unwind unwind
- :re-builder re-builder
- :matcher matcher
- :dynamic-collection dynamic-collection
- :caller caller))
- (ivy--reset-state ivy-last)
- (prog1
- (unwind-protect
- (minibuffer-with-setup-hook
- #'ivy--minibuffer-setup
- (let* ((hist (or history 'ivy-history))
- (minibuffer-completion-table collection)
- (minibuffer-completion-predicate predicate)
- (resize-mini-windows (cond
- ((display-graphic-p) nil)
- ((null resize-mini-windows)
'grow-only)
- (t resize-mini-windows)))
- (res (read-from-minibuffer
- prompt
- (ivy-state-initial-input ivy-last)
- (make-composed-keymap keymap ivy-minibuffer-map)
- nil
- hist)))
- (when (eq ivy-exit 'done)
- (let ((item (if ivy--directory
- ivy--current
- ivy-text)))
- (unless (equal item "")
- (set hist (cons (propertize item 'ivy-index ivy--index)
- (delete item
- (cdr (symbol-value hist)))))))
- res)))
- (remove-hook 'post-command-hook #'ivy--exhibit)
- (when (setq unwind (ivy-state-unwind ivy-last))
- (funcall unwind)))
- (ivy-call)))
+ (let ((recursive-ivy-last (and (window-minibuffer-p) ivy-last)))
+ (setq ivy-last
+ (make-ivy-state
+ :prompt prompt
+ :collection collection
+ :predicate predicate
+ :require-match require-match
+ :initial-input initial-input
+ :history history
+ :preselect preselect
+ :keymap keymap
+ :update-fn update-fn
+ :sort sort
+ :action action
+ :window (selected-window)
+ :buffer (current-buffer)
+ :unwind unwind
+ :re-builder re-builder
+ :matcher matcher
+ :dynamic-collection dynamic-collection
+ :caller caller))
+ (ivy--reset-state ivy-last)
+ (prog1
+ (unwind-protect
+ (minibuffer-with-setup-hook
+ #'ivy--minibuffer-setup
+ (let* ((hist (or history 'ivy-history))
+ (minibuffer-completion-table collection)
+ (minibuffer-completion-predicate predicate)
+ (resize-mini-windows (cond
+ ((display-graphic-p) nil)
+ ((null resize-mini-windows)
'grow-only)
+ (t resize-mini-windows)))
+ (res (read-from-minibuffer
+ prompt
+ (ivy-state-initial-input ivy-last)
+ (make-composed-keymap keymap ivy-minibuffer-map)
+ nil
+ hist)))
+ (when (eq ivy-exit 'done)
+ (let ((item (if ivy--directory
+ ivy--current
+ ivy-text)))
+ (unless (equal item "")
+ (set hist (cons (propertize item 'ivy-index ivy--index)
+ (delete item
+ (cdr (symbol-value hist)))))))
+ res)))
+ (remove-hook 'post-command-hook #'ivy--exhibit)
+ (when (setq unwind (ivy-state-unwind ivy-last))
+ (funcall unwind)))
+ (ivy-call)
+ (when recursive-ivy-last
+ (ivy--reset-state (setq ivy-last recursive-ivy-last))))))
(defun ivy--reset-state (state)
"Reset the ivy to STATE.
- [elpa] master 0e6c13b 076/167: swiper.el (swiper-font-lock-ensure): Exclude eems-stream-mode, (continued)
- [elpa] master 0e6c13b 076/167: swiper.el (swiper-font-lock-ensure): Exclude eems-stream-mode, Oleh Krehel, 2015/12/08
- [elpa] master f5b8bf2 079/167: Highlight modified file buffers with 'ivy-modified-buffer face, Oleh Krehel, 2015/12/08
- [elpa] master 70f6055 077/167: counsel.el (counsel-git-grep-query-replace): Add and bind to "M-q", Oleh Krehel, 2015/12/08
- [elpa] master 86d0884 087/167: fix 1-too-far scrolling issue, Oleh Krehel, 2015/12/08
- [elpa] master 16ccb0f 084/167: swiper.el (swiper-font-lock-ensure): Exclude debbugs-gnu-mode, Oleh Krehel, 2015/12/08
- [elpa] master d41cc69 086/167: Pulse after ivy-occur-press, Oleh Krehel, 2015/12/08
- [elpa] master c6cc3f9 089/167: counsel.el (counsel-rhythmbox): Add :caller, Oleh Krehel, 2015/12/08
- [elpa] master 2f1133a 083/167: ivy.el (ivy-occur): Add and bind to "C-c o", Oleh Krehel, 2015/12/08
- [elpa] master 2797a9b 090/167: ivy.el (ivy-minibuffer-map): Bind "C-M-a" to ivy-read-action, Oleh Krehel, 2015/12/08
- [elpa] master 564e235 091/167: ivy.el (ivy-occur-press): Extend with-ivy-window, Oleh Krehel, 2015/12/08
- [elpa] master e9ba89e 085/167: Make ivy work with enable-recursive-minibuffers,
Oleh Krehel <=
- [elpa] master 7a069be 088/167: ivy.el (ivy-occur-press): Work with counsel-rhythmbox, Oleh Krehel, 2015/12/08
- [elpa] master 32025e5 098/167: Add a better ivy-occur pulse to swiper and counsel-git-grep, Oleh Krehel, 2015/12/08
- [elpa] master b948987 095/167: Input "/sudo::" goes to current directory instead of root's home, Oleh Krehel, 2015/12/08
- [elpa] master 7317848 092/167: counsel.el (counsel-M-x): Add "definition" action, Oleh Krehel, 2015/12/08
- [elpa] master adf7fd3 097/167: swiper.el (swiper--add-overlays): Take extra WND arg, Oleh Krehel, 2015/12/08
- [elpa] master b91870e 094/167: Fix /ssh: and /sudo:: broken in 71695df, Oleh Krehel, 2015/12/08
- [elpa] master 6afce97 096/167: counsel.el (counsel-git-grep-query-replace): Should exit minibuffer, Oleh Krehel, 2015/12/08
- [elpa] master 6e9ab3d 111/167: swiper.el: Add support for evil-jumper/backward, Oleh Krehel, 2015/12/08
- [elpa] master 2a0a25d 117/167: counsel.el (counsel-locate): Add INTIAL-INPUT arg, Oleh Krehel, 2015/12/08
- [elpa] master 7cf7575 103/167: swiper.el (swiper-toggle-face-matching): Add and bind to "C-c C-f", Oleh Krehel, 2015/12/08