Refactor byte-compile dispatchers
And don't implicitly compile ~/.emacs.d/init.el unless :core (or no args) are passed.
This commit is contained in:
parent
337c16cb68
commit
2b7c215aee
1 changed files with 17 additions and 13 deletions
|
@ -85,9 +85,10 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
||||||
"Byte-compile anyway?")))
|
"Byte-compile anyway?")))
|
||||||
(message "Aborting.")
|
(message "Aborting.")
|
||||||
(cl-return-from 'byte-compile)))
|
(cl-return-from 'byte-compile)))
|
||||||
(and (not recompile-p)
|
(when (and (not recompile-p)
|
||||||
(or (null modules) (equal modules '(":core")))
|
(or (null modules)
|
||||||
(doom-clean-byte-compiled-files))
|
(equal modules '(":core"))))
|
||||||
|
(doom-clean-byte-compiled-files))
|
||||||
(let (doom-emacs-changed-p
|
(let (doom-emacs-changed-p
|
||||||
noninteractive)
|
noninteractive)
|
||||||
;; But first we must be sure that Doom and your private config have been
|
;; But first we must be sure that Doom and your private config have been
|
||||||
|
@ -107,9 +108,11 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
||||||
;; Assemble el files we want to compile; taking into account that
|
;; Assemble el files we want to compile; taking into account that
|
||||||
;; MODULES may be a list of MODULE/SUBMODULE strings from the command
|
;; MODULES may be a list of MODULE/SUBMODULE strings from the command
|
||||||
;; line.
|
;; line.
|
||||||
(let ((target-files (doom-files-in targets :filter #'doom--byte-compile-ignore-file-p))
|
(let ((target-files (doom-files-in targets :filter #'doom--byte-compile-ignore-file-p)))
|
||||||
(load-path load-path)
|
(when (or (not modules)
|
||||||
kill-emacs-hook kill-buffer-query-functions)
|
(member ":core" modules))
|
||||||
|
(push (expand-file-name "init.el" doom-emacs-dir)
|
||||||
|
target-files))
|
||||||
(unless target-files
|
(unless target-files
|
||||||
(if targets
|
(if targets
|
||||||
(message "Couldn't find any valid targets")
|
(message "Couldn't find any valid targets")
|
||||||
|
@ -118,7 +121,9 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
||||||
(require 'use-package)
|
(require 'use-package)
|
||||||
(condition-case e
|
(condition-case e
|
||||||
(let ((use-package-defaults use-package-defaults)
|
(let ((use-package-defaults use-package-defaults)
|
||||||
(use-package-expand-minimally t))
|
(use-package-expand-minimally t)
|
||||||
|
(load-path load-path)
|
||||||
|
kill-emacs-hook kill-buffer-query-functions)
|
||||||
;; Prevent packages from being loaded at compile time if they
|
;; Prevent packages from being loaded at compile time if they
|
||||||
;; don't meet their own predicates.
|
;; don't meet their own predicates.
|
||||||
(push (list :no-require t
|
(push (list :no-require t
|
||||||
|
@ -129,8 +134,6 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
||||||
(when-let* ((pred (plist-get args :unless)))
|
(when-let* ((pred (plist-get args :unless)))
|
||||||
(eval pred t)))))
|
(eval pred t)))))
|
||||||
use-package-defaults)
|
use-package-defaults)
|
||||||
;; Always compile private init file
|
|
||||||
(push (expand-file-name "init.el" doom-emacs-dir) target-files)
|
|
||||||
(dolist (target (cl-delete-duplicates (mapcar #'file-truename target-files) :test #'equal))
|
(dolist (target (cl-delete-duplicates (mapcar #'file-truename target-files) :test #'equal))
|
||||||
(if (or (not recompile-p)
|
(if (or (not recompile-p)
|
||||||
(let ((elc-file (byte-compile-dest-file target)))
|
(let ((elc-file (byte-compile-dest-file target)))
|
||||||
|
@ -171,10 +174,11 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
||||||
"Delete all the compiled elc files in your Emacs configuration and private
|
"Delete all the compiled elc files in your Emacs configuration and private
|
||||||
module. This does not include your byte-compiled, third party packages.'"
|
module. This does not include your byte-compiled, third party packages.'"
|
||||||
(cl-loop with default-directory = doom-emacs-dir
|
(cl-loop with default-directory = doom-emacs-dir
|
||||||
for path in (append (doom-files-in doom-emacs-dir :match "\\.elc$" :depth 0)
|
for path
|
||||||
(doom-files-in doom-private-dir :match "\\.elc$" :depth 1)
|
in (append (doom-files-in doom-emacs-dir :match "\\.elc$" :depth 0)
|
||||||
(doom-files-in doom-core-dir :match "\\.elc$")
|
(doom-files-in doom-private-dir :match "\\.elc$" :depth 1)
|
||||||
(doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4))
|
(doom-files-in doom-core-dir :match "\\.elc$")
|
||||||
|
(doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4))
|
||||||
for truepath = (file-truename path)
|
for truepath = (file-truename path)
|
||||||
if (file-exists-p path)
|
if (file-exists-p path)
|
||||||
do (delete-file path)
|
do (delete-file path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue