Is there an emacs command to pad a justified string with a character? Specifically, I’d like to be able to take
;; Foobar
and get
;; ===================================Foobar====================================
where Foobar is centered in a field of width 77. For clarity, I produced the output above via the python code ";; {:=^77}".format("Foobar").
I don’t know of any existing function to do that, but it’s easy to write one:
Now
(center-string-in-char "Foobar" 77 ?=)produces your example string (minus the leading";; "which you can add yourself).