[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2c50031 004/272: Fix ivy-reverse-i-search broken by recurs
From: |
Oleh Krehel |
Subject: |
[elpa] master 2c50031 004/272: Fix ivy-reverse-i-search broken by recursive update |
Date: |
Mon, 25 Apr 2016 10:13:13 +0000 |
branch: master
commit 2c50031432f726d52b7f26f4e43fba3bb88b5dd4
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Fix ivy-reverse-i-search broken by recursive update
* ivy.el (ivy-recursive-restore): New defvar.
(ivy-read): Don't restore `ivy-last' on exit if `ivy-recursive-restore'
is nil.
(ivy-reverse-i-search): Bind `ivy-recursive-restore' to nil.
Fixes #323
---
ivy.el | 67 +++++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 37 insertions(+), 30 deletions(-)
diff --git a/ivy.el b/ivy.el
index 82c94d4..6fd361b 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1045,6 +1045,11 @@ Directories come first."
(push dir 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
(cl-defun ivy-read (prompt collection
&key predicate require-match initial-input
@@ -1120,35 +1125,36 @@ customizations apply to the current completion session."
(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)))
+ (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
+ (when (and recursive-ivy-last
+ ivy-recursive-restore)
(ivy--reset-state (setq ivy-last recursive-ivy-last))))))
(defun ivy--reset-state (state)
@@ -1638,10 +1644,10 @@ Should be run via minibuffer `post-command-hook'."
(if (string-match "/\\'" ivy-text)
(if (member ivy-text ivy--all-candidates)
(ivy--cd (expand-file-name ivy-text ivy--directory))
- (when (string-match "//\\'" ivy-text)
- (if (and default-directory
- (string-match "\\`[[:alpha:]]:/"
default-directory))
- (ivy--cd (match-string 0 default-directory))
+ (when (string-match "//\\'" ivy-text)
+ (if (and default-directory
+ (string-match "\\`[[:alpha:]]:/"
default-directory))
+ (ivy--cd (match-string 0 default-directory))
(ivy--cd "/")))
(when (string-match "[[:alpha:]]:/$" ivy-text)
(let ((drive-root (match-string 0 ivy-text)))
@@ -2265,7 +2271,8 @@ The selected history element will be inserted into the
minibuffer."
(interactive)
(let ((enable-recursive-minibuffers t)
(history (symbol-value (ivy-state-history ivy-last)))
- (old-last ivy-last))
+ (old-last ivy-last)
+ (ivy-recursive-restore nil))
(ivy-read "Reverse-i-search: "
history
:action (lambda (x)
- [elpa] master updated (03d2b00 -> 39a458e), Oleh Krehel, 2016/04/25
- [elpa] master 8306be1 006/272: Fix compilation warnings, Oleh Krehel, 2016/04/25
- [elpa] master a4317f9 002/272: ivy.el (ivy--get-window): Return a valid window, Oleh Krehel, 2016/04/25
- [elpa] master 83f89d8 003/272: Improve swiper for multiple occurrences on one line, Oleh Krehel, 2016/04/25
- [elpa] master db283d3 005/272: Fix recursive minibuffer exit with "C-g", Oleh Krehel, 2016/04/25
- [elpa] master cabab4b 012/272: swiper.el (swiper-font-lock-ensure): Add bongo-library-mode, Oleh Krehel, 2016/04/25
- [elpa] master 2c50031 004/272: Fix ivy-reverse-i-search broken by recursive update,
Oleh Krehel <=
- [elpa] master 6951eba 001/272: Make ivy--regex-plus recognize ! at the beginning of the str, Oleh Krehel, 2016/04/25
- [elpa] master d74fab4 010/272: counsel.el (counsel-M-x): Let-bind this-command, Oleh Krehel, 2016/04/25
- [elpa] master fd27465 014/272: counsel.el (counsel-git): Fix window selection, Oleh Krehel, 2016/04/25
- [elpa] master 6bf72fd 008/272: counsel.el (counsel-imenu): Work when given positions are overlays, Oleh Krehel, 2016/04/25
- [elpa] master 63be079 009/272: ivy.el (ivy-re-builders-alist): Allow this-command to be a key, Oleh Krehel, 2016/04/25
- [elpa] master 09848ca 013/272: Add cousel-ag-base-command var, Oleh Krehel, 2016/04/25
- [elpa] master adfad96 007/272: support imenu, Oleh Krehel, 2016/04/25
- [elpa] master d09a16b 011/272: swiper.el (swiper-font-lock-ensure): Add bongo-playlist-mode, Oleh Krehel, 2016/04/25
- [elpa] master a0f1e25 021/272: ivy.el (ivy-completion-in-region): Fix log 0 issue, Oleh Krehel, 2016/04/25
- [elpa] master df1dc78 019/272: counsel.el (counsel-find-file): Add initial-input, Oleh Krehel, 2016/04/25