diff options
author | jao <jao@gnu.org> | 2021-07-29 02:52:06 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-07-29 02:52:06 +0100 |
commit | 191921b3118ad09f7d18caa31e33754b6387a953 (patch) | |
tree | 218c5b16a33a0a22be630cfb4ae3ef6977e09820 | |
parent | cfd3dde4aaede57fbe0cc9487675f7686b3afece (diff) | |
download | elibs-191921b3118ad09f7d18caa31e33754b6387a953.tar.gz elibs-191921b3118ad09f7d18caa31e33754b6387a953.tar.bz2 |
embark: finally, vindicator buffer structure recovered
-rw-r--r-- | completion.org | 36 |
1 files changed, 30 insertions, 6 deletions
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) |