1

If a hydra is opened, how do we check programmatically that it is actually open and displaying?

3
  • Can you please elaborate a bit, to make your question clearer to more people who might be able to help? – Drew Dec 18 '20 at 19:22
  • I want to check for a flag determining the status of a hydra. I'm not sure how to do it. – zcaudate Dec 18 '20 at 19:42
  • Please put any such clarifications into the question itself. Comments can be deleted at any time. Thx. – Drew Dec 18 '20 at 21:21
2

It's possible to check for a variable hydra-curr-map. This will return nil if the hydra is hidden or the keymap that it's using given by <hydra>/keymap. ie.

;; define hydra
(defhydra test-hydra ....)

;; open test-hydra
(test-hydra/body)

(eq hydra-curr-map test-hydra/keymap)
=> t
2
  • Just curiosity. What is the reason that you need to test it? – itirazimvar Jan 19 at 14:01
  • 1
    @itirazimvar I wanted to make a toggle (1. if A is off and A is pressed, close A, 2. if A is on and A is pressed, open A, 3. if A is on and B is pressed, close A and open B) – zcaudate Jan 20 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.