Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with nested hydras #58

Open
rclingman opened this issue May 17, 2023 · 1 comment
Open

Issues with nested hydras #58

rclingman opened this issue May 17, 2023 · 1 comment

Comments

@rclingman
Copy link

rclingman commented May 17, 2023

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!

@rclingman
Copy link
Author

I figured out the issue!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant