abo-abo / hydra

make Emacs bindings that stick around
1.83k stars 109 forks source link

Hydra with inheritance in use-package #387

Open MagicRB opened 3 years ago

MagicRB commented 3 years ago

Problem

When I declare my hydra in use-package,

(use-package hydra
  :ensure t
  :config
  (defhydra magic_rb/hydra-base (:color red :body-pre (setq hydra-stack nil))
    ("s" treemacs-switch-workspace)
    ...
    ("m" magit))
  (defhydra magic_rb/hydra-rust (:color red :inherit (magic_rb/hydra-base/heads))
    ("r" (progn
     (magic_rb/hydra-rust-sub/body)
     (hydra-push '(magic_rb/hydra-launcher)))
     "visit magic_rb/hydra-rust-sub" :color teal)
    ("e" lsp-execute-code-action)))

the derived hydra doesn't get declared, until I eval the use package again. If I run emacs with --debug-init I get (void-variable magic_rb/hydra-base/heads). If I run emacs normally, no error is generated, it fails silently.

What I tried

I tried using progn to merge all the forms into one, didn't help.

CastixGitHub commented 3 years ago

try with :demand t