Normify embark
This commit is contained in:
parent
2b6e7bd5aa
commit
25016489a0
1 changed files with 2 additions and 35 deletions
|
|
@ -1213,44 +1213,11 @@ Idk I think this came from the vertico readme
|
||||||
:hook
|
:hook
|
||||||
(embark-collect-mode . consult-preview-at-point-mode))
|
(embark-collect-mode . consult-preview-at-point-mode))
|
||||||
|
|
||||||
;; https://github.com/oantolin/embark/wiki/Additional-Configuration#use-which-key-like-a-key-menu-prompt
|
;; Use mixed indicator: minimal prompt that switches to completing-read for narrowing
|
||||||
(defun embark-which-key-indicator ()
|
|
||||||
"An embark indicator that displays keymaps using which-key.
|
|
||||||
The which-key help message will show the type and value of the
|
|
||||||
current target followed by an ellipsis if there are further
|
|
||||||
targets."
|
|
||||||
(lambda (&optional keymap targets prefix)
|
|
||||||
(if (null keymap)
|
|
||||||
(which-key--hide-popup-ignore-command)
|
|
||||||
(which-key--show-keymap
|
|
||||||
(if (eq (plist-get (car targets) :type) 'embark-become)
|
|
||||||
"Become"
|
|
||||||
(format "Act on %s '%s'%s"
|
|
||||||
(plist-get (car targets) :type)
|
|
||||||
(embark--truncate-target (plist-get (car targets) :target))
|
|
||||||
(if (cdr targets) "…" "")))
|
|
||||||
(if prefix
|
|
||||||
(pcase (lookup-key keymap prefix 'accept-default)
|
|
||||||
((and (pred keymapp) km) km)
|
|
||||||
(_ (key-binding prefix 'accept-default)))
|
|
||||||
keymap)
|
|
||||||
nil nil t (lambda (binding)
|
|
||||||
(not (string-suffix-p "-argument" (cdr binding))))))))
|
|
||||||
|
|
||||||
(setq embark-indicators
|
(setq embark-indicators
|
||||||
'(embark-which-key-indicator
|
'(embark-mixed-indicator
|
||||||
embark-highlight-indicator
|
embark-highlight-indicator
|
||||||
embark-isearch-highlight-indicator))
|
embark-isearch-highlight-indicator))
|
||||||
|
|
||||||
(defun embark-hide-which-key-indicator (fn &rest args)
|
|
||||||
"Hide the which-key indicator immediately when using the completing-read prompter."
|
|
||||||
(which-key--hide-popup-ignore-command)
|
|
||||||
(let ((embark-indicators
|
|
||||||
(remq #'embark-which-key-indicator embark-indicators)))
|
|
||||||
(apply fn args)))
|
|
||||||
|
|
||||||
(advice-add #'embark-completing-read-prompter
|
|
||||||
:around #'embark-hide-which-key-indicator)
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue