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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/marginalia 624028c 235/241: Silence bytecode compiler w


From: Stefan Monnier
Subject: [elpa] externals/marginalia 624028c 235/241: Silence bytecode compiler warning regarding project-roots (Fix #79)
Date: Fri, 28 May 2021 20:49:34 -0400 (EDT)

branch: externals/marginalia
commit 624028c69b55deb3387452b9eeabe9cb963bd2a4
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Silence bytecode compiler warning regarding project-roots (Fix #79)
---
 marginalia.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/marginalia.el b/marginalia.el
index e4691c2..dfe5ac5 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -239,7 +239,6 @@ determine it."
 (declare-function package-desc-version "package")
 (declare-function package-version-join "package")
 (declare-function project-current "project")
-(declare-function project-roots "project")
 
 (declare-function color-rgb-to-hex "color")
 (declare-function color-rgb-to-hsl "color")
@@ -672,15 +671,21 @@ These annotations are skipped for remote paths."
          "%b %d %H:%M"
          (file-attribute-modification-time attributes)) :face 
'marginalia-date)))))
 
+(defmacro marginalia--project-root ()
+  "Return project root."
+  (require 'project)
+  `(when-let (proj (project-current))
+     ,(if (fboundp 'project-root)
+          '(project-root proj)
+        '(car (project-roots proj)))))
+
 (defun marginalia-annotate-project-file (cand)
   "Annotate file CAND with its size, modification time and other attributes."
   ;; TODO project-find-file can be called from outside all projects in
   ;; which case it prompts for a project first; we don't support that
   ;; case yet, since there is no current project.
-  (when-let ((project (project-current))
-             (root (car (project-roots project)))
-             (file (expand-file-name cand root)))
-    (marginalia-annotate-file file)))
+  (when-let (root (marginalia--project-root))
+    (marginalia-annotate-file (expand-file-name cand root))))
 
 (defun marginalia-classify-by-command-name ()
   "Lookup category for current command."



reply via email to

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