Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behavior during byte-compilation. #636

Open
jaccarmac opened this issue Mar 3, 2018 · 3 comments
Open

Strange behavior during byte-compilation. #636

jaccarmac opened this issue Mar 3, 2018 · 3 comments
Labels

Comments

@jaccarmac
Copy link

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 into use-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:

(when (bound-and-true-p byte-compile-current-file)
and noticed the use of byte-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, and declare-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.

@Emiluren
Copy link

Emiluren commented Jun 7, 2018

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))

@jaccarmac
Copy link
Author

Wasn't aware of that option, thanks much!

yonta added a commit to yonta/dotfiles that referenced this issue Apr 8, 2019
use-packageをbyte-compileするとエラー・警告が複数出る。
ファイル分割の影響と、use-packageのバグと、複数理由がありそう。
今後、init-loaderを導入して解決をはかる、かもしれない。
とりあえず、byte-compileの例外とする。
参考: jwiegley/use-package#636
yonta added a commit to yonta/dotfiles that referenced this issue Apr 10, 2019
use-packageをbyte-compileするとエラー・警告が複数出る。
ファイル分割の影響と、use-packageのバグと、複数理由がありそう。
今後、init-loaderを導入して解決をはかる、かもしれない。
とりあえず、byte-compileの例外とする。
参考: ttps://github.com/jwiegley/use-package/issues/636
@skangas
Copy link
Collaborator

skangas commented Dec 8, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants