[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx 01818a56ae 039/182: handle of cons cells in completion
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx 01818a56ae 039/182: handle of cons cells in completion list |
Date: |
Tue, 13 Dec 2022 03:59:23 -0500 (EST) |
branch: elpa/flx
commit 01818a56aea28bdf1696c59758d6c62268fd31a8
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
handle of cons cells in completion list
#11
---
flx-ido.el | 27 ++++++++++++---------------
flx.el | 39 ++++++++++++++++++++++++---------------
2 files changed, 36 insertions(+), 30 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index bca362aca4..e8596e6490 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 23
+;; Update #: 30
;; URL:
;; Keywords:
;; Compatibility:
@@ -118,20 +118,17 @@ item, in which case, the ending items are deleted."
(defun flx-ido-decorate (things &optional clear)
- (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)))))))
+ (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
+ (flx-propertize thing nil)
+ (flx-propertize (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
diff --git a/flx.el b/flx.el
index 0588f2d072..5f2e64ede8 100644
--- a/flx.el
+++ b/flx.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 15
+;; Update #: 17
;; URL:
;; Keywords:
;; Compatibility:
@@ -321,21 +321,30 @@ e.g. (\"aab\" \"ab\") returns
best-score)))
-(defun flx-propertize (str score &optional add-score)
- "Return propertized string according to score."
+(defun flx-propertize (obj score &optional add-score)
+ "Return propertized copy of obj according to score.
+
+SCORE of nil means to clear the properties."
(let ((block-started (cadr score))
- (last-char nil))
- (loop for char in (cdr score)
- do (progn
- (when (and last-char
- (not (= (1+ last-char) char)))
- (put-text-property block-started (1+ last-char) 'face
'flx-highlight-face str)
- (setq block-started char))
- (setq last-char char)))
- (put-text-property block-started (1+ last-char) 'face 'flx-highlight-face
str)
- (when add-score
- (setq str (format "%s [%s]" str (car score))))
- str))
+ (last-char nil)
+ (str (if (consp obj)
+ (substring-no-properties (car obj))
+ (substring-no-properties obj))))
+
+ (unless (null score)
+ (loop for char in (cdr score)
+ do (progn
+ (when (and last-char
+ (not (= (1+ last-char) char)))
+ (put-text-property block-started (1+ last-char) 'face
'flx-highlight-face str)
+ (setq block-started char))
+ (setq last-char char)))
+ (put-text-property block-started (1+ last-char) 'face
'flx-highlight-face str)
+ (when add-score
+ (setq str (format "%s [%s]" str (car score)))))
+ (if (consp obj)
+ (cons str (cdr obj))
+ str)))
- [nongnu] elpa/flx e05105872f 169/182: Begin sentences with capital letters and end them with a periods, (continued)
- [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, 2022/12/13
- [nongnu] elpa/flx 01818a56ae 039/182: handle of cons cells in completion list,
ELPA Syncer <=
- [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
- [nongnu] elpa/flx b322b72d7b 131/182: async comes from melpa, ELPA Syncer, 2022/12/13