systemd-mode icon indicating copy to clipboard operation
systemd-mode copied to clipboard

Fix txt file paths during native-compile-async

Open pdbrown opened this issue 4 years ago • 0 comments

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.

pdbrown avatar Jan 31 '22 00:01 pdbrown