Allow expansion of stage-restricted forms

The package! family of macros will throw an error if used in the wrong
files. This same check would prevent macroexpand from expanding them, or
prevent them from being evaluated inline.
This commit is contained in:
Henrik Lissner
2019-07-07 13:29:22 +02:00
parent dd4c70fe93
commit ebd53e5664

View File

@ -77,7 +77,11 @@ list is returned as-is."
else collect (intern (format "%s-hook" (symbol-name hook))))))) else collect (intern (format "%s-hook" (symbol-name hook)))))))
(defun doom--assert-stage-p (stage macro) (defun doom--assert-stage-p (stage macro)
(unless (bound-and-true-p byte-compile-current-file) (unless (or (bound-and-true-p byte-compile-current-file)
;; Don't complain if we're being evaluated on-the-fly. Since forms
;; are often evaluated (by `eval-region') or expanded (by
;; macroexpand) in a temp buffer in `emacs-lisp-mode'...
(eq major-mode 'emacs-lisp-mode))
(cl-assert (eq stage doom--stage) (cl-assert (eq stage doom--stage)
nil nil
"Found %s call in non-%s.el file (%s)" "Found %s call in non-%s.el file (%s)"