branch: externals/marginalia commit 618fd9e5349ea8545e1c4799b2944b33104f345d Author: Omar Antolín <omar.anto...@gmail.com> Commit: Omar Antolín <omar.anto...@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))