[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master fa0d04c 038/167: Move setq ivy--index to ivy--recompute-in
From: |
Oleh Krehel |
Subject: |
[elpa] master fa0d04c 038/167: Move setq ivy--index to ivy--recompute-index |
Date: |
Tue, 08 Dec 2015 10:49:45 +0000 |
branch: master
commit fa0d04c6867f06096faef372d59cd4a5124fc261
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Move setq ivy--index to ivy--recompute-index
* ivy.el (ivy--recompute-index): Move the setq statement here, so that
the customization functions have less internal variables to deal with.
(ivy-recompute-index-swiper): Update.
(ivy-recompute-index-zero): Update.
Re #253
---
ivy.el | 39 ++++++++++++++++++++-------------------
1 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/ivy.el b/ivy.el
index 232f228..7228acb 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1612,7 +1612,7 @@ CANDIDATES are assumed to be static."
(func (or (and caller (cdr (assoc caller ivy-index-functions-alist)))
(cdr (assoc t ivy-index-functions-alist))
#'ivy-recompute-index-zero)))
- (funcall func re-str cands)
+ (setq ivy--index (funcall func re-str cands))
(when (and (or (string= name "")
(string= name "^"))
(not (equal ivy--old-re "")))
@@ -1627,26 +1627,27 @@ CANDIDATES are assumed to be static."
(defun ivy-recompute-index-swiper (re-str cands)
(let ((tail (nthcdr ivy--index ivy--old-cands))
idx)
- (when (and tail ivy--old-cands (not (equal "^" ivy--old-re)))
- (unless (and (not (equal re-str ivy--old-re))
- (or (setq ivy--index
- (or
- (cl-position (if (and (> (length re-str) 0)
- (eq ?^ (aref re-str 0)))
- (substring re-str 1)
- re-str) cands
- :test #'equal)
- (and ivy--directory
- (cl-position
- (concat re-str "/") cands
- :test #'equal))))))
- (while (and tail (null idx))
- ;; Compare with eq to handle equal duplicates in cands
- (setq idx (cl-position (pop tail) cands)))
- (setq ivy--index (or idx 0))))))
+ (if (and tail ivy--old-cands (not (equal "^" ivy--old-re)))
+ (or (and (not (equal re-str ivy--old-re))
+ (or
+ (cl-position (if (and (> (length re-str) 0)
+ (eq ?^ (aref re-str 0)))
+ (substring re-str 1)
+ re-str) cands
+ :test #'equal)
+ (and ivy--directory
+ (cl-position
+ (concat re-str "/") cands
+ :test #'equal))))
+ (progn
+ (while (and tail (null idx))
+ ;; Compare with eq to handle equal duplicates in cands
+ (setq idx (cl-position (pop tail) cands)))
+ (or idx 0)))
+ ivy--index)))
(defun ivy-recompute-index-zero (_re-str _cands)
- (setq ivy--index 0))
+ 0)
(defun ivy--flx-sort (name cands)
"Sort according to closeness to string NAME the string list CANDS."
- [elpa] master 99698e6 035/167: ivy.el (ivy-dispatching-call): Add and bind to "C-M-o", (continued)
- [elpa] master 99698e6 035/167: ivy.el (ivy-dispatching-call): Add and bind to "C-M-o", Oleh Krehel, 2015/12/08
- [elpa] master 0630395 043/167: Fix the count when git-grep for "->foo", Oleh Krehel, 2015/12/08
- [elpa] master 4045349 032/167: ivy.el (ivy-use-virtual-buffers): Update docstring, Oleh Krehel, 2015/12/08
- [elpa] master f9df75e 037/167: ivy.el (ivy-index-functions-alist): New variable, Oleh Krehel, 2015/12/08
- [elpa] master 6e3c692 029/167: Fix ivy-state-preselect for file name completion, Oleh Krehel, 2015/12/08
- [elpa] master c69b4b6 033/167: ivy.el (ivy-last): Update docstring, Oleh Krehel, 2015/12/08
- [elpa] master b6d476a 042/167: ivy.el (ivy--recompute-index): Fixup, Oleh Krehel, 2015/12/08
- [elpa] master 83f704b 039/167: ivy-hydra.el (hydra-ivy): Make the docstring a rectangle, Oleh Krehel, 2015/12/08
- [elpa] master b06daca 040/167: ivy.el (ivy-virtual-abbreviate): New defcustom, Oleh Krehel, 2015/12/08
- [elpa] master c99956a 047/167: Fix window selection in counsel-locate, Oleh Krehel, 2015/12/08
- [elpa] master fa0d04c 038/167: Move setq ivy--index to ivy--recompute-index,
Oleh Krehel <=
- [elpa] master e5105ef 054/167: Don't re-anchor to matching old candidate if flx is on, Oleh Krehel, 2015/12/08
- [elpa] master f4bd3a4 055/167: counsel.el (counsel-ag): Add initial-directory, Oleh Krehel, 2015/12/08
- [elpa] master 79924dc 051/167: swiper.el (swiper--re-builder): Fix "^a" -> "^" case, Oleh Krehel, 2015/12/08
- [elpa] master 2404db1 053/167: Add feedback for long-running async processes, Oleh Krehel, 2015/12/08
- [elpa] master d4d53d8 059/167: ivy.el (ivy-partial): Fix for fuzzy completion, Oleh Krehel, 2015/12/08
- [elpa] master 2ae7d74 058/167: Fix the count in user-specified counsel-git-grep, Oleh Krehel, 2015/12/08
- [elpa] master fd19ab1 062/167: Add a test for the perfect match logic, Oleh Krehel, 2015/12/08
- [elpa] master 2386277 060/167: ivy.el (ivy-resume): Pass caller, Oleh Krehel, 2015/12/08
- [elpa] master 607fd1f 061/167: Bring back the lost perfect match logic, Oleh Krehel, 2015/12/08
- [elpa] master f0acebd 063/167: Fix Custom menus, Oleh Krehel, 2015/12/08