branch: externals/consult
commit 1bf2773d51382a443dd6aac9b9f7acda189515b8
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>

    consult-man: Use consult-man property for candidates
    
    See https://github.com/oantolin/embark/issues/584
---
 consult-info.el |  3 ---
 consult.el      | 22 ++++++++++++----------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/consult-info.el b/consult-info.el
index 930f9c6397..6682002e16 100644
--- a/consult-info.el
+++ b/consult-info.el
@@ -153,9 +153,6 @@
            :sort nil
            :history '(:input consult-info--history)
            :group #'consult--prefix-group
-           ;; TODO fix consult-man and consult-info embark integration
-           ;; We have to set (alist-get '(general . consult-man) 
embark-default-action-overrides)
-           ;; and (alist-get '(general . consult-info) 
embark-default-action-overrides)
            :initial (consult--async-split-initial "")
            :lookup #'consult--lookup-member))
       (dolist (buf buffers)
diff --git a/consult.el b/consult.el
index 5db2b26421..4d6e74064a 100644
--- a/consult.el
+++ b/consult.el
@@ -4850,15 +4850,16 @@ details regarding the asynchronous search."
     (save-match-data
       (dolist (str lines)
         (when (string-match "\\`\\(.*?\\([^ ]+\\) *(\\([^,)]+\\)[^)]*).*?\\) 
+- +\\(.*\\)\\'" str)
-          (let ((names (match-string 1 str))
-                (name (match-string 2 str))
-                (section (match-string 3 str))
-                (desc (match-string 4 str)))
-            (add-face-text-property 0 (length names) 'consult-file nil names)
-            (push (cons
-                   (format "%s - %s" names desc)
-                   (concat section " " name))
-                  candidates)))))
+          (let* ((names (match-string 1 str))
+                 (name (match-string 2 str))
+                 (section (match-string 3 str))
+                 (desc (match-string 4 str))
+                 (cand (format "%s - %s" names desc)))
+            (add-text-properties 0 (length names)
+                                 (list 'face 'consult-file
+                                       'consult-man (concat section " " name))
+                                 cand)
+            (push cand candidates)))))
     (nreverse candidates)))
 
 ;;;###autoload
@@ -4876,7 +4877,8 @@ the asynchronous search."
           (consult--async-highlight #'consult--man-builder))
         :prompt "Manual entry: "
         :require-match t
-        :lookup #'consult--lookup-cdr
+        :category 'consult-man
+        :lookup (apply-partially #'consult--lookup-prop 'consult-man)
         :initial (consult--async-split-initial initial)
         :add-history (consult--async-split-thingatpt 'symbol)
         :history '(:input consult--man-history))))

Reply via email to