diff options
author | jao <jao@gnu.org> | 2021-08-01 00:00:36 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-08-01 00:00:36 +0100 |
commit | 0be8a16ffd84c15d68ca9b6e733cac969175a5e0 (patch) | |
tree | 7b714c5a68bf01413e22010e5bcaa0b09a86e717 | |
parent | c8db2f28015179840e3e6f76044100baa31459cd (diff) | |
download | elibs-0be8a16ffd84c15d68ca9b6e733cac969175a5e0.tar.gz elibs-0be8a16ffd84c15d68ca9b6e733cac969175a5e0.tar.bz2 |
the neverending quest for the perfect embark indicator
-rw-r--r-- | completion.org | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/completion.org b/completion.org index 77bf93c..a1aac20 100644 --- a/completion.org +++ b/completion.org @@ -248,8 +248,9 @@ :init (setq embark-quit-after-action nil embark-verbose-indicator-buffer-sections - '(jao-embark--bindings "\n" target " - " shadowed-targets) - embark-indicator #'embark-verbose-indicator + '(jao-embark--bindings "\n" target " " jao-embark--other) + embark-indicator #'embark-mixed-indicator + embark-mixed-indicator-both nil embark-verbose-indicator-excluded-commands '(embark-become embark-export embark-collect) embark-verbose-indicator-nested nil @@ -267,13 +268,16 @@ (if (= lxk lyk) (string< x y) (< lxk lyk)))) (defun jao-embark--cmd-doc (cmd) - (ignore-errors - (propertize (car (split-string (documentation cmd) "\n")) - 'face 'embark-verbose-indicator-documentation))) + (propertize (car (split-string (or (embark--function-doc 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--other (&key shadowed-targets &allow-other-keys) + (propertize (format "%s" (or shadowed-targets "")) + 'face 'embark-verbose-indicator-shadowed)) + (cl-defun jao-embark--bindings (&key bindings &allow-other-keys) (let* ((cmds (mapcar #'caddr bindings)) (docs (mapcar #'jao-embark--cmd-doc cmds)) @@ -284,7 +288,7 @@ (cmds (mapcar (lambda (b) (propertize (cadr b) 'face 'embark-command)) bindings)) - (fmt (format "%%-%ds %%-%ds %%s\n" + (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) |