fix(vertico): gate which-key integration

This prevents an error for users disabling which-key.
This commit is contained in:
Liam Hupfer 2023-09-02 11:44:48 -05:00
parent b261afe59d
commit 3d82e3d46d

View file

@ -253,14 +253,16 @@ orderless."
(set-popup-rule! "^\\*Embark Export:" :size 0.35 :ttl 0 :quit nil) (set-popup-rule! "^\\*Embark Export:" :size 0.35 :ttl 0 :quit nil)
(defadvice! +vertico--embark-which-key-prompt-a (fn &rest args) (after! which-key
"Hide the which-key indicator immediately when using the completing-read prompter." (defadvice! +vertico--embark-which-key-prompt-a (fn &rest args)
:around #'embark-completing-read-prompter "Hide the which-key indicator immediately when using the completing-read prompter."
(which-key--hide-popup-ignore-command) :around #'embark-completing-read-prompter
(let ((embark-indicators (which-key--hide-popup-ignore-command)
(remq #'embark-which-key-indicator embark-indicators))) (let ((embark-indicators
(apply fn args))) (remq #'embark-which-key-indicator embark-indicators)))
(cl-nsubstitute #'+vertico-embark-which-key-indicator #'embark-mixed-indicator embark-indicators) (apply fn args)))
(cl-nsubstitute #'+vertico-embark-which-key-indicator #'embark-mixed-indicator embark-indicators))
;; add the package! target finder before the file target finder, ;; add the package! target finder before the file target finder,
;; so we don't get a false positive match. ;; so we don't get a false positive match.
(let ((pos (or (cl-position (let ((pos (or (cl-position