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

    Remove consult--crm-setup-hook for now
---
 consult-selectrum.el | 13 ++++++++-----
 consult.el           | 15 +++++----------
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/consult-selectrum.el b/consult-selectrum.el
index 098a5ef..442e3f9 100644
--- a/consult-selectrum.el
+++ b/consult-selectrum.el
@@ -83,14 +83,17 @@ SPLIT is the splitter function."
     (setq-local selectrum-highlight-candidates-function
                (consult-selectrum--split-wrap 
selectrum-highlight-candidates-function split))))
 
-(defun consult-selectrum--crm-setup ()
-  "Setup crm for Selectrum."
-  (when selectrum-is-active
-    (setq-local selectrum-default-value-format nil)))
+(defun consult-selectrum--crm-adv (&rest args)
+  "Setup crm for Selectrum given ARGS."
+  (consult--minibuffer-with-setup-hook
+      (lambda ()
+        (when selectrum-is-active
+          (setq-local selectrum-default-value-format nil)))
+    (apply args)))
 
 (add-hook 'consult--completion-candidate-hook #'consult-selectrum--candidate)
 (add-hook 'consult--completion-refresh-hook #'consult-selectrum--refresh)
-(add-hook 'consult--crm-setup-hook #'consult-selectrum--crm-setup)
+(advice-add #'consult-completing-read-multiple :around 
#'consult-selectrum--crm-adv)
 (advice-add #'consult--completion-filter :around 
#'consult-selectrum--filter-adv)
 (advice-add #'consult--split-setup :around 
#'consult-selectrum--split-setup-adv)
 (define-key consult-async-map [remap selectrum-insert-current-candidate] 
#'selectrum-next-page)
diff --git a/consult.el b/consult.el
index c107d5c..473f6c2 100644
--- a/consult.el
+++ b/consult.el
@@ -446,9 +446,6 @@ should not be considered as stable as the public API.")
 (defvar consult--cache nil
   "Cached data populated by `consult--define-cache'.")
 
-(defvar consult--crm-setup-hook nil
-  "Hook executed in `consult-completing-read-multiple' minibuffer.")
-
 (defvar consult--completion-candidate-hook
   (list #'consult--default-completion-mb-candidate
         #'consult--default-completion-list-candidate)
@@ -2256,13 +2253,11 @@ See `completing-read-multiple' for the documentation of 
the arguments."
                    (setq command this-command this-command wrapper))))
     (unwind-protect
         (consult--minibuffer-with-setup-hook
-            (:append
-             (lambda ()
-               (when-let (pos (string-match-p "\\(?: (default[^)]+)\\)?: \\'" 
prompt))
-                 (setq overlay (make-overlay (+ (point-min) pos) (+ 
(point-min) (length prompt))))
-                 (when selected
-                   (overlay-put overlay 'display (format " (%s selected): " 
(length selected)))))
-               (run-hooks 'consult--crm-setup-hook)))
+            (lambda ()
+              (when-let (pos (string-match-p "\\(?: (default[^)]+)\\)?: \\'" 
prompt))
+                (setq overlay (make-overlay (+ (point-min) pos) (+ (point-min) 
(length prompt))))
+                (when selected
+                  (overlay-put overlay 'display (format " (%s selected): " 
(length selected))))))
           (add-hook 'pre-command-hook hook 90)
           (let ((result
                  (completing-read

Reply via email to