summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--completion.org41
1 files changed, 30 insertions, 11 deletions
diff --git a/completion.org b/completion.org
index f5a6c29..0699ad3 100644
--- a/completion.org
+++ b/completion.org
@@ -252,8 +252,10 @@
:init
(setq embark-quit-after-action nil
embark-verbose-indicator-buffer-sections
- '(jao-embark--bindings newline target " - " other-targets)
+ '(jao-embark--bindings "\n" target " - " shadowed-targets)
embark-indicator #'embark-verbose-indicator
+ embark-verbose-indicator-excluded-commands
+ '(embark-become embark-export embark-collect)
embark-verbose-indicator-nested nil
embark-verbose-indicator-display-action
'((display-buffer-at-bottom)
@@ -268,16 +270,33 @@
(lyk (get-text-property 0 'kbd y)))
(if (= lxk lyk) (string< x y) (< lxk lyk))))
- (defun jao-embark--bindings (_ bindings _)
- (let ((strs (embark--verbose-indicator-format-bindings bindings))
- (res nil))
- (dolist (str strs (seq-sort #'jao-embark--cmp res))
- (when (string-match jao-embark--brx str)
- (let ((s (replace-match "\\4 \\1\\3 \\5" nil nil str))
- (k (if (string-prefix-p "embark-" (match-string 4 str))
- 10
- (length (match-string 1 str)))))
- (push (propertize s 'kbd k) res))))))
+ (defun jao-embark--cmd-doc (cmd)
+ (ignore-errors
+ (propertize (car (split-string (documentation cmd) "\n"))
+ 'face 'embark-verbose-indicator-documentation)))
+
+ (defun jao--max-len (strs)
+ (seq-reduce (lambda (m x) (max m (length x))) strs 0))
+
+ (cl-defun jao-embark--bindings (&key bindings &allow-other-keys)
+ (let* ((cmds (mapcar #'caddr bindings))
+ (docs (mapcar #'jao-embark--cmd-doc cmds))
+ (keys (mapcar (lambda (b)
+ (propertize (car (last b))
+ 'face 'embark-keybinding))
+ bindings))
+ (cmds (mapcar (lambda (b)
+ (propertize (cadr b) 'face 'embark-command))
+ bindings))
+ (fmt (format "%%-%ds %%-%ds %%s\n"
+ (jao--max-len cmds) (jao--max-len keys)))
+ (res (seq-mapn (lambda (c k d)
+ (let ((n (if (string-prefix-p "embark-" c)
+ 10
+ (length k))))
+ (propertize (format fmt c k d) 'kbd n)))
+ cmds keys docs)))
+ (apply #'concat (seq-sort #'jao-embark--cmp res))))
:bind (("C-;" . embark-act)
("C-'" . embark-dwim)