branch: externals/marginalia
commit d0c4e41b6aa773141dc27ec1bd583aa43b2c6022
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>
marginalia--field: fix nil handling
---
marginalia.el | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/marginalia.el b/marginalia.el
index c0f113c..055d52a 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -276,10 +276,12 @@ FORMAT is a format string. This must be used if the field
value is not a string.
FACE is the name of the face, with which the field should be propertized.
WIDTH is the format width. This can be specified as alternative to FORMAT."
(cl-assert (not (and width format)))
- (when width (setq format (format "%%%ds" (- width))))
- (if format
- (setq field `(format ,format ,field))
- (setq field `(or ,field "")))
+ (when width
+ (setq field `(or ,field "")
+ format (format "%%%ds" (- width))))
+ (setq field (if format
+ `(format ,format ,field)
+ `(or ,field "")))
(when truncate (setq field `(marginalia--truncate ,field ,truncate)))
(when face (setq field `(propertize ,field 'face ,face)))
field)