[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/marginalia 9ca552c: marginalia-annotate-variable: Print
From: |
ELPA Syncer |
Subject: |
[elpa] externals/marginalia 9ca552c: marginalia-annotate-variable: Print correct value for symbols (Fix #94) |
Date: |
Wed, 28 Jul 2021 02:57:11 -0400 (EDT) |
branch: externals/marginalia
commit 9ca552c9c745ab52e315ba5e0032c8228d165dfc
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
marginalia-annotate-variable: Print correct value for symbols (Fix #94)
---
marginalia.el | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/marginalia.el b/marginalia.el
index db142ab..981790f 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -564,16 +564,20 @@ keybinding since CAND includes it."
((and marginalia-censor-variables
(seq-find (lambda (r) (string-match-p r cand))
marginalia-censor-variables))
"*****")
- (t (pcase (symbol-value sym)
- ('nil (propertize "nil" 'face 'marginalia-null))
- ('t (propertize "t" 'face 'marginalia-true))
- ((pred keymapp) (propertize "<keymap>" 'face 'marginalia-value))
- ((pred hash-table-p) (propertize "<hash-table>" 'face
'marginalia-value))
- ((pred functionp) (propertize (symbol-name sym) 'face
'marginalia-function))
- ((pred symbolp) (propertize (symbol-name sym) 'face
'marginalia-symbol))
- ((and (pred numberp) val)
- (propertize (number-to-string val) 'face 'marginalia-number))
- (val (let ((print-escape-newlines t)
+ (t (let ((val (symbol-value sym)))
+ (pcase (symbol-value sym)
+ ('nil (propertize "nil" 'face 'marginalia-null))
+ ('t (propertize "t" 'face 'marginalia-true))
+ ((pred keymapp) (propertize "<keymap>" 'face 'marginalia-value))
+ ((pred hash-table-p) (propertize "<hash-table>" 'face
'marginalia-value))
+ ((and (pred functionp) (pred symbolp))
+ ;; NOTE: We are not consistent here, values are generally
printed unquoted. But we
+ ;; make an exception for function symbols to visually
distinguish them from symbols.
+ ;; I am not entirely happy with this, but we should not add
quotation to every type.
+ (propertize (format "#'%s" val) 'face 'marginalia-function))
+ ((pred symbolp) (propertize (symbol-name val) 'face
'marginalia-symbol))
+ ((pred numberp) (propertize (number-to-string val) 'face
'marginalia-number))
+ (_ (let ((print-escape-newlines t)
(print-escape-control-characters t)
(print-escape-multibyte t)
(print-level 10)
@@ -590,7 +594,7 @@ keybinding since CAND includes it."
(cond
((listp val) 'marginalia-list)
((stringp val) 'marginalia-string)
- (t 'marginalia-value))))))))
+ (t 'marginalia-value)))))))))
:truncate (/ marginalia-truncate-width 2))
((documentation-property sym 'variable-documentation)
:truncate marginalia-truncate-width :face 'marginalia-documentation))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/marginalia 9ca552c: marginalia-annotate-variable: Print correct value for symbols (Fix #94),
ELPA Syncer <=