branch: elpa/flx
commit af1010e4ad5ff953c8473b34ae40dc080ef3f530
Author: Le Wang <[email protected]>
Commit: Le Wang <[email protected]>
Reverting "fix `ido-merge-work-directories`"
Revert "fix `ido-merge-work-directories`"
This reverts commit a1ac8f97ecb4a0cbb4764210048484fe96074c65.
---
flx-ido.el | 45 +++++++++++++++++++--------------------------
1 file changed, 19 insertions(+), 26 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index d4940b1c7a..a8bea9df0d 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 17
+;; Update #: 15
;; URL:
;; Keywords:
;; Compatibility:
@@ -117,25 +117,22 @@ item, in which case, the ending items are deleted."
(defun flx-ido-decorate (things &optional clear)
- (if (consp (caar things))
- (mapcar 'car things)
- (let ((decorate-count (min ido-max-prospects
- (length things))))
- (nconc
- (loop for thing in things
- for i from 0 below decorate-count
- collect (if clear
- (substring-no-properties thing)
- ;; copy the string in case it's "pure"
- (flx-propertize (copy-sequence (car thing)) (cdr
thing))))
- (if clear
- (nthcdr decorate-count things)
- (mapcar 'car (nthcdr decorate-count things)))))))
+ (let ((decorate-count (min ido-max-prospects
+ (length things))))
+ (nconc
+ (loop for thing in things
+ for i from 0 below decorate-count
+ collect (if clear
+ (substring-no-properties thing)
+ ;; copy the string in case it's "pure"
+ (flx-propertize (copy-sequence (car thing)) (cdr thing))))
+ (if clear
+ (nthcdr decorate-count things)
+ (mapcar 'car (nthcdr decorate-count things))))))
(defun flx-ido-match-internal (query items)
(let* ((matches (loop for item in items
- for string = (if (consp item) (car item) item)
- for score = (flx-score string query flx-file-cache)
+ for score = (flx-score item query flx-file-cache)
if score
collect (cons item score)
into matches
@@ -144,11 +141,6 @@ item, in which case, the ending items are deleted."
(sort matches
(lambda (x y) (> (cadr x) (cadr y))))))))
-(defun flx-ido-cache (query items)
- (if (consp (car items))
- items
- (puthash query items flx-ido-narrowed-matches-hash)))
-
(defun flx-ido-match (query items)
"Better sorting for flx ido matching."
(if (memq ido-cur-item '(file dir))
@@ -159,12 +151,13 @@ item, in which case, the ending items are deleted."
(not (gethash query flx-ido-narrowed-matches-hash)))
;; original function reverses list.
(setq items (nreverse (ido-delete-runs items)))
- (flx-ido-cache query items))
- (destructuring-bind (exact res-items)
+ (puthash query items flx-ido-narrowed-matches-hash))
+ (destructuring-bind (exact items)
(flx-ido-narrowed query items)
(if exact ; `ido-rotate' case is covered by
exact match
- res-items
- (flx-ido-cache query (flx-ido-match-internal query res-items))))))
+ items
+ (puthash query (flx-ido-match-internal query items)
+ flx-ido-narrowed-matches-hash)))))
(defvar flx-ido-use t
"Use flx matching for ido.")