diff options
author | João Távora <joaotavora@gmail.com> | 2021-05-24 16:31:39 +0100 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2021-05-26 00:47:22 +0100 |
commit | 93342b5776f4ad0819b2822c17bd3b836442c218 (patch) | |
tree | 7d9393ddb47732a99052be5a58f215b00078ca3a /lisp/minibuffer.el | |
parent | 2e55201b8085d64c76d9a35bffff90a02133647e (diff) | |
download | emacs-scratch/annotation-function-improvements.tar.gz |
Overhaul annotation-function to match affixation-functionscratch/annotation-function-improvements
* doc/lispref/minibuf.texi (Programmed Completion): Rework
annotation-function and affixation-function.
* lisp/help-fns.el (help--symbol-completion-table-annotation): Rename
from help--symbol-completion-table-affixation.
(help--symbol-completion-table): Use
help--symbol-completion-table-annotation.
* lisp/minibuffer.el (minibuffer-completion-help): Interpret
annotation-function with more sophistication.
* lisp/simple.el (read-extended-command): Use
read-extended-command--annotation
(read-extended-command--annotation): Rename from
read-extended-command--affixation
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r-- | lisp/minibuffer.el | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index e04f1040b38..966613aa99c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2251,11 +2251,20 @@ variables.") (funcall aff-fun completions))) (ann-fun (setq completions - (mapcar (lambda (s) - (let ((ann (funcall ann-fun s))) - (if ann (list s ann) s))) - completions)))) - + (mapcar + (lambda (s) + (let* ((ann (funcall ann-fun s)) + (prefix-hint + (and ann + (get-text-property 0 'prefix ann))) + (suffix-hint + (and ann + (get-text-property 0 'suffix ann)))) + (cond (prefix-hint + (list s prefix-hint (or suffix-hint ""))) + (ann (list s ann)) + (t s)))) + completions)))) (with-current-buffer standard-output (setq-local completion-base-position (list (+ start base-size) |