New warn! macro; replace debug! with log! macro

This commit is contained in:
Henrik Lissner 2018-02-04 17:53:20 -05:00
parent 7d9f2e5078
commit 7e87ab3e29
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 21 additions and 7 deletions

View file

@ -69,12 +69,6 @@ interactive session."
(pop-to-buffer buf) (pop-to-buffer buf)
(goto-char (point-max))))) (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 ;;;###autoload
(defun doom-ansi-apply (code format &rest args) (defun doom-ansi-apply (code format &rest args)
(let ((rule (or (assq code doom-message-fg) (let ((rule (or (assq code doom-message-fg)
@ -85,3 +79,23 @@ interactive session."
(apply #'format format args) (apply #'format format args)
0))) 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))))

View file

@ -154,7 +154,7 @@ Used by `doom//packages-update'."
;; asynchronously. ;; asynchronously.
(let (futures) (let (futures)
(dolist (pkg quelpa-pkgs) (dolist (pkg quelpa-pkgs)
(debug! "New thread for: %s" pkg) (log! "New thread for: %s" pkg)
(push (async-start (push (async-start
`(lambda () `(lambda ()
(setq user-emacs-directory ,user-emacs-directory) (setq user-emacs-directory ,user-emacs-directory)