New warn! macro; replace debug! with log! macro
This commit is contained in:
parent
7d9f2e5078
commit
7e87ab3e29
2 changed files with 21 additions and 7 deletions
|
@ -69,12 +69,6 @@ interactive session."
|
|||
(pop-to-buffer buf)
|
||||
(goto-char (point-max)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro debug! (message &rest args)
|
||||
"Out a debug message if `doom-debug-mode' is non-nil. Otherwise, ignore this."
|
||||
(when doom-debug-mode
|
||||
`(message ,message ,@args)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-ansi-apply (code format &rest args)
|
||||
(let ((rule (or (assq code doom-message-fg)
|
||||
|
@ -85,3 +79,23 @@ interactive session."
|
|||
(apply #'format format args)
|
||||
0)))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro warn! (message &rest args)
|
||||
"Output a colored warning for the current module in the *Messages* buffer."
|
||||
(let ((msg (format "WARNING: %s" (format message args))))
|
||||
(if (file-in-directory-p load-file-name doom-modules-dir)
|
||||
`(cl-destructuring-bind (cat . mod) (doom-module-from-path load-file-name)
|
||||
(message
|
||||
"%s"
|
||||
(propertize (format "%s %s" (list cat mod) ,msg)
|
||||
'face 'warning)))
|
||||
`(message "%s" (propertize ,msg 'face 'warning)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro log! (message &rest args)
|
||||
"Output a debug message if `doom-debug-mode' is non-nil. Otherwise, ignore this."
|
||||
(when doom-debug-mode
|
||||
`(message
|
||||
"LOG: %s"
|
||||
(propertize (format ,message ,@args)
|
||||
'face 'font-lock-comment-face))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue