Skip to content

Conversation

@pdbrown
Copy link

@pdbrown pdbrown commented Jan 31, 2022

Hey there, thanks for putting this mode up! I've been using it with native compilation recently, and noticed errors about missing files that only occur when native-compiling in async mode. This PR fixes up path name resolution for the defconst expressions.


When building systemd.el with async native compile, we can't rely on
load-file-name, so fall back to the native relative path lookup performed
in insert-file-contents.

native-compile-async runs compilation in a subprocess launched by loading
an elisp program from a temporary file:

(native-compile-async "/home/phil/.emacs.d/systemd/systemd.el")
=> invokes
emacs --batch -l /tmp/emacs-async-comp-systemd-BZ3kNs.el

Inside the subprocess, load-file-name is
/tmp/emacs-async-comp-systemd-BZ3kNs.el instead of .../systemd/systemd.el and
the local txt resource files (unit-directives.txt etc) aren't resolvable from
/tmp.

When building systemd.el with async native compile, we can't rely on
`load-file-name`, so fall back to the native relative path lookup performed
in `insert-file-contents`.

native-compile-async runs compilation in a subprocess launched by loading
an elisp program from a temporary file:

(native-compile-async "/home/phil/.emacs.d/systemd/systemd.el")
=> invokes
emacs --batch -l /tmp/emacs-async-comp-systemd-BZ3kNs.el

Inside the subprocess, `load-file-name` is
/tmp/emacs-async-comp-systemd-BZ3kNs.el instead of .../systemd/systemd.el and
the local txt resource files (unit-directives.txt etc) aren't resolvable from
/tmp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant