Fix empty load-file-name in warn! macro during byte-compilation

This commit is contained in:
Henrik Lissner 2018-02-14 20:52:25 -05:00
parent 0f404a513a
commit ae52b2ff60
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -83,11 +83,12 @@ interactive session."
;;;###autoload ;;;###autoload
(defmacro warn! (message &rest args) (defmacro warn! (message &rest args)
"Output a colored warning for the current module in the *Messages* buffer." "Output a colored warning for the current module in the *Messages* buffer."
(let ((load-file-name (or load-file-name byte-compile-current-file)))
(if (file-in-directory-p load-file-name doom-modules-dir) (if (file-in-directory-p load-file-name doom-modules-dir)
`(cl-destructuring-bind (cat . mod) (doom-module-from-path ,load-file-name) `(cl-destructuring-bind (cat . mod) (doom-module-from-path ,load-file-name)
(delay-warning (format "%s %s" cat mod) (format ,message ,@args) :warning)) (delay-warning (format "%s %s" cat mod) (format ,message ,@args) :warning))
`(delay-warning (file-relative-name load-file-name doom-emacs-dir) `(delay-warning (file-relative-name load-file-name doom-emacs-dir)
(format ,message ,@args) :warning))) (format ,message ,@args) :warning))))
;;;###autoload ;;;###autoload
(defmacro log! (message &rest args) (defmacro log! (message &rest args)