Kungsgeten / ryo-modal

Roll your own modal mode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues with nested hydras

rclingman opened this issue · comments

I have a few hydras for org-mode (e.g. hydra-org-table for table commands, hydra-org-drawers for org drawers and so on) that are made acceptable by a general org-mode hydra called hydra-org. Both are defined outside of ryo-modal. hydra-org-table would look something like

(defhydra hydra-org-table (:color amaranth
                      :hint nil)
"
"
  ("a r" org-table-insert-row)
  ("a c" org-table-insert-column)
  ("a g" counsel-org-tag)
  ("y" org-table-move-column-left)
  ("c" org-table-move-column-right)  
  ("u" org-table-move-row-up)
  ("g" org-table-move-row-down)
  ("y" org-table-move-column-left)
  ("s" org-table-sort-lines)
  ("o" nil :color blue))

and then hydra-org would look something like

(defhydra hydra-org (:color amaranth
                      :hint nil)
"
_i_/_e_: promote/demote 
_g_/_u_: move subtree up/down 
_n_/_r_: _n_ext/p_r_evious visible heading
_k_/_y_: _k_ill/_y_ank special

h i: org-insert-heading
_RET_: org-meta-return 

_c_: capture hydra
_d_: drawer hydra
_f_: re_f_ile
_l_: link/timestamp hydra
_t_: table hydra
_v_: visibility hydra

_o_: cl_o_se org menu
"
	       ("n" org-next-visible-heading)         
	       ("r" org-previous-visible-heading)
               ("RET" org-meta-return :read t)
	       ("i" org-do-promote)
	       ("c" hydra-org-capture/body)
	       ("d" hydra-org-drawer/body)
	       ("l" hydra-org-links-timestamps-ids/body)
	       ("v" hydra-org-visibility/body)
	       ("t" hydra-org-table/body)
	       ("e" org-do-demote)
	       ("g" org-move-subtree-up)
	       ("u" org-move-subtree-down)
	       ("o" nil nil :color blue)
	       ("k" org-cut-special)
	       ("y" org-paste-special)
	       ("h i" org-insert-heading)
	       ("f" org-refile))

I then use ryo-modal-major-mode-keys to make the general org hydra, hydra-org acceptable in ryo-modal only in org-mode

(ryo-modal-major-mode-keys
 'org-mode
  ("o" hydra-org/body))

Unfortunately, whilst hydra-org is acceptable in org-mode via ryo-modal, I can't access the heads that lead to the smaller hydras. So in this example, pressing "o i" executes org-do-promote just fine, but "o t" does nothing.

Occasionally, trying to access one of the nested hydras will lead to some of my other key-bindings to behave strangely and I'll have to restart emacs, but this hasn't been consistently reproducible.

Any idea what could be going wrong? I have tried defining hydra-org inside of the ryo-modal-major-mode-keys using :hydra, but still no luck.

Thanks so much!

I figured out the issue!

I found this thread. Adding exit :t to the nested heads solved the issue!