1

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

zcaudate
  • 637
  • 4
  • 14
  • 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

1 Answers1

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
Muihlinn
  • 2,576
  • 1
  • 14
  • 22
zcaudate
  • 637
  • 4
  • 14
  • Just curiosity. What is the reason that you need to test it? – itirazimvar Jan 19 '21 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 '21 at 02:13