branch: externals/marginalia
commit 16b7d03088656b597a253418e41a4a62c811993d
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>

    Require Emacs 28.1
---
 CHANGELOG.org |  4 ++++
 marginalia.el | 22 +++++++++-------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index c9cc6b4c44..0718546fa0 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -2,6 +2,10 @@
 #+author: Omar Antolín Camarena, Daniel Mendler
 #+language: en
 
+* Development
+
+- Require Emacs 28.1.
+
 * Version 1.7 (2024-07-26)
 
 - Bump Compat dependency to Compat 30.
diff --git a/marginalia.el b/marginalia.el
index f007810539..6d24a1f755 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -6,7 +6,7 @@
 ;; Maintainer: Omar Antolín Camarena <o...@matem.unam.mx>, Daniel Mendler 
<m...@daniel-mendler.de>
 ;; Created: 2020
 ;; Version: 1.7
-;; Package-Requires: ((emacs "27.1") (compat "30"))
+;; Package-Requires: ((emacs "28.1") (compat "30"))
 ;; Homepage: https://github.com/minad/marginalia
 ;; Keywords: docs, help, matching, completion
 
@@ -304,6 +304,7 @@ The value of `this-command' is used as key for the lookup."
 (declare-function bookmark-prop-get "bookmark")
 
 (declare-function project-current "project")
+(declare-function project-root "project")
 
 (defvar package--builtins)
 (defvar package-archive-contents)
@@ -1048,9 +1049,7 @@ These annotations are skipped for remote paths."
                         prompt)
                        (match-string 1 prompt)))
                 (when-let (proj (project-current))
-                  (cond
-                   ((fboundp 'project-root) (project-root proj))
-                   ((fboundp 'project-roots) (car (project-roots proj))))))))
+                  (project-root proj)))))
     marginalia--project-root))
 
 (defun marginalia-annotate-project-file (cand)
@@ -1171,8 +1170,8 @@ These annotations are skipped for remote paths."
   "Return original category reported by completion metadata."
   ;; Bypass our `marginalia--completion-metadata-get' advice.
   (when-let (cat (marginalia--orig-completion-metadata-get 
marginalia--metadata 'category))
-    ;; Ignore Emacs 28 symbol-help category in order to ensure that the
-    ;; categories are refined to our categories function and variable.
+    ;; Ignore `symbol-help' category in order to ensure that the categories are
+    ;; refined to our categories function and variable.
     (and (not (eq cat 'symbol-help)) cat)))
 
 (defun marginalia-classify-symbol ()
@@ -1226,8 +1225,7 @@ completion UIs like Vertico or Icomplete."
    (when-let (align (text-property-any 0 (length ann) 'marginalia--align t 
ann))
      (setq marginalia--cand-width-max
            (max marginalia--cand-width-max
-                (* (ceiling (+ (string-width cand)
-                               (compat-call string-width ann 0 align))
+                (* (ceiling (+ (string-width cand) (string-width ann 0 align))
                             marginalia--cand-width-step)
                    marginalia--cand-width-step)))))
   (cl-loop
@@ -1241,7 +1239,7 @@ completion UIs like Vertico or Icomplete."
                    ('center `(+ center ,marginalia-align-offset))
                    ('left `(+ left ,(+ marginalia-align-offset 
marginalia--cand-width-max)))
                    ('right `(+ right ,(+ marginalia-align-offset 1
-                                         (- (compat-call string-width ann 0 
align)
+                                         (- (string-width ann 0 align)
                                             (string-width ann)))))))
         ann))
      (list cand "" ann))))
@@ -1333,6 +1331,8 @@ Remember `this-command' for 
`marginalia-classify-by-command-name'."
 ;;;###autoload
 (defun marginalia-cycle ()
   "Cycle between annotators in `marginalia-annotator-registry'."
+  ;; Only show `marginalia-cycle' in M-x in recursive minibuffers
+  (declare (completion (lambda (&rest _) (> (minibuffer-depth) 1))))
   (interactive)
   (with-current-buffer (window-buffer
                         (or (active-minibuffer-window)
@@ -1357,9 +1357,5 @@ Remember `this-command' for 
`marginalia-classify-by-command-name'."
         (setcdr ann (append (cddr ann) (list (cadr ann)))))
       (message "Marginalia: Use annotator `%s' for category `%s'" (cadr ann) 
(car ann)))))
 
-;; Emacs 28: Only show `marginalia-cycle' in M-x in recursive minibuffers
-(put #'marginalia-cycle 'completion-predicate
-     (lambda (&rest _) (> (minibuffer-depth) 1)))
-
 (provide 'marginalia)
 ;;; marginalia.el ends here

Reply via email to