branch: externals/marginalia
commit 88faa59f8f91fa815e178838cdee3c8735a5b8c2
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
marginalia-annotate-variable: ensure that control characters are escaped
otherwise newlines and bidi characters make problems
---
marginalia.el | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/marginalia.el b/marginalia.el
index c34628b..0ceefa9 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -402,8 +402,11 @@ Similar to `marginalia-annotate-symbol', but does not show
symbol class."
(when-let (sym (intern-soft cand))
(marginalia--fields
((marginalia--symbol-class sym) :face 'marginalia-modified)
- ((if (boundp sym) (symbol-value sym) 'unbound)
- :truncate (/ marginalia-truncate-width 3) :format "%S" :face
'marginalia-variable)
+ ((let ((print-escape-newlines t)
+ (print-escape-control-characters t)
+ (print-escape-multibyte t))
+ (prin1-to-string (if (boundp sym) (symbol-value sym) 'unbound)))
+ :truncate (/ marginalia-truncate-width 3) :face 'marginalia-variable)
((documentation-property sym 'variable-documentation)
:truncate marginalia-truncate-width :face 'marginalia-documentation))))