branch: externals/marginalia
commit 18cfe2350347806d0cbb327a23695e0c1a6c2700
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
marginalia-annotate-virtual-buffer/marginalia-annotate-minor-mode: no
narrow prefix
Remove narrowing prefixes from Consult where possible.
Adapt Marginalia accordingly.
See https://github.com/minad/consult/issues/86
and
https://github.com/minad/consult/commit/86cb707407132248dcadb370b041ad4a95a42c8a.
---
marginalia.el | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/marginalia.el b/marginalia.el
index ca03c8a..bc89df7 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -320,7 +320,7 @@ This hash table is needed to speed up
`marginalia-annotate-binding'.")
(defun marginalia-annotate-virtual-buffer-class (cand)
"Annotate virtual-buffer CAND with the buffer class."
(marginalia--fields
- ((pcase (elt cand 0)
+ ((pcase (- (elt cand 0) #x100000)
(?b "Buffer")
(?f "File")
(?m "Bookmark")
@@ -330,12 +330,10 @@ This hash table is needed to speed up
`marginalia-annotate-binding'.")
;; This annotator is consult-specific, it will annotate the `consult-buffer'
command.
(defun marginalia-annotate-virtual-buffer-full (cand)
"Annotate virtual-buffer CAND with the buffer class."
- ;; Strip consult narrowing prefix
- (let ((cand-without-prefix (replace-regexp-in-string "^.[[:nonascii:]] " ""
cand)))
- (pcase (elt cand 0)
- (?b (marginalia-annotate-buffer cand-without-prefix))
- (?f (marginalia-annotate-file cand-without-prefix))
- (_ (marginalia-annotate-virtual-buffer-class cand)))))
+ (pcase (- (elt cand 0) #x100000)
+ (?b (marginalia-annotate-buffer (substring cand 1)))
+ (?f (marginalia-annotate-file (substring cand 1)))
+ (_ (marginalia-annotate-virtual-buffer-class cand))))
(defconst marginalia--advice-regexp
(rx bos
@@ -467,8 +465,7 @@ Similar to `marginalia-annotate-symbol', but does not show
symbol class."
(defun marginalia-annotate-minor-mode (cand)
"Annotate minor-mode CAND with status and documentation string."
- (let* ((cand (replace-regexp-in-string "^\\(.[[:nonascii:]] \\)+" "" cand))
;; Strip consult narrowing prefix
- (sym (intern-soft cand))
+ (let* ((sym (intern-soft cand))
(mode (if (and sym (boundp sym))
sym
(lookup-minor-mode-from-indicator cand)))