Function: marginalia--field
marginalia--field is a macro defined in marginalia.el.
Signature
(marginalia--field FIELD &key TRUNCATE FACE WIDTH FORMAT)
Documentation
Format FIELD as a string according to some options.
TRUNCATE is the truncation width. WIDTH is the field width. FORMAT is a format string. FACE is the name of the face, with which the field should be propertized.
Source Code
;; Defined in ~/.emacs.d/elpa/marginalia-20260724.810/marginalia.el
(cl-defmacro marginalia--field (field &key truncate face width format)
"Format FIELD as a string according to some options.
TRUNCATE is the truncation width.
WIDTH is the field width.
FORMAT is a format string.
FACE is the name of the face, with which the field should be propertized."
(setq field (if format `(format ,format ,field) `(or ,field "")))
(when width (setq field `(format ,(format "%%%ds" (- width)) ,field)))
(when truncate (setq field `(marginalia--truncate ,field ,truncate)))
(when face
(setq field (if (or format width truncate)
(cl-with-gensyms (f)
`(let ((,f ,field))
(put-text-property 0 (length ,f) 'face ,face ,f)
,f))
`(propertize ,field 'face ,face))))
field)