emacs-elpa-diffs
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]