abo-abo / hydra

make Emacs bindings that stick around
1.84k stars 112 forks source link

How to align the `^` character in docstring? #410

Closed twlz0ne closed 2 years ago

twlz0ne commented 2 years ago

Since the ^ needs to be escaped to \\^, it will be indented by two spaces after the docstring is rendered.

For example:

(defhydra test-hydra (:color pink :hint nil)
  "
Test
-----------------------------------------------------
  _1_: col1-row1    _4_: col2-row1    _7_: col3-row1
_\\^_: col1-row2    _5_: col2-row2    _8_: col3-row2
  _3_: col1-row3    _6_: col2-row3    _9_: col3-row3
"
  ("1" (message "colum 1 row 1"))
  ("^" (message "colum 1 row 2"))
  ("3" (message "colum 1 row 3"))
  ("4" (message "colum 2 row 1"))
  ("5" (message "colum 2 row 2"))
  ("6" (message "colum 2 row 3"))
  ("7" (message "colum 3 row 1"))
  ("8" (message "colum 3 row 2"))
  ("9" (message "colum 3 row 3"))
  ("q" quit-window "quit" :color blue))

emacs-hydra-align-issue

Besides adding two extra spaces in the definition,

   _1_: col1-row1    _4_: col2-row1    _7_: col3-row1
-_\\^_: col1-row2    _5_: col2-row2    _8_: col3-row2
+  _\\^_: col1-row2    _5_: col2-row2    _8_: col3-row2
   _3_: col1-row3    _6_: col2-row3    _9_: col3-row3

is there a character that can take up two spaces after rendering?