Open nkpf42 opened 11 months ago
What version of Emacs and use-package
are you using?
I'm using
GNU Emacs 29.1.50
Development version 45cc57ac2586 on emacs-29 branch; build date 2023-08-21.
And I just realized that I didn't took a tag while compiling it myself. Shall I switch to stable commit and retry my setup to see if it's fixed?
And use-package is at 2.4.5
Just switched to a stable emacs 29.1 version
GNU Emacs 29.1
Development version a9b28224af0f on HEAD branch; build date 2023-10-04.
Same version of use-package and bug still here
Don't you need to load hydra by demand as well?
(use-package hydra :demand)
Otherwise pretty-hydra will never load
It doesn't work too :/ I'm a bit at a loss here with use-package beahviour.
What is the full use-package expression that you use that gives this error?
This one
(use-package org-roam
:after (pretty-hydra)
:bind (("C-c n" . roam-hydra/body))
:pretty-hydra (roam-hydra (:color teal :quit-key "q")
("Roam"
(
("l" org-roam-buffer-toggle)
("f" org-roam-node-find)
("i" org-roam-node-insert)
("c" org-roam-capture)
("t" org-roam-tag-add)
)
"Dailies"
(
("j" org-roam-dailies-capture-today)
("k" org-roam-dailies-capture-tomorrow)
("h" org-roam-dailies-goto-yesterday)
("a" org-roam-dailies-goto-today)
("d" org-roam-dailies-goto-tomorrow)
))
))
Without actually testing it, I wonder if it's the :after
that's causing the issue for you. I'm using the same version of emacs and use-package 2.4.4 and it works fine for me.
To use :pretty-hydra
, you need it loaded before any use-package
with :pretty-hydra
is called. In my config I have this loaded very early. I don't have a separate use-package
for hydra
and pretty-hydra
as major-mode-hydra
loads them all.
(use-package major-mode-hydra
:straight t
:demand t
:bind
(("C-M-SPC" . major-mode-hydra))
:config
(progn
(setq major-mode-hydra-invisible-quit-key "q")
(defun jp-major-mode-hydra-title-generator (_)
`(with-mode-icon major-mode
(propertize (s-concat (format-mode-line mode-name) " Commands")
'face '(:weight bold :height 1.1))
1.1))
(setq major-mode-hydra-title-generator #'jp-major-mode-hydra-title-generator)))
Try removing the :after (hydra)
and make sure it's loaded before other use-package
calls.
So I tried to remove all after's and using only major-mode-hydra
but it still doesn't work. To ensure I've got a clean state, I've uninstalled and reinstalled all of my packages but to no avail.
major-mode-hydra
is the 2nd package in my init.el, the first being elpaca
I've found a solution with
;; hydra
(use-package major-mode-hydra)
(elpaca-wait)
By placing an elpaca wait after I think it prevents elpaca from loading the rest of the file. But I thought it was use-package who was in charge of parsing this init file. I will ask them what the hell is going on
elpaca messes around with loading things by loading asyncronouslly.
As use-package and the :pretty-hydra are in a macro you need all of those bits loaded before using them.
So you need loading of use-package (well not since 29.1 as now in emacs) and loading pretty-hydra and hydra before an elpaca-wait. Then after the elpaca-wait you can use your code
I found elpaca requires too much changing and reordering of code to easily switch to - straight.el and package.el just required a few lines except for non standard packages.
Hello,
I've got a problem loading the
:pretty-hydra
keyword for use-package even if I request it with:demand t
. Do you have any tips for this? Thanks