Rewrite doctor; move warn! blocks out in doctor.el files

This commit is contained in:
Henrik Lissner 2018-03-12 13:16:16 -04:00
parent 5c36519dab
commit 74c8b1d113
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
16 changed files with 193 additions and 147 deletions

View file

@ -35,11 +35,6 @@
(strike . 9))
"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
(defun doom-ansi-apply (code message &rest args)
"Apply the ansi CODE to formatted MESSAGE with ARGS."
@ -85,26 +80,6 @@ interactive session."
(pop-to-buffer buf)
(goto-char (point-max)))))
;;;###autoload
(defmacro warn! (message &rest args)
"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 (cl-loop for dir in doom-modules-dirs
if (file-in-directory-p load-file-name dir)
return t)
`(cl-destructuring-bind (cat . mod)
(doom-module-from-path ,load-file-name)
(if doom-demote-warnings
(message "WARNING (%s %s) %s" cat mod (format ,message ,@args))
(delay-warning (format "%s %s" cat mod) (format ,message ,@args)
: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
(defmacro log! (message &rest args)
"Output a debug message if `doom-debug-mode' is non-nil. Otherwise, ignore this."