diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-11 00:03:31 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-11 00:03:31 -0500 |
| commit | e72bc4165739d07d2258992c6376759723270a57 (patch) | |
| tree | 1888718891fbb84c8b9be4b080959a6c75dde218 /modules | |
| parent | 287ca3a7cb8a351e5cae1b2480fbe2baf42e2fc8 (diff) | |
| download | dotemacs-e72bc4165739d07d2258992c6376759723270a57.tar.gz dotemacs-e72bc4165739d07d2258992c6376759723270a57.zip | |
fix(config-utilities): detect native-comp with the right predicate, clear eln-cache
cj/recompile-emacs-home selected native compilation with (boundp 'native-compile-async), but that's a function, so boundp is always nil. The command silently byte-compiled every time, even on native-comp builds. Detection now goes through cj/--native-comp-p, which uses native-comp-available-p. The native cleanup also deleted <dir>/eln, but the real cache is eln-cache/, so a stale cache survived. Both are pinned by tests: a regression on the detection helper, and the cache test now targets eln-cache.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/config-utilities.el | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/config-utilities.el b/modules/config-utilities.el index 72427ef9..4332f407 100644 --- a/modules/config-utilities.el +++ b/modules/config-utilities.el @@ -131,12 +131,18 @@ Signals `user-error' if METHOD-SYMBOL is nil or not fboundp." ;;; ----------------------------- Config Compilation ---------------------------- +(defun cj/--native-comp-p () + "Return non-nil when native compilation is available on this build. +Detected with `native-comp-available-p', not `boundp' of the async function: +`native-compile-async' is a function, so `boundp' is always nil." + (and (fboundp 'native-comp-available-p) (native-comp-available-p))) + (defun cj/--recompile-emacs-home (dir &optional native-p) "Delete all .elc/.eln files under DIR, then recompile. NATIVE-P chooses native compilation when non-nil, byte otherwise. -Also removes the eln (native) or elc (byte) cache directory. +Also removes the eln-cache (native) or elc (byte) cache directory. Returns the compilation method used: \\='native or \\='byte." - (let ((elt-dir (expand-file-name (if native-p "eln" "elc") dir))) + (let ((elt-dir (expand-file-name (if native-p "eln-cache" "elc") dir))) (message "Deleting all compiled files in %s" dir) (dolist (file (directory-files-recursively dir "\\(\\.elc\\|\\.eln\\)$")) (delete-file file)) @@ -157,7 +163,7 @@ Returns the compilation method used: \\='native or \\='byte." "Delete all compiled files in the Emacs home before recompiling. Recompile natively when supported, otherwise fall back to byte compilation." (interactive) - (let* ((native (boundp 'native-compile-async)) + (let* ((native (cj/--native-comp-p)) (mode-word (if native "native" "byte"))) (if (yes-or-no-p (format "Please confirm recursive %s recompilation of %s: " |
