New doom-demote-warnings option for suppress dependency warnings

This commit is contained in:
Henrik Lissner 2018-03-05 03:02:17 -05:00
parent 55b2a6df68
commit 74d8ea2b0f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -35,6 +35,11 @@
(strike . 9)) (strike . 9))
"List of styles.") "List of styles.")
(defvar doom-demote-warnings nil
"If non-nil, Doom module warnings (the ones that pop up when you're missing a
dependency) will only log a message in *Messages* instead of opening a
*Warnings* window.")
;;;###autoload ;;;###autoload
(defun doom-ansi-apply (code message &rest args) (defun doom-ansi-apply (code message &rest args)
"Apply the ansi CODE to formatted MESSAGE with ARGS." "Apply the ansi CODE to formatted MESSAGE with ARGS."
@ -89,10 +94,16 @@ interactive session."
return t) return t)
`(cl-destructuring-bind (cat . mod) `(cl-destructuring-bind (cat . mod)
(doom-module-from-path ,load-file-name) (doom-module-from-path ,load-file-name)
(delay-warning (format "%s %s" cat mod) (format ,message ,@args) (if doom-demote-warnings
:warning)) (message "WARNING (%s %s) %s" cat mod (format ,message ,@args))
`(delay-warning (file-relative-name load-file-name doom-emacs-dir) (delay-warning (format "%s %s" cat mod) (format ,message ,@args)
(format ,message ,@args) :warning)))) :warning)))
`(if doom-demote-warnings
(message "WARNING (%s) %s"
(file-relative-name load-file-name doom-emacs-dir)
(format ,message ,@args))
(delay-warning (file-relative-name load-file-name doom-emacs-dir)
(format ,message ,@args) :warning)))))
;;;###autoload ;;;###autoload
(defmacro log! (message &rest args) (defmacro log! (message &rest args)