From 191921b3118ad09f7d18caa31e33754b6387a953 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 29 Jul 2021 02:52:06 +0100 Subject: embark: finally, vindicator buffer structure recovered --- completion.org | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'completion.org') diff --git a/completion.org b/completion.org index 4567db9..f5a6c29 100644 --- a/completion.org +++ b/completion.org @@ -91,7 +91,7 @@ :custom ((marginalia-align-offset 1) (marginalia-margin-threshold 200) (marginalia-separator-threshold 120) - (marginalia-truncate-width 80) + (marginalia-truncate-width 135) (marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil)))) (marginalia-mode 1) @@ -249,11 +249,35 @@ (use-package embark :ensure t :demand t - :custom ((embark-quit-after-action nil) - (embark-verbose-indicator-display-action - '((display-buffer-at-bottom) - (window-parameters (mode-line-format . none)) - (window-height . fit-window-to-buffer)))) + :init + (setq embark-quit-after-action nil + embark-verbose-indicator-buffer-sections + '(jao-embark--bindings newline target " - " other-targets) + embark-indicator #'embark-verbose-indicator + embark-verbose-indicator-nested nil + embark-verbose-indicator-display-action + '((display-buffer-at-bottom) + (window-parameters (mode-line-format . none)) + (window-height . fit-window-to-buffer))) + + (defvar jao-embark--brx + "^\\(\\([^ ] \\)+\\|RET\\|TAB\\|SPC\\)\\( *\\)\\([^ ]+ +\\)\\(.*\\)$") + + (defun jao-embark--cmp (x y) + (let* ((lxk (get-text-property 0 'kbd x)) + (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)))))) :bind (("C-;" . embark-act) ("C-'" . embark-dwim) -- cgit v1.2.3