1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

time-stamp: padding composed characters

* lisp/time-stamp.el (time-stamp-string-preprocess): Use
'string-width' instead of 'length' to calculate needed padding.

Thanks to Stefan Monnier for the suggestion.
This commit is contained in:
Stephen Gildea 2025-10-16 15:22:36 -07:00
parent 888a910bc9
commit d208502e4c

View file

@ -779,7 +779,8 @@ and all `time-stamp-format' compatibility."
(format (format "%%%sd" field-width) (format (format "%%%sd" field-width)
(or field-result ""))) (or field-result "")))
(let* ((field-width-num (string-to-number field-width)) (let* ((field-width-num (string-to-number field-width))
(needed-padding (- field-width-num (length field-result)))) (needed-padding (- field-width-num
(string-width (or field-result "")))))
(if (> needed-padding 0) (if (> needed-padding 0)
(concat (make-string needed-padding ?\s) field-result) (concat (make-string needed-padding ?\s) field-result)
field-result))) field-result)))