[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 99b6fa85a1 1/2: consult--multi: Preserve `multi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 99b6fa85a1 1/2: consult--multi: Preserve `multi-category` of candidates |
Date: |
Wed, 16 Feb 2022 19:57:22 -0500 (EST) |
branch: externals/consult
commit 99b6fa85a1419830bba532eeb37e899de5096b1c
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
consult--multi: Preserve `multi-category` of candidates
Use `multi-category` for `consult--source-project-recent-file`. Instead of
prepending an invisible project root, which still leads to accidential
matching,
attach a `multi-category` datum with the full file path.
---
consult.el | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/consult.el b/consult.el
index a2d3cb2634..d235423f6c 100644
--- a/consult.el
+++ b/consult.el
@@ -2136,7 +2136,12 @@ INHERIT-INPUT-METHOD, if non-nil the minibuffer inherits
the input method."
(dolist (item items)
(let ((cand (consult--tofu-append item idx))
(width (consult--display-width item)))
- (add-text-properties 0 (length item) `(,@face multi-category (,cat
. ,item)) cand)
+ (add-text-properties 0 (length item)
+ `(multi-category
+ ,(or (get-text-property 0 'multi-category
item)
+ (cons cat item))
+ ,@face)
+ cand)
(when (> width max-width) (setq max-width width))
(push cand candidates))))
(setq idx (1+ idx)))
@@ -4016,11 +4021,13 @@ If NORECORD is non-nil, do not record the buffer switch
in the buffer list."
,(lambda ()
(when-let (root (consult--project-root))
(let ((len (length root))
- (inv-root (propertize root 'invisible t))
(ht (consult--buffer-file-hash))
(filter (consult--regexp-filter consult-recent-file-filter)))
- (mapcar (lambda (x)
- (concat inv-root (substring x len)))
+ (mapcar (lambda (file)
+ (let ((part (substring file len)))
+ (put-text-property 0 (length part)
+ 'multi-category `(file . ,file) part)
+ part))
(seq-filter (lambda (x)
(and (not (gethash x ht))
(string-prefix-p root x)