(internal): add org-roam-message (#593)

This macro simplifies message printing, so we can respect
`org-roam-verbose` in more places. Also silences more messages when
`org-roam-verbose` set to false.
This commit is contained in:
Jethro Kuan
2020-05-10 16:44:28 +08:00
committed by GitHub
parent d68d1f8ebb
commit 3efe315ff1
4 changed files with 21 additions and 13 deletions

View File

@ -33,6 +33,8 @@
;;; Code:
;;;; Library Requires
(defvar org-roam-verbose)
(defmacro org-roam--with-temp-buffer (&rest body)
"Execute BODY within a temp buffer.
Like `with-temp-buffer', but propagates `org-roam-directory'."
@ -56,7 +58,11 @@ to look.
(error-message-string err)
,templates))))
(defmacro org-roam-message (format-string &rest args)
"Message MSG with ARGS when `org-roam-verbose' is true."
(declare (indent 0) (debug t))
`(when org-roam-verbose
(message (concat "(org-roam) " ,format-string) ,@args)))
(provide 'org-roam-macs)