variable format column width breaks docstring
aspiers opened this issue · comments
If we take the hydra-toggle
example from hydra-examples.el
and change the %`
to %3`
in order to right-align the displayed values:
(defhydra hydra-toggle (:color pink)
"
_a_ abbrev-mode: %3`abbrev-mode
_d_ debug-on-error: %3`debug-on-error
_f_ auto-fill-mode: %3`auto-fill-function
_t_ truncate-lines: %3`truncate-lines
_w_ whitespace-mode: %3`whitespace-mode
"
("a" abbrev-mode nil)
("d" toggle-debug-on-error nil)
("f" auto-fill-mode nil)
("t" toggle-truncate-lines nil)
("w" whitespace-mode nil)
("q" nil "quit"))
then the colour highlighting breaks, e.g. the q
for quit
is not always coloured correctly, and after toggling some of the options, random letters get highlighted, e.g. look at the p
in whitespace-mode
here:
I tried to work around this with %(format "%3d" abbrev-mode)
but that resulted in extra double-quotes around the value.
I think I traced it to the use of S
as the format specifier:
Lines 786 to 788 in 112e689
If I change that to s
then the double-quotes vanish.
Ahah! I figured out from the source that I can choose the specifier myself via %s(format "%3d" abbrev-mode)
and then it works. So this is a workable alternative to the original issue.