Skip to content

Commit

Permalink
Update for latest native-compile-async API (#637)
Browse files Browse the repository at this point in the history
Replace `late` load flag with `nil` to prevent packages being forcibly
loaded after they're compiled.  Packages which are loaded while they're
compiling should be supported by the existing loading mechanisms.

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

Add a `straight--native-compile-file-p` selector which checks files
against the deny list.  This ensures that straight will respect the deny
list when requesting compilation of packages.

WARNING: This change requires native-comp commit 7a8370ed.  Older
native-comp builds are no longer supported by straight.
  • Loading branch information
flatwhatson committed Nov 24, 2020
1 parent 1a7453a commit 3277e1c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions straight.el
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ They are still logged to the *Messages* buffer.")))
;;;; Functions from other packages

;; `comp'
(defvar comp-deferred-compilation-black-list)
(defvar comp-deferred-compilation-deny-list)

;; `finder-inf'
(defvar package--builtins)
Expand Down Expand Up @@ -4723,6 +4723,12 @@ individual package recipe."
(not (straight--plist-get recipe :no-native-compile
straight-disable-native-compilation))))

(defun straight--native-compile-file-p (file)
"Predicate to check whether FILE should be native-compiled."
(not (cl-some (lambda (re)
(string-match-p re file))
comp-deferred-compilation-deny-list)))

(defun straight--native-compile-package (recipe)
"Queue native compilation for the symlinked package specified by RECIPE.
RECIPE should be a straight.el-style plist. Note that this
Expand All @@ -4731,6 +4737,7 @@ repository. Also note that native compilation occurs
asynchronously, and will continue in the background after
`straight-use-package' returns."
(when (fboundp 'native-compile-async)
(require 'comp)
(straight--with-plist recipe
(package)
(if (straight--native-compile-package-p recipe)
Expand All @@ -4739,10 +4746,10 @@ asynchronously, and will continue in the background after
(message-log-max nil))
(native-compile-async
(straight--build-dir package)
'recursively 'late))
'recursively nil
#'straight--native-compile-file-p))
;; Prevent compilation of this package
(require 'comp)
(add-to-list 'comp-deferred-compilation-black-list
(add-to-list 'comp-deferred-compilation-deny-list
(format "^%s" (straight--build-dir package)))))))

;;;;; Info compilation
Expand Down

0 comments on commit 3277e1c

Please sign in to comment.