Refactor def-package!

It is no longer necessary to gate use-package calls with
:if/:when/:unless checks during byte-compilation. This was fixed
somewhere along the way.
This commit is contained in:
Henrik Lissner 2018-06-12 00:26:28 +02:00
parent fe6afa19a3
commit f7a86ae281
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -265,13 +265,7 @@ to least)."
(when (and (memq name (bound-and-true-p doom-disabled-packages)) (when (and (memq name (bound-and-true-p doom-disabled-packages))
(not (memq :disabled plist))) (not (memq :disabled plist)))
(setq plist `(:disabled t ,@plist))) (setq plist `(:disabled t ,@plist)))
;; If byte-compiling, ignore this package if it doesn't meet the condition. `(use-package ,name ,@plist))
;; This avoids false-positive load errors.
(unless (and (bound-and-true-p byte-compile-current-file)
(or (and (plist-member plist :if) (not (eval (plist-get plist :if) t)))
(and (plist-member plist :when) (not (eval (plist-get plist :when) t)))
(and (plist-member plist :unless) (eval (plist-get plist :unless) t))))
`(use-package ,name ,@plist)))
(defmacro def-package-hook! (package when &rest body) (defmacro def-package-hook! (package when &rest body)
"Reconfigures a package's `def-package!' block. "Reconfigures a package's `def-package!' block.