New doom-log macro for debug-time logging
doom-log won't interfere with the minibuffer if it's in use, and will report the originating module. Addresses #1215
This commit is contained in:
parent
9266239a2f
commit
f6cc2644b0
7 changed files with 32 additions and 22 deletions
|
@ -102,6 +102,22 @@ This is used by `associate!', `file-exists-p!' and `project-file-exists-p!'."
|
|||
(cl-check-type :test keyword)
|
||||
(substring (symbol-name keyword) 1))
|
||||
|
||||
(defmacro doom-log (format-string &rest args)
|
||||
"Log to *Messages* if `doom-debug-mode' is on.
|
||||
Does not interrupt the minibuffer if it is in use, but still logs to *Messages*.
|
||||
Accepts the same arguments as `message'."
|
||||
(when doom-debug-mode
|
||||
`(let ((inhibit-message (active-minibuffer-window)))
|
||||
(message
|
||||
,(concat (propertize "DOOM " 'face 'font-lock-comment-face)
|
||||
format-string
|
||||
(when doom--current-module
|
||||
(propertize (format " [%s/%s]"
|
||||
(doom-keyword-name (car doom--current-module))
|
||||
(cdr doom--current-module))
|
||||
'face 'warning)))
|
||||
,@args))))
|
||||
|
||||
(defun FILE! ()
|
||||
"Return the emacs lisp file this macro is called from."
|
||||
(cond ((bound-and-true-p byte-compile-current-file))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue