Fix doom//byte-compile when recompiling plugins

This would cause odd void-variable/function errors because
doom//byte-compile would erroneously try to compile *everything* after
recompiling plugins.
This commit is contained in:
Henrik Lissner 2018-05-31 01:31:33 +02:00
parent 2784e3cb72
commit b1ab80ec3f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -280,7 +280,8 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
(":private" (push doom-private-dir targets))
(":plugins"
(byte-recompile-directory package-user-dir 0 t)
(setq compile-plugins-p t))
(setq compile-plugins-p t
modules (delete ":plugins" modules)))
((pred file-directory-p)
(push module targets))
((pred (string-match "^\\([^/]+\\)/\\([^/]+\\)$"))
@ -288,24 +289,33 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
(intern (format ":%s" (match-string 1 module)))
(intern (match-string 2 module)))
targets))))
(unless (equal modules (list ":plugins"))
(let ((inhibit-message t)
noninteractive)
;; But first we must be sure that Doom and your private config have been
;; fully loaded. Which usually aren't so in an noninteractive session.
(doom//reload-autoloads)
(doom-initialize t)))
;; If no targets were supplied, then we use your module list.
(unless targets
(doom-initialize-modules t)
(setq targets (append (list doom-core-dir)
(doom-module-load-path))))
;; Assemble el files we want to compile; taking into account that MODULES
;; may be a list of MODULE/SUBMODULE strings from the command line.
(let ((target-files (doom-files-in targets :depth 2 :match "\\.el$")))
(if (not target-files)
(unless compile-plugins-p
(cl-block 'byte-compile
;; If we're just here to byte-compile our plugins, we're done!
(and (not modules)
compile-plugins-p
(cl-return-from 'byte-compile t))
(unless targets
(let ((inhibit-message t)
noninteractive)
;; But first we must be sure that Doom and your private config have
;; been fully loaded. Which usually aren't so in an noninteractive
;; session.
(doom//reload-autoloads)
(doom-initialize t)))
;; If no targets were supplied, then we use your module list.
(unless modules
(doom-initialize-modules t)
(setq targets (append (list doom-core-dir)
(doom-module-load-path))))
;; Assemble el files we want to compile; taking into account that
;; MODULES may be a list of MODULE/SUBMODULE strings from the command
;; line.
(let ((target-files (doom-files-in targets :depth 2 :match "\\.el$")))
(unless target-files
(if targets
(message "Couldn't find any valid targets")
(message "No targets to %scompile" (if recompile-p "re" "")))
(cl-return-from 'byte-compile))
(condition-case ex
(let ((use-package-expand-minimally t))
;; Always compile private init file