From c901f5806e4b5d28ca7f93a5dfd4daffa6771593 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 23 Aug 2024 01:30:44 -0400 Subject: [PATCH] fix(cli): straight ignoring native-comp-jit-compilation-deny-list Turns out native-comp doesn't respect `native-comp-jit-compilation-deny-list` if called explicitly (instead of from deferred compilation). Fix: #5592 Fix: #6283 Fix: #3655 --- lisp/cli/packages.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lisp/cli/packages.el b/lisp/cli/packages.el index 09f72dc32..c1a515fbe 100644 --- a/lisp/cli/packages.el +++ b/lisp/cli/packages.el @@ -704,6 +704,31 @@ original state.") ;; noninteractive sessions. (advice-add #'straight-vc-git--popup-raw :override #'straight--popup-raw) +;; HACK: `native-comp' only respects `native-comp-jit-compilation-deny-list' +;; when native-compiling packages in interactive sessions. It ignores the +;; variable when, say, straight is building packages. This advice forces it to +;; obey it, even when used by straight (but only in the CLI). +(defadvice! doom-cli--native--compile-async-skip-p (fn files &optional recursively load selector) + :around #'native-compile-async + (let (file-list) + (dolist (file-or-dir (ensure-list files)) + (cond ((file-directory-p file-or-dir) + (dolist (file (if recursively + (directory-files-recursively + file-or-dir comp-valid-source-re) + (directory-files file-or-dir + t comp-valid-source-re))) + (push file file-list))) + ((file-exists-p file-or-dir) + (push file-or-dir file-list)) + ((signal 'native-compiler-error + (list "Not a file nor directory" file-or-dir))))) + (funcall fn (seq-remove (lambda (file) + (seq-some (lambda (re) (string-match-p re file)) + native-comp-deferred-compilation-deny-list)) + file-list) + recursively load selector))) + ;; HACK Replace GUI popup prompts (which hang indefinitely in tty Emacs) with ;; simple prompts. (defadvice! doom-cli--straight-fallback-to-y-or-n-prompt-a (fn &optional prompt noprompt?)