From 0be8a16ffd84c15d68ca9b6e733cac969175a5e0 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 1 Aug 2021 00:00:36 +0100 Subject: the neverending quest for the perfect embark indicator --- completion.org | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'completion.org') 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) -- cgit v1.2.3