godotengine / emacs-gdscript-mode

An Emacs package to get GDScript support and syntax highlighting.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hydra does not work

JuanTorres93 opened this issue · comments

When I try to run the hydra I get the following error:

gdscript-hydra-show: Symbol’s function definition is void: gdscript-hydra--menu/body

Looking through the code, I've seen that the function gdscript-hydra--menu/body is defined in the file gdscript-hydra.el. Making a little bit of research I think that what is wrong is my way of installing the package. Right now I have this:

(use-package gdscript-mode
:ensure t
:hook (gdscript-mode . lsp-deferred))
(require 'gdscript-mode)

In the documentation it is stated that the package is installed in this way:

(use-package gdscript-mode
:straight (gdscript-mode
:type git
:host github
:repo "GDQuest/emacs-gdscript-mode"))

But when I try it, I get this error:

Error (use-package): Failed to parse package gdscript-mode: use-package: Unrecognized keyword: :straight

I have also tried installing the straight package, but it doesn't seem to do anything. Any ideas why this could be happening?

Thanks in advanced!

You need to have hydra.el package installed explicitly, it is not installed automatically as a dependency. Try to add this into your config:

(use-package hydra
   :ensure t)

But you should see a warning that hydra.el is not available on your system, rather than:

gdscript-hydra-show: Symbol’s function definition is void: gdscript-hydra--menu/body

🤔

Did you actually try to run hydra with:

(gdscript-hydra-show)

?

Yes, I forgot to mention that I also have the hydra package installed, and, in addition, I also tried to run (gdscript-hydra-show) without the keybinding and I get the same error.

In your case the straight keyword in the use-package does not throw any error?

I do not use :straight so I don't know.
It should work without it.

Try to add :after (hydra) to your config

(use-package gdscript-mode
  :ensure t
  :hook (gdscript-mode . lsp-deferred)
  :after (hydra))

Mmmm... I get the same error message, but don't worry, I'll keep up looking for solutions. Thank you so much for your replies!

That's weird. Did you try to restart emacs when changing the config?

This error:

gdscript-hydra-show: Symbol’s function definition is void: gdscript-hydra--menu/body

may occur when gdscript-mode is loaded before hydra.

All you need to do is to ensure you are loading hydra first and gdscript-mode second, either explicitly:

(use-package hydra
  :ensure t)

;; hydra needs to be loaded here
(use-package gdscript-mode
  :ensure t)

or with that :after keyword.

I've tried both, the :after keyword and also loading hydra as you mention, and I still get the same error. I have now updated all my packages and, in the compile log I get one message that says: "the function gdscript-hydra--menu/body is not known to be defined" and another one that says that the function defhydra, amongst others, is not known to the defined, which makes me think that maybe hydra is not correctly installed by some reason. I'm going to keep researching.

OK, just after upgrading and restarting emacs, now the hydra menu does show up.

Thank you so much for your help!

Thanks Josef for the help, glad you could address your problem!