[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx a1ac8f97ec 034/182: fix `ido-merge-work-directories`
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx a1ac8f97ec 034/182: fix `ido-merge-work-directories` |
Date: |
Tue, 13 Dec 2022 03:59:22 -0500 (EST) |
branch: elpa/flx
commit a1ac8f97ecb4a0cbb4764210048484fe96074c65
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
fix `ido-merge-work-directories`
- items are cons cells of (basename . dirname)
- match should be performed against basename
- caching is skipped for the merge case
- flx highlighting is disabled for merged case
#10
---
flx-ido.el | 45 ++++++++++++++++++++++++++-------------------
1 file changed, 26 insertions(+), 19 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index a8bea9df0d..d4940b1c7a 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 15
+;; Update #: 17
;; URL:
;; Keywords:
;; Compatibility:
@@ -117,22 +117,25 @@ item, in which case, the ending items are deleted."
(defun flx-ido-decorate (things &optional clear)
- (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))))))
+ (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)))))))
(defun flx-ido-match-internal (query items)
(let* ((matches (loop for item in items
- for score = (flx-score item query flx-file-cache)
+ for string = (if (consp item) (car item) item)
+ for score = (flx-score string query flx-file-cache)
if score
collect (cons item score)
into matches
@@ -141,6 +144,11 @@ 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))
@@ -151,13 +159,12 @@ 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)))
- (puthash query items flx-ido-narrowed-matches-hash))
- (destructuring-bind (exact items)
+ (flx-ido-cache query items))
+ (destructuring-bind (exact res-items)
(flx-ido-narrowed query items)
(if exact ; `ido-rotate' case is covered by
exact match
- items
- (puthash query (flx-ido-match-internal query items)
- flx-ido-narrowed-matches-hash)))))
+ res-items
+ (flx-ido-cache query (flx-ido-match-internal query res-items))))))
(defvar flx-ido-use t
"Use flx matching for ido.")
- [nongnu] elpa/flx 11f3fad14f 041/182: get complete cache key more smartly, (continued)
- [nongnu] elpa/flx 11f3fad14f 041/182: get complete cache key more smartly, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx c6601c7162 022/182: readme update, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a13d654096 045/182: disable caching for files/dirs for now, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1f175f3c65 047/182: add comment about disabling ido faces, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 222f60d28e 055/182: Merge pull request #18 from jschaf/master, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1d86d3bc09 052/182: cache clearing advice should be "before", ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a0de931381 048/182: bump version, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3b650d13f7 057/182: Merge pull request #23 from bbatsov/doc-improvements, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f3ccfc9168 049/182: make warning less dramatic, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx acf230e2c9 102/182: Lower default flx-ido-threshold -> 500., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a1ac8f97ec 034/182: fix `ido-merge-work-directories`,
ELPA Syncer <=
- [nongnu] elpa/flx f068b2bc1f 056/182: Improve the formatting of the README and extend it a bit, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1df93b286a 060/182: comment clarification, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a15638e403 064/182: Merge pull request #26 from bbatsov/master, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx c41f9f5087 065/182: reorder README sections, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx d77b703c37 069/182: Merge pull request #28 from bbatsov/marmalade, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 0c41fc616d 072/182: update package install instrucations, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx ce2d375f82 073/182: Makefile: introduce all, clean targets, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx e24352a502 074/182: add usage information, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 6800cc34a9 076/182: flx-ido: fix comment in advice for ido-set-matches-1, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 4cd6d9c9e4 078/182: flx: require cl-lib; avoid ugly eval-when-compile, ELPA Syncer, 2022/12/13