[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/marginalia feca4f1 100/241: add support for project.el
From: |
Stefan Monnier |
Subject: |
[elpa] externals/marginalia feca4f1 100/241: add support for project.el |
Date: |
Fri, 28 May 2021 20:49:05 -0400 (EDT) |
branch: externals/marginalia
commit feca4f198efb7e90fa6355440c2f6e142a73c3e1
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
add support for project.el
This adds a new heavy annotator for the category project-file used,
for instance, by project-find-file. The annotations are the same as
the annotations we already have for files.
---
marginalia.el | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/marginalia.el b/marginalia.el
index 55f3045..e99595e 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -86,6 +86,7 @@ See also `marginalia-annotators-heavy'."
(defcustom marginalia-annotators-heavy
(append
'((file . marginalia-annotate-file)
+ (project-file . marginalia-annotate-project-file)
(buffer . marginalia-annotate-buffer)
(virtual-buffer . marginalia-annotate-virtual-buffer-full)
(command . marginalia-annotate-command))
@@ -210,6 +211,9 @@ determine it."
(declare-function package-installed-p "package")
(declare-function package-version-join "package")
+(declare-function project-current "project")
+(declare-function project-root "project")
+
;;;; Marginalia mode
(defvar marginalia--separator " "
@@ -510,7 +514,7 @@ using `minibuffer-force-complete' on the candidate CAND."
cand))
(defun marginalia-annotate-file (cand)
- "Annotate file CAND with its size and modification time."
+ "Annotate file CAND with its size, modification time and other attributes."
(when-let ((attributes (file-attributes (marginalia--full-candidate cand)
'string)))
(marginalia--fields
((file-attribute-modes attributes) :face 'marginalia-file-modes)
@@ -523,6 +527,13 @@ using `minibuffer-force-complete' on the candidate CAND."
"%b %d %H:%M"
(file-attribute-modification-time attributes)) :face
'marginalia-date))))
+(defun marginalia-annotate-project-file (cand)
+ "Annotate file CAND with its size, modification time and other attributes."
+ (when-let ((project (project-current))
+ (root (project-root project))
+ (file (expand-file-name cand root)))
+ (marginalia-annotate-file file)))
+
(defun marginalia-classify-by-command-name ()
"Lookup category for current command."
(and marginalia--this-command
- [elpa] externals/marginalia ac4ab98 227/241: Implement individual cycling per completion category (Fix #73), (continued)
- [elpa] externals/marginalia ac4ab98 227/241: Implement individual cycling per completion category (Fix #73), Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 3f33b38 238/241: Prepare submission to ELPA, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia e97979a 240/241: Remove License header, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 09aaad9 159/241: Revert "fix #46: affixation suffix must not be nil, it must be a string", Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 42977b4 162/241: add comment, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 65da400 055/241: marginalia-annotate-package: show package version, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 501a3b3 056/241: simplify marginalia--align, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 4ffd1a9 071/241: add marginalia-annotate-input-method, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 75e9e9b 070/241: add marginalia-annotate-charset, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia c940a49 236/241: Use more restricted regexp to detect remote completion, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia feca4f1 100/241: add support for project.el,
Stefan Monnier <=
- [elpa] externals/marginalia 65d6b5d 102/241: fix package annotation, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 7df0e53 177/241: Add marginalia-bookmark-type-transformers, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 2b926ae 190/241: Avoid annotations for host and remote path completions, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia e4b3fcd 191/241: marginalia--remote-p: handle shadow paths, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 3210152 033/241: add comment to marginalia--full-candidate, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia f9ca52c 032/241: Fallback for when full candidate is requested outside of minibuffer, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 6789da8 034/241: fix typo in marginalia-set-command-annotator, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia f39556b 043/241: fix marginalia--full-candidate for selectrum, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia fe5d5db 047/241: add faces: marginalia-file-modes, marginalia-file-owner, Stefan Monnier, 2021/05/28
- [elpa] externals/marginalia 2eec2dc 060/241: fix warnings, Stefan Monnier, 2021/05/28