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, 2020 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, 2020 at 19:42
  • Please put any such clarifications into the question itself. Comments can be deleted at any time. Thx.
    – Drew
    Dec 18, 2020 at 21:21

1 Answer 1

3

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? Jan 19, 2021 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, 2021 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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