Simplify quiet!'s expanded form

We don't need to test doom-interactive-mode at runtime.
This commit is contained in:
Henrik Lissner 2020-05-14 22:36:43 -04:00
parent 68709fe93a
commit fc90e0fb71
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -231,18 +231,19 @@ the same name, for use with `funcall' or `apply'. ARGLIST and BODY are as in
This silences calls to `message', `load-file', `write-region' and anything that This silences calls to `message', `load-file', `write-region' and anything that
writes to `standard-output'." writes to `standard-output'."
`(cond (doom-debug-mode ,@forms) `(if doom-debug-mode
((not doom-interactive-mode) (progn ,@forms)
(letf! ((standard-output (lambda (&rest _))) ,(if doom-interactive-mode
(defun load-file (file) (load-file nil t)) `(let ((inhibit-message t)
(defun message (&rest _)) (save-silently t))
(defun write-region (start end filename &optional append visit lockname mustbenew) (prog1 ,@forms (message "")))
(unless visit (setq visit 'no-message)) `(letf! ((standard-output (lambda (&rest _)))
(funcall write-region start end filename append visit lockname mustbenew))) (defun load-file (file) (load-file nil t))
,@forms)) (defun message (&rest _))
((let ((inhibit-message t) (defun write-region (start end filename &optional append visit lockname mustbenew)
(save-silently t)) (unless visit (setq visit 'no-message))
(prog1 ,@forms (message "")))))) (funcall write-region start end filename append visit lockname mustbenew)))
,@forms))))
(defmacro if! (cond then &rest body) (defmacro if! (cond then &rest body)
"Expands to THEN if COND is non-nil, to BODY otherwise. "Expands to THEN if COND is non-nil, to BODY otherwise.