[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/marginalia e2af1d3 019/241: Make marginalia-prompt-cate
From: |
Stefan Monnier |
Subject: |
[elpa] externals/marginalia e2af1d3 019/241: Make marginalia-prompt-categories an alist of regexps and categories |
Date: |
Fri, 28 May 2021 20:48:48 -0400 (EDT) |
branch: externals/marginalia
commit e2af1d34fe73e143a800e366fbb06ac6e2826c5b
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
Make marginalia-prompt-categories an alist of regexps and categories
---
marginalia.el | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/marginalia.el b/marginalia.el
index 1770403..53be877 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -87,12 +87,13 @@ determine it."
:group 'marginalia)
(defcustom marginalia-prompt-categories
- '((group . customize-group) (M-x . command) package face variable)
- "Words whose presence in a minibuffer prompt determins the category.
-The words should be given either as a symbol which if found in
-the prompt is the category name, or as a dotted pair of symbols,
-the presence of the first indicating the second is the category."
- :type '(repeat (choice symbol (cons symbol symbol)))
+ '(("\\<group\\>" . customize-group)
+ ("\\<M-x\\>" . command)
+ ("\\<package\\>" . package)
+ ("\\<face\\>" . face)
+ ("\\<variable\\>" . variable))
+ "Associates regexps to match against minibuffer prompts with categories."
+ :type '(alist :key-type regexp :value-type symbol)
:group 'marginalia)
(defcustom marginalia-command-category-alist nil
@@ -224,11 +225,12 @@ the presence of the first indicating the second is the
category."
'symbol)))
(defun marginalia-classify-by-prompt ()
- "Determine category by a special word in prompt."
+ "Determine category by matching regexps against the minibuffer prompt.
+This runs through the `marginalia-prompt-categories' alist
+looking for a regexp that matches the prompt."
(when-let ((prompt (minibuffer-prompt)))
- (cl-loop for spec in marginalia-prompt-categories
- for (word . category) = (if (consp spec) spec (cons spec spec))
- when (string-match-p (format "\\<%s\\>" word) prompt)
+ (cl-loop for (regexp . category) in marginalia-prompt-categories
+ when (string-match-p regexp prompt)
return category)))
(defun marginalia--completion-metadata-get (metadata prop)
- [elpa] externals/marginalia 0c090f3 011/241: improve readme, (continued)
- [elpa] externals/marginalia 0c090f3 011/241: improve readme, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 80fa320 016/241: Introduce list of classifiers, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia ca21d30 029/241: fix typo in the readme, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 655f03b 035/241: introduce marginalia-annotators-(light|heavy), remove marginalia-set-command-annotator, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 4cb6d2b 039/241: marginalia-annotate-file: add modes, user and group, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia ed74ca9 040/241: add marginalia-toggle-annotators, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 57b1176 051/241: marginalia-annotate-command-binding: only store the binding in the hash table, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 6537c37 015/241: Shorten first line of docstring using our "annotator" term, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 69ec4d7 017/241: Remove unused function, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 28defd6 014/241: Introduce new name "annotator" for annotation functions, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia e2af1d3 019/241: Make marginalia-prompt-categories an alist of regexps and categories,
Stefan Monnier <=
- [elpa] externals/marginalia 1c8ef02 020/241: Remove unused marginalia--metadata function, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia c05face 042/241: Improve marginalia-toggle-annotators if invoked from minibuffer, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 59d65af 018/241: Add basic classifiers: orginal category, symbols, by words in prompt, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 0f1e763 025/241: rename some variables for consistency, update readme, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia cd95c65 028/241: buffer annotation: add read-only status, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 675e680 036/241: improve annotator defcustoms, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 8be2daf 046/241: marginalia-annotate-file: remove unnecessary offset which only costs space for no reason, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia c8c3f87 045/241: Rename toggle -> cycle, improve documenation, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 1269445 049/241: marginalia-annotate-command-binding: cache key binding, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 376ccc5 048/241: Revert "fix marginalia--full-candidate for selectrum", Stefan Monnier, 2021/05/28