Update for the latest native-compile-async API

Renamed `comp-deferred-compilation-black-list` to
`comp-deferred-compilation-deny-list`.

Removed the `late` load flag which is no longer required.

Added a check against the deny list when compiling all Elisp on the
load-path, so we don't inadvertently compile something we shouldn't.

Added compatibility shims to ease transition from older builds of
native-comp.
This commit is contained in:
Andrew Whatson 2020-11-24 10:09:20 +10:00
parent 5eab7d4414
commit d3e08c5d0b
2 changed files with 21 additions and 3 deletions

View file

@ -225,9 +225,12 @@ list remains lean."
collect path) collect path)
for file in (doom-files-in paths :match "\\.el\\(?:\\.gz\\)?$") for file in (doom-files-in paths :match "\\.el\\(?:\\.gz\\)?$")
if (and (file-exists-p (byte-compile-dest-file file)) if (and (file-exists-p (byte-compile-dest-file file))
(not (doom--find-eln-file (doom--eln-file-name file)))) do (not (doom--find-eln-file (doom--eln-file-name file)))
(not (cl-some (lambda (re)
(string-match-p re file))
comp-deferred-compilation-deny-list))) do
(doom-log "Compiling %s" file) (doom-log "Compiling %s" file)
(native-compile-async file nil 'late)))) (native-compile-async file))))
(defun doom--bootstrap-trampolines () (defun doom--bootstrap-trampolines ()
"Build the trampolines we need to prevent hanging." "Build the trampolines we need to prevent hanging."

View file

@ -286,13 +286,28 @@ config.el instead."
(add-to-list 'comp-eln-load-path (concat doom-cache-dir "eln/"))) (add-to-list 'comp-eln-load-path (concat doom-cache-dir "eln/")))
(after! comp (after! comp
;; Support the deprecated name for comp-deferred-compilation-deny-list
;; (changed in feature/native-comp@6104ab0f)
(unless (boundp 'comp-deferred-compilation-deny-list)
(defvaralias 'comp-deferred-compilation-deny-list
'comp-deferred-compilation-black-list))
;; Support native-compile-async lacking selector parameter
;; (added in feature/native-comp@7a8370ed)
(when (< (cdr (func-arity #'native-compile-async)) 4)
(defadvice! doom--native-compile-async-a (orig-fn paths &optional recursively load _selector)
:around #'native-compile-async
(if (fboundp 'native--compile-async)
(native--compile-async paths recursively load)
(funcall orig-fn paths recursively load))))
;; HACK Disable native-compilation for some troublesome packages ;; HACK Disable native-compilation for some troublesome packages
(dolist (entry (list (concat "\\`" (regexp-quote doom-local-dir) ".*/evil-collection-vterm\\.el\\'") (dolist (entry (list (concat "\\`" (regexp-quote doom-local-dir) ".*/evil-collection-vterm\\.el\\'")
;; https://github.com/nnicandro/emacs-jupyter/issues/297 ;; https://github.com/nnicandro/emacs-jupyter/issues/297
(concat "\\`" (regexp-quote doom-local-dir) ".*/jupyter-channel\\.el\\'") (concat "\\`" (regexp-quote doom-local-dir) ".*/jupyter-channel\\.el\\'")
(concat "\\`" (regexp-quote doom-local-dir) ".*/with-editor\\.el\\'") (concat "\\`" (regexp-quote doom-local-dir) ".*/with-editor\\.el\\'")
(concat "\\`" (regexp-quote doom-autoloads-file) "'"))) (concat "\\`" (regexp-quote doom-autoloads-file) "'")))
(add-to-list 'comp-deferred-compilation-black-list entry))) (add-to-list 'comp-deferred-compilation-deny-list entry)))
;; ;;