reddit / emacs

Pre-compile *.eln files

authsec · 2022-10-01 21:22
I try to build a (docker) container with a pre-configured doom emacs instance. Now I'd like to pre-compile all the `eln` files ahead of time, so emacs does not compile the files every time the container spins up again. [Native compile after startup](https://preview.redd.it/7i9w3czig9r91.png?width=1644&format=png&auto=webp&s=5c24d87cb0f1784e08fc97191955a4cb9bae1a81) I have set `EMACSNATIVELOADPATH` which seems to avoid that doom generates `eln` files in the `tmp` directory. I have set (setq native-comp-eln-load-path '("/home/emre/local/lib/emacs/28.2/native-lisp/")) I have tried stuff like emacs --debug-init -q --no-site-file --batch --eval "(progn (load \"/home/emre/.emacs.d/early-init.el\") (require 'doom) (require 'doom-lib) (require 'doom-start) (setq package-native-compile t) (setq native-comp-async-jobs-number 8) (setq comp-deferred-compilation nil) (byte-force-recompile \"/home/emre/local/share/emacs/28.2\") (native-compile-async \"/home/emre/local/share/emacs/28.2\" t) (while (or comp-files-queue (> (comp-async-runnings) 0)) (progn (message \"Items left to compile %s\" (length comp-files-queue)) (sleep-for 1))) (kill-emacs))" Which doesn't seem to work either ... Has anyone an idea how I can achieve pre-compiling all `eln` files, that are shown in the output window?
7890yuiop · 2022-10-02 00:15
How about: find . -name "*.el" -print0 | xargs -0r -L1 emacs --batch --eval "(native-compile (car argv))"
authsec · 2022-10-02 20:32
Thank you for the idea. That didn't work unfortunately. I tried with multiple directories and in the end even with the full home directory, but at some point I then always end up with an error like this: ``` Debugger entered--Lisp error: (file-missing "/home/emre/local/share/emacs/28.2/etc/themes/modus..." "Cannot open load file" "No such file or directory" "modus-themes") ```
7890yuiop · 2022-10-02 22:54
`--batch` means your init file isn't loaded, so you'll probably need to `--eval "(package-initialize)"` first to update the `load-path`; and if you have any non-package `load-path` entries that you're adding manually in your config then you'll need to deal with those as well (potentially with `-L`).