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
writes to `standard-output'."
`(cond (doom-debug-mode ,@forms)
((not doom-interactive-mode)
(letf! ((standard-output (lambda (&rest _)))
(defun load-file (file) (load-file nil t))
(defun message (&rest _))
(defun write-region (start end filename &optional append visit lockname mustbenew)
(unless visit (setq visit 'no-message))
(funcall write-region start end filename append visit lockname mustbenew)))
,@forms))
((let ((inhibit-message t)
(save-silently t))
(prog1 ,@forms (message ""))))))
`(if doom-debug-mode
(progn ,@forms)
,(if doom-interactive-mode
`(let ((inhibit-message t)
(save-silently t))
(prog1 ,@forms (message "")))
`(letf! ((standard-output (lambda (&rest _)))
(defun load-file (file) (load-file nil t))
(defun message (&rest _))
(defun write-region (start end filename &optional append visit lockname mustbenew)
(unless visit (setq visit 'no-message))
(funcall write-region start end filename append visit lockname mustbenew)))
,@forms))))
(defmacro if! (cond then &rest body)
"Expands to THEN if COND is non-nil, to BODY otherwise.