From 7e87ab3e29508dbabedd640ae741d78fe09e2eb7 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 4 Feb 2018 17:53:20 -0500 Subject: [PATCH] New warn! macro; replace debug! with log! macro --- core/autoload/message.el | 26 ++++++++++++++++++++------ core/autoload/packages.el | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/core/autoload/message.el b/core/autoload/message.el index d84d40a92..0284d1f5f 100644 --- a/core/autoload/message.el +++ b/core/autoload/message.el @@ -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)))) diff --git a/core/autoload/packages.el b/core/autoload/packages.el index ad65dbf25..e1dad42ed 100644 --- a/core/autoload/packages.el +++ b/core/autoload/packages.el @@ -154,7 +154,7 @@ Used by `doom//packages-update'." ;; asynchronously. (let (futures) (dolist (pkg quelpa-pkgs) - (debug! "New thread for: %s" pkg) + (log! "New thread for: %s" pkg) (push (async-start `(lambda () (setq user-emacs-directory ,user-emacs-directory)