[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/marginalia 0f1e763 025/241: rename some variables for c
From: |
Stefan Monnier |
Subject: |
[elpa] externals/marginalia 0f1e763 025/241: rename some variables for consistency, update readme |
Date: |
Fri, 28 May 2021 20:48:49 -0400 (EDT) |
branch: externals/marginalia
commit 0f1e763b0621c45ddfbdfebab3e05cb9eb5f23ae
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
rename some variables for consistency, update readme
---
README.md | 17 ++++++++++++-----
marginalia.el | 16 ++++++++--------
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index ff58798..bb18692 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,23 @@
# marginalia.el - Marginalia in the minibuffer
+![marginalia-mode with
Selectrum](https://github.com/minad/marginalia/blob/main/marginalia-mode.png?raw=true)
+
This package provides `marginalia-mode` which adds marginalia to the minibuffer
completions. [Marginalia](https://en.wikipedia.org/wiki/Marginalia) are marks
or
annotations placed at the margin of the page of a book or in this case helpful
colorful annotations placed at the margin of the minibuffer for your completion
candidates. The annotations are added based on the completion category. For
example `find-file` reports the `file` category and `M-x` reports the `command`
-category. Furthermore the package allows to associate completion categories to
-commands, since many commands (in contrast to `find-file` and `M-x`) do not
-specify a completion category themselves.
+category.
-![marginalia-mode with
Selectrum](https://github.com/minad/marginalia/blob/main/marginalia-mode.png?raw=true)
+Since many commands do not report a completion category themselves, Marginalia
+provides a classifier system, which tries to guess the correct category based
+for example on the prompt (see the variable `marginalia-prompt-categories`).
+Usually these heuristic classifiers work well, but if they do not there is
+always the possibility to overwrite categories by command name. This way you
can
+associate a fixed category with the completion initiated by the command (see
the
+variable `marginalia-command-categories`). The list of available classifiers is
+specified by the variable `marginalia-classifiers`.
## Configuration
@@ -29,6 +36,6 @@ specify a completion category themselves.
;; * marginalia-annotate-symbol: Annotate with the documentation string
;; * marginalia-annotate-command-binding (default): Annotate only with the
keybinding
;; * marginalia-annotate-command-full: Annotate with the keybinding and the
documentation string
- ;; (setf (alist-get 'command marginalia-annotator-alist)
#'marginalia-annotate-command-full)
+ ;; (setf (alist-get 'command marginalia-annotators)
#'marginalia-annotate-command-full)
)
~~~
diff --git a/marginalia.el b/marginalia.el
index 47ced57..52aa5bf 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -59,7 +59,7 @@
:type 'integer
:group 'marginalia)
-(defcustom marginalia-annotator-alist
+(defcustom marginalia-annotators
'((command . marginalia-annotate-command-binding)
(customize-group . marginalia-annotate-customize-group)
(variable . marginalia-annotate-variable)
@@ -96,7 +96,7 @@ determine it."
:type '(alist :key-type regexp :value-type symbol)
:group 'marginalia)
-(defcustom marginalia-command-category-alist nil
+(defcustom marginalia-command-categories nil
"Associate commands with a completion category."
:type '(alist :key-type symbol :value-type symbol)
:group 'marginalia)
@@ -226,7 +226,7 @@ determine it."
(defun marginalia-classify-by-command-name ()
"Lookup category for current command."
(and marginalia--this-command
- (alist-get marginalia--this-command marginalia-command-category-alist)))
+ (alist-get marginalia--this-command marginalia-command-categories)))
(defun marginalia-classify-original-category ()
"Return original category reported by completion metadata."
@@ -264,7 +264,7 @@ PROP is the property which is looked up."
('annotation-function
(when-let (cat (completion-metadata-get metadata 'category))
;; we do want the advice triggered for completion-metadata-get
- (alist-get cat marginalia-annotator-alist)))
+ (alist-get cat marginalia-annotators)))
('category
(let ((marginalia--original-category (alist-get 'category metadata)))
;; using alist-get in the line above bypasses any advice on
@@ -296,12 +296,12 @@ Remember `this-command' for annotation."
;;;###autoload
(defun marginalia-set-command-annotator (cmd ann)
"Configure marginalia so that annotator ANN is used for command CMD."
- (setq marginalia-command-category-alist
+ (setq marginalia-command-categories
(cons (cons cmd cmd)
- (assq-delete-all cmd marginalia-command-category-alist)))
- (setq marginalia-command-category-alist
+ (assq-delete-all cmd marginalia-command-categories)))
+ (setq marginalia-command-categories
(cons (cons cmd ann)
- (assq-delete-all cmd marginalia-annotator-alist))))
+ (assq-delete-all cmd marginalia-annotators))))
(provide 'marginalia)
;;; marginalia.el ends here
- [elpa] externals/marginalia 4cb6d2b 039/241: marginalia-annotate-file: add modes, user and group, (continued)
- [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, 2021/05/28
- [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 <=
- [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
- [elpa] externals/marginalia ccefc57 052/241: marginalia-annotate-command-binding: add comment, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 597186d 065/241: add marginalia-annotate-minor-mode, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 14dce57 062/241: scale field widths such that annotations look better on smaller windows, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 7d3719d 074/241: Fix advice skipping regexp for older Emacsen, Stefan Monnier, 2021/05/28