[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx 3d631fdd38 101/182: Improve behaviour backspacing flx
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx 3d631fdd38 101/182: Improve behaviour backspacing flx -> flex. |
Date: |
Tue, 13 Dec 2022 03:59:34 -0500 (EST) |
branch: elpa/flx
commit 3d631fdd381da2415c922bcc199a0a7e7f1ce8bc
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
Improve behaviour backspacing flx -> flex.
- Keep flx highlights if still within threshold.
- #55
---
flx-ido.el | 45 ++++++++++++++++++++++++++++++---------------
1 file changed, 30 insertions(+), 15 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index 56465ae29c..70fb36343c 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -213,22 +213,37 @@ non-nil."
(when flx-ido-mode
(flx-ido-reset)))
-(defadvice ido-set-matches-1 (around flx-ido-set-matches-1 activate)
+(defadvice ido-set-matches-1 (around flx-ido-set-matches-1 activate compile)
"Choose between the regular ido-set-matches-1 and flx-ido-match"
- (flx-ido-debug "id-set-matches-1 sees %s items" (length (ad-get-arg 0)))
- (let* ((query ido-text)
- (items (or (and
- (flx-ido-is-prefix-match query (car flx-ido-last-run))
- (cdr-safe flx-ido-last-run))
- (ad-get-arg 0))))
- (setq flx-ido-last-run (cons
- query
- (if (or (not flx-ido-mode)
- (> (length items) flx-ido-threshold))
- ad-do-it
- (flx-ido-match query items)))))
- (setq ad-return-value (cdr flx-ido-last-run))
- (flx-ido-debug "id-set-matches-1 returning %s " ad-return-value))
+ (if (not flx-ido-mode)
+ ad-do-it
+ (let* ((query ido-text)
+ (original-items (ad-get-arg 0))
+ (foo (ad-get-arg 0))
+ filtered-items
+ items)
+ (setq test (ad-get-arg 0))
+ (message "original-items: %s" original-items)
+ (message "test: %s" test)
+ (flx-ido-debug "id-set-matches-1 sees %s items" (length original-items))
+ (setq items (cond ((flx-ido-is-prefix-match query (car flx-ido-last-run))
+ (cdr flx-ido-last-run))
+ ((< (length original-items) flx-ido-threshold)
+ original-items)
+ (t
+ ;; Why??? does not work if I don't set it here.
+ (ad-set-arg 0 original-items)
+ (setq filtered-items ad-do-it)
+ (if (< (length filtered-items) flx-ido-threshold)
+ filtered-items
+ :too-big))))
+ (if (eq items :too-big)
+ (progn
+ (flx-ido-reset)
+ (setq ad-return-value filtered-items))
+ (setq ad-return-value (flx-ido-match query items))
+ (setq flx-ido-last-run (cons query ad-return-value))))
+ (flx-ido-debug "id-set-matches-1 returning %s " ad-return-value)))
(defadvice ido-kill-buffer-at-head (before flx-ido-reset activate)
"Keep up with modification as required."
- [nongnu] elpa/flx 2903e5d2a7 084/182: Merge pull request #42 from bbatsov/byte-compile-warning, (continued)
- [nongnu] elpa/flx 2903e5d2a7 084/182: Merge pull request #42 from bbatsov/byte-compile-warning, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9440288782 086/182: Refactor to make prefix match clear., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a1fef07104 087/182: Fix C-k to kill buffer at head., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 12589211c6 088/182: Implement case-fold searching, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 80bb88c32f 092/182: Clean test .elcs but never compile them., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 5591055c33 093/182: Recommend enabling ido-flex., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 48ebd6c857 094/182: Make prefix-matchine one way., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1f46d67762 096/182: Update big list experiment., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx df036210c6 098/182: Switch to 24.4 delete dup runs algorithm., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3fdaea3ec7 097/182: Respecting flx-ido-threshhold., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3d631fdd38 101/182: Improve behaviour backspacing flx -> flex.,
ELPA Syncer <=
- [nongnu] elpa/flx c75f14fbc2 104/182: Fix docstring bugs from checkdoc., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 6797797426 105/182: Update status in README.md., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a154058007 108/182: Use ido's name canonicalization., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx acd4334893 109/182: Increase threshold to 2000., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a59c08283d 110/182: Simplify caching, implement own flex., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3032920883 117/182: Fix search results changing positions as you type., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 46a1b29482 118/182: Merge pull request #62 from bsuh/fix61, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 5fe7f8a94a 121/182: Add algorithmic optimizations, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx b9c2d42b67 122/182: Remove deprecated tests, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 41842ff7b3 123/182: Small performance tweaks, ELPA Syncer, 2022/12/13