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

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

[elpa] externals/marginalia d0c4e41 111/241: marginalia--field: fix nil


From: Stefan Monnier
Subject: [elpa] externals/marginalia d0c4e41 111/241: marginalia--field: fix nil handling
Date: Fri, 28 May 2021 20:49:07 -0400 (EDT)

branch: externals/marginalia
commit d0c4e41b6aa773141dc27ec1bd583aa43b2c6022
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@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)



reply via email to

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