emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/consult 97dc258 1/2: consult--crm-selected: Return orig


From: ELPA Syncer
Subject: [elpa] externals/consult 97dc258 1/2: consult--crm-selected: Return original candidates
Date: Mon, 13 Dec 2021 12:57:13 -0500 (EST)

branch: externals/consult
commit 97dc258b7ed5d08a3872b01acb57aa2c813a3c84
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    consult--crm-selected: Return original candidates
---
 consult.el | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/consult.el b/consult.el
index 2bdf8a1..57193ee 100644
--- a/consult.el
+++ b/consult.el
@@ -2390,13 +2390,15 @@ These configuration options are supported:
 (defun consult--crm-selected ()
   "Return selected candidates from `consult-completing-read-multiple'."
   (when (eq minibuffer-history-variable 'consult--crm-history)
-    (all-completions
-     "" minibuffer-completion-table
-     (lambda (cand)
-       (and (stringp cand)
-            (get-text-property 0 'consult--crm-selected cand)
-            (or (not minibuffer-completion-predicate)
-                (funcall minibuffer-completion-predicate cand)))))))
+    (mapcar
+     (apply-partially #'get-text-property 0 'consult--crm-selected)
+     (all-completions
+      "" minibuffer-completion-table
+      (lambda (cand)
+        (and (stringp cand)
+             (get-text-property 0 'consult--crm-selected cand)
+             (or (not minibuffer-completion-predicate)
+                 (funcall minibuffer-completion-predicate cand))))))))
 
 ;;;###autoload
 (defun consult-completing-read-multiple (prompt table &optional
@@ -2412,10 +2414,13 @@ See `completing-read-multiple' for the documentation of 
the arguments."
            (all-completions "" table pred)))
          (format-item
           (lambda (item)
-            ;; Restore original candidate in order to preserve formatting
-            (setq item (propertize (or (car (member item orig-items)) item)
-                                   'consult--crm-selected t
-                                   'line-prefix (cdr consult-crm-prefix)))
+            (setq item (propertize
+                        ;; Restore original candidate in order to preserve 
formatting
+                        (or (get-text-property 0 'consult--crm-selected item)
+                            (car (member item orig-items))
+                            item)
+                        'consult--crm-selected item
+                        'line-prefix (cdr consult-crm-prefix)))
             (add-face-text-property 0 (length item) 'consult-crm-selected 
'append item)
             item))
          (separator (or (bound-and-true-p crm-separator) "[ \t]*,[ \t]*"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]