branch: externals/marginalia commit 4a40cfb4f2d54ddf63722e341e8112bd7fc413e6 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Revert "Introduce project-root category" This reverts commit fba798e7a30165cefcddf0acd0a2b0f17bb12d95. Revert this for now since it needs more thought. --- marginalia.el | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/marginalia.el b/marginalia.el index 8fac4a1698..31da2c43b7 100644 --- a/marginalia.el +++ b/marginalia.el @@ -90,7 +90,6 @@ a relative age." (imenu marginalia-annotate-imenu) (bookmark marginalia-annotate-bookmark) (file marginalia-annotate-file) - (project-root marginalia-annotate-file) (project-file marginalia-annotate-project-file) (buffer marginalia-annotate-buffer) (library marginalia-annotate-library) @@ -950,8 +949,11 @@ These annotations are skipped for remote paths." (defun marginalia-annotate-project-file (cand) "Annotate file CAND with its size, modification time and other attributes." - (when-let (root (marginalia--project-root)) - (marginalia-annotate-file (expand-file-name cand root)))) + ;; Absolute project directories also report project-file category + (if (file-name-absolute-p cand) + (marginalia-annotate-file cand) + (when-let (root (marginalia--project-root)) + (marginalia-annotate-file (expand-file-name cand root))))) (defvar-local marginalia--library-cache nil) (defun marginalia--library-cache () @@ -1052,14 +1054,10 @@ These annotations are skipped for remote paths." "Return original category reported by completion metadata." ;; NOTE: Use `alist-get' instead of `completion-metadata-get' to bypass our ;; `marginalia--completion-metadata-get' advice! - (pcase (alist-get 'category marginalia--metadata) + (when-let (cat (alist-get 'category marginalia--metadata)) ;; Ignore Emacs 28 symbol-help category in order to ensure that the ;; categories are refined to our categories function and variable. - ('symbol-help nil) - ;; Refine the project-file category to project-root - ((and 'project-file (guard (equal "Select project: " (minibuffer-prompt)))) - 'project-root) - (cat cat))) + (and (not (eq cat 'symbol-help)) cat))) (defun marginalia-classify-symbol () "Determine if currently completing symbols."