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
emacs: add currently compiling package dirs to load-path #107777
Conversation
@adisbladis @alyssais @tadfisher I noticed that ofborg didn't add a reviewer for this, so I am tagging people that worked on this recently to get the ball rolling. Feel free to ignore this if you don't have time or just don't want to do it :) If you want to test this locally, please use an updated gccemacs version since I was hitting a bug was fixed upstream today. The current version on emacs-overlay is fine. |
You could split {
setupHook = ''
source ${./emacs-funcs.sh}
if [[ ! -v emacsHookDone ]]; then
emacsHookDone=1
# If this is for a wrapper derivation, emacs and the dependencies are all
# run-time dependencies. If this is for precompiling packages into bytecode,
# emacs is a compile-time dependency of the package.
addEnvHooks "$hostOffset" addEmacsVars
addEnvHooks "$targetOffset" addEmacsVars
fi
'';
postInstall = ''
# Make sure the current package's elisp files are in load-path, otherwise
# (require 'file-b) from file-a.el in the same package will fail.
source ${./emacs-funcs.sh}
addEmacsVars "$out"
# ...
'';
} So basically rename |
Can you also try removing the |
Thanks for the great refactoring idea! Since setupHook expects a file name and not the file's contents, I had to sprinkle writeText in a few places. Let me know if this is a bad idea :) Even then, I believe the refactored approach is much cleaner. I get a bunch of (error "Cannot find suitable directory for output in `comp...") errors when removing the --eval stanza. I believe this happens because addToEmacsNativeLoadPath tests if $nativeDir is a directory before it gets created by the native compilation process. I went ahead and created the directory manually, but I can revert that if you prefer. As a data point, here's the number of compiled files in my configuration before and after this patch:
|
7478424
to
e98ca9a
Compare
896038b
to
789aa96
Compare
@adisbladis Can you take a look at this? |
789aa96
to
e9bfb2c
Compare
There were some merge conflicts, but I've now rebased my commit. @adisbladis, sorry for pinging you again :) |
Co-authored-by: Tad Fisher <tadfisher@gmail.com>
e9bfb2c
to
ca4db1b
Compare
Motivation for this change
See item 1 in nix-community/emacs-overlay#74 (comment). The "emacsHookDone=1" part is admittedly very hacky, suggestions are appreciated. (Edit: No longer hacky, see below)
Things done