major-mode-hydra.el
major-mode-hydra.el copied to clipboard
Customize line below heading between columns.
Thx for your package. Used to use a hackish solution before.
What I'm missing from my solutions is to be able to customize the separator between the column headings. In my case it was two spaces:
This somehow helps me to visually see the columns better.
Is this already possible or can this be implemented?
No it's not possible currently but it seems nice to have. I'll have a think about it.
Had a look at the code. Something like this should do it:
Handle :separator
different if it is a list like ("-" " ")
and use the cdr
as the separator between columns like so:
-
Change
pretty-hydra--gen-heads-docstring
https://github.com/jerrypnz/major-mode-hydra.el/blob/d9fb688dae3e134bb1ff7f35474c58f33a5bb992/pretty-hydra.el#L133 Add this to let of the function:(separator (or (and (listp separator) (car separator)) separator))
And change the line above to this:
(s-pad-right width separator "^^"))
(Note: with the old code the separator is as it looks actually too wide. Is this on purpose?)
-
Change
pretty-hydra--gen-heads-docstring
https://github.com/jerrypnz/major-mode-hydra.el/blob/d9fb688dae3e134bb1ff7f35474c58f33a5bb992/pretty-hydra.el#L153 Add this to let of the function:(separator (or (and (listp separator) (cadr separator)) separator)) (col-separator (s-pad-right (length separator) " " ""))
And change that line to:
(s-join (if (= i 1) separator col-separator)
Like this one can even use a separator longer than one character :separator ("─" " │ ")
:
What you think? I can make a pull request. Would this also affect the tests?
Oh I thought you'd want the column separator to appear on every row, not just the separator row. If this is really what you want, your proposed solution sounds good to me (otherwise I'd probably introduce a separate property :col-separator
).
A PR is definitely welcome!
had time to work on this: https://github.com/hubisan/major-mode-hydra.el/tree/feature/col-separator
:col-separator a string or a list of two strings used to separate the columns. If it is a list, the second string is used as column separator at the separator line. If the strings in the list are of unequal length the shorter string is centered by adding spaces.
So this accepts " │ "
or '(" │ " "───")
. If a list the effect is the following, using '("x│x" "=X=")
:
Added a .travis.yml for automated testing against emacs 25 and 26. Test in 25 unfortunately fail, caadr and caaddr (used in pretty-hydra--normalize-args
) were introduced in emacs 26. Can you change this on develop? Will rebase, add some tests for the :col-separator and make the pull request.
@hubisan That's awesome! Looking forward to your PR.