branch: externals/marginalia
commit d38041df2c2d175040bbdb1df6e4cc75a75ca4f8
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Stop providing an annotation-function
---
CHANGELOG.org | 5 +++++
marginalia.el | 20 ++++++++------------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index 5689bc6ea5..b74704745d 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -2,6 +2,11 @@
#+author: Omar AntolĂn Camarena, Daniel Mendler
#+language: en
+* Development
+
+- Stop providing an =annotation-function=. The =affixation-function= has been
+ supported since Emacs 28.1 and Marginalia requires Emacs 29.1.
+
* Version 2.5 (2025-11-15)
- Annotate definition prefix symbols which appear in =describe-function=,
diff --git a/marginalia.el b/marginalia.el
index bfc8dc5b0b..39007b0fe4 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -458,14 +458,17 @@ Otherwise stay within current buffer."
(defun marginalia-annotate-multi-category (cand)
"Annotate multi-category CAND, dispatching to the appropriate annotator."
(if-let ((multi (get-text-property 0 'multi-category cand))
- (annotate (marginalia--annotator (car multi))))
+ (fun (marginalia--annotator (car multi))))
;; Use the Marginalia annotator corresponding to the multi category.
- (funcall annotate (cdr multi))
+ (funcall fun (cdr multi))
;; Apply the original annotation function on the original candidate. Bypass
;; our `marginalia--completion-metadata-get' advice.
- (when-let (annotate (marginalia--orig-completion-metadata-get
- marginalia--metadata 'annotation-function))
- (funcall annotate cand))))
+ (if-let ((fun (marginalia--orig-completion-metadata-get
+ marginalia--metadata 'affixation-function)))
+ (caddar (funcall fun (list cand)))
+ (when-let ((fun (marginalia--orig-completion-metadata-get
+ marginalia--metadata 'annotation-function)))
+ (funcall fun cand)))))
(defconst marginalia--advice-regexp
(rx bos
@@ -1308,13 +1311,6 @@ completion UIs like Vertico or Icomplete."
METADATA is the metadata.
PROP is the property which is looked up."
(pcase prop
- ('annotation-function
- ;; We do want the advice triggered for `completion-metadata-get'.
- (when-let ((cat (completion-metadata-get metadata 'category))
- (annotator (marginalia--annotator cat)))
- (lambda (cand)
- (let ((ann (caddar (marginalia--affixate metadata annotator (list
cand)))))
- (and (not (equal ann "")) ann)))))
('affixation-function
;; We do want the advice triggered for `completion-metadata-get'.
(when-let ((cat (completion-metadata-get metadata 'category))