hydra icon indicating copy to clipboard operation
hydra copied to clipboard

Hydras not showing hints

Open sho-87 opened this issue 7 years ago • 8 comments

I'm having some difficulty figuring out how to get hints to display with hydra. My config is here but the relevant parts look like this:

(use-package hydra :ensure t
  :config (setq hydra-is-helpful t
                hydra-lv t
                lv-use-separator t)
  )

(defhydra hydra-buffer (:color blue :hint nil)
  "Buffer Management"

  ("b" helm-mini "buffer list" :column "Buffer")
  ("d" kill-this-buffer "kill buffer")
  ("D" sh/kill-all-buffers "kill all buffers")

  ("h" tabbar-backward "prev tab" :color red :column "Tab")
  ("l" tabbar-forward "next tab" :color red)

  ("q" nil "close" :color blue :column nil)
)

The hydra is bound to SPC b

When I press the binding, a window pops up that correctly shows me 2 columns, but 1) the q bind does not show anywhere, and 2) I cant see any hints:

Image

How do I set this up so I have 2 columns (with the 5 binds), and q in the hint bar?

Also, a hydra like this doesnt seem to show up at all (none of the bindings are visible):

(defhydra hydra-zoom (:color red :hint nil :columns 3)
  ("+" text-scale-increase "in")
  ("-" text-scale-decrease "out")
  ("r" (text-scale-adjust 0) :color blue "reset")
  ("q" nil "quit" :color blue)
  )

Image

I feel like the hydra window height is too small and cutting off the bottom part where the hint would show. For example, I dont see a line separator between the hints and the hydra heads even though I've set the option in :config. Or is there something else in my config that is screwing up the height of that window?

I'm on emacs 25 and windows 10

sho-87 avatar May 14 '17 05:05 sho-87

Remove :hint nil from your code.

abo-abo avatar May 14 '17 08:05 abo-abo

I've tried a number of different variations of this, and changing the code to the following (removing :hint nil) still gives the same problem:

(defhydra hydra-buffer (:color blue)
  "Buffer Management"

  ("b" helm-mini "buffer list" :column "Buffer")
  ("d" kill-this-buffer "kill buffer")
  ("D" sh/kill-all-buffers "kill all buffers")

  ("h" tabbar-backward "prev tab" :color red :column "Tab")
  ("l" tabbar-forward "next tab" :color red)

  ("q" nil "close" :color blue :column nil)
)

sho-87 avatar May 14 '17 08:05 sho-87

Works fine for me:

(eval hydra-buffer/hint)
;; =>
;; #("Buffer Management:
;; Buffer              | Tab
;; ------------------- | -----------
;; b: buffer list      | h: prev tab
;; d: kill buffer      | l: next tab
;; D: kill all buffers |
;; [q]: close."
;;   79 80 (face hydra-face-blue)
;;   101 102 (face hydra-face-red)
;;   113 114 (face hydra-face-blue)
;;   135 136 (face hydra-face-red)
;;   147 148 (face hydra-face-blue)
;;   170 171 (face hydra-face-blue))

abo-abo avatar May 14 '17 08:05 abo-abo

ok I think Ive narrowed it down to the tabbar package

Do your hints still show if you have that installed? I wonder why its causing strange interaction with hydra...

(use-package tabbar :ensure t
  :init (tabbar-mode)
  )

sho-87 avatar May 14 '17 09:05 sho-87

Still works for me with tabbar. I never used it though, so something might break only with extensive usage.

abo-abo avatar May 14 '17 11:05 abo-abo

Sorry to reopen this, but I've the same problem. Tested with the simple example from the documentation (copied from the hydra-examples.el file) but here is what I get (binded to f7, because I already use f2) Screenshot_2023-08-22_14-01-44 I do not use tabbar, so the hypothesis of the OP is wrong, unless the problem is in some dependencies of tabbar that I've installed for other reasons than support tabbar

LevPetrovitch avatar Aug 22 '23 12:08 LevPetrovitch

Nailed it! (well, almost). The problem comes from the which-key package, which is trying to be helpful by showing the bindings (is the reason why it's installed, after all).

Now that I found where the problem is, I only need to solve it

LevPetrovitch avatar Aug 25 '23 13:08 LevPetrovitch

I found a simple workaround which consists in not using the "automatic binding" feature of hydra, i.e. leaving awesome-keymap and awesome-binding empty, and explicitly bind awesome-hydra/body to whatever you want. If I understand correctly how hydras work, this is due to the fact that no binding to the head is created this way.

LevPetrovitch avatar Aug 28 '23 07:08 LevPetrovitch