[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx 67379d0a01 036/182: 2nd try fix for `ido-merge-work-di
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx 67379d0a01 036/182: 2nd try fix for `ido-merge-work-directories` |
Date: |
Tue, 13 Dec 2022 03:59:23 -0500 (EST) |
branch: elpa/flx
commit 67379d0a0186e7e7800589356511d3b94dbca81a
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
2nd try fix for `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..354e0bc405 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 15
+;; Update #: 18
;; 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 (car-safe (car 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 807d694555 154/182: remove reference to `flx-ido-big-demo`, (continued)
- [nongnu] elpa/flx 807d694555 154/182: remove reference to `flx-ido-big-demo`, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx e05105872f 169/182: Begin sentences with capital letters and end them with a periods, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx dd47185f5b 173/182: flx-inc-vec: Improve doc-string, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 2a816e25df 151/182: Add file misc/.nosearch, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 4cf3f5ad45 059/182: Merge pull request #25 from bbatsov/improve-headers, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 11422574e5 166/182: Merge pull request #106 from jcs-PR/badge, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 647cb2f92f 168/182: Merge pull request #104 from phst/nocl, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx ae0981b253 156/182: Merge pull request #87 from spwhitton/apt-get, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 29e3664b75 175/182: Bump version to 0.6.2, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx ed11b39577 178/182: No longer bind obsolete max-specpdl-size, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 67379d0a01 036/182: 2nd try fix for `ido-merge-work-directories`,
ELPA Syncer <=
- [nongnu] elpa/flx 01818a56ae 039/182: handle of cons cells in completion list, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3d15906942 019/182: move demo into misc, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f1851c8983 037/182: treat last *non-zero* segment as basename, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 482b887215 046/182: (BREAKING) activate through proper minor-mode, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 451711cfeb 058/182: Improve comment headers, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx bebf045684 062/182: gracefully handle large collections, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 490412dcc9 061/182: Rename predicate functions according to Emacs Lisp style, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1c42be202d 071/182: Merge pull request #29 from bbatsov/marmalade, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 638313b829 077/182: .gitignore: ignore emacs temporary files, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 24dd436463 100/182: Fix compilation errors., ELPA Syncer, 2022/12/13