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

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

[elpa] externals/marginalia 618fd9e 084/241: Improve formatting of envir


From: Stefan Monnier
Subject: [elpa] externals/marginalia 618fd9e 084/241: Improve formatting of environment variable annotation
Date: Fri, 28 May 2021 20:49:01 -0400 (EDT)

branch: externals/marginalia
commit 618fd9e5349ea8545e1c4799b2944b33104f345d
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>

    Improve formatting of environment variable annotation
---
 marginalia.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/marginalia.el b/marginalia.el
index 1479fce..7f819ad 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -150,7 +150,7 @@ only with the annotations that come with Emacs) without 
disabling
     (minor-mode . marginalia-annotate-minor-mode)
     (symbol . marginalia-annotate-symbol)
     (variable . marginalia-annotate-variable)
-    (environment-variable . getenv)
+    (environment-variable . marginalia-annotate-environment-variable)
     (input-method . marginalia-annotate-input-method)
     (coding-system . marginalia-annotate-coding-system)
     (charset . marginalia-annotate-charset)
@@ -366,6 +366,12 @@ This hash table is needed to speed up 
`marginalia-annotate-command'.")
      ((documentation-property sym 'variable-documentation)
       :truncate marginalia-truncate-width :face 'marginalia-documentation))))
 
+(defun marginalia-annotate-environment-variable (cand)
+  "Annotate environment variable CAND with its current value."
+  (when-let (val (getenv cand))
+    (marginalia--fields
+     (val :truncate marginalia-truncate-width :face 'marginalia-variable))))
+
 (defun marginalia-annotate-face (cand)
   "Annotate face CAND with documentation string and face example."
   (when-let (sym (intern-soft cand))



reply via email to

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