Open jaccarmac opened 6 years ago
I also had this problem. The discussion in #590 put me on the right track.
I solved it by adding this
(eval-when-compile
(setq use-package-expand-minimally byte-compile-current-file))
Wasn't aware of that option, thanks much!
Could someone explain what is the problem here exactly, or even better provide a minimal example that is not working? As it stands, I don't think I understand what this is about. I also don't personally byte-compile my init file, so please forgive me if I'm missing something obvious.
Thanks in advance.
I've been playing with techniques to speed up Emacs, which led me down the road of byte-compiling my init file. As you can see, that file contains a bunch of
quse-package
expressions which macroexpand intouse-package
expressions which macroexpand into nice tight initialization code. The linked artifact is the version of the file I've used without byte compilation for some time. To eliminate warnings I took advantage of the new use-package 2 features and tried to predefine functions which the compiler complained about.However,
:functions
and:defines
seem to have no effect on the generated warnings. I looked for issues similar to mine and found #198, then dove into the source here: https://github.com/jwiegley/use-package/blob/6af4b6caf67f5fbd63429d27fa54a92933df966a/use-package-core.el#L633 and noticed the use ofbyte-compile-current-file
. I'm not well-versed in Emacs' macro-expander, but are recursive expansions done in the same file or in such a way that the file would be different?eval-when-compile
is implemented without checking state variables, with a mechanism which I'm not familiar with and need to look into further.My issue can be solved by using
:preface
,defvar
, anddeclare-function
liberally but the other keywords are a nice convenience feature and perhaps solving the recursive expansion problem can help with that other reported bugs.I develop a package that I found useful to leverage use-package's power in my own config. You can find it at jaccarmac/quse-package and example usage in http://chiselapp.com/user/jaccarmac/repository/dot-emacs-dot-d/artifact/90fda1f9e5dbe46c. May be helpful for resolving the issue, maybe not.