Move doom-ansi-apply away from macros + add docstring

This commit is contained in:
Henrik Lissner 2018-02-14 03:21:33 -05:00
parent 5e5d075431
commit 11373e0128
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -35,6 +35,17 @@
(strike . 9))
"List of styles.")
;;;###autoload
(defun doom-ansi-apply (code message &rest args)
"Apply the ansi CODE to formatted MESSAGE with ARGS."
(let ((rule (or (assq code doom-message-fg)
(assq code doom-message-bg)
(assq code doom-message-fx))))
(format "\e[%dm%s\e[%dm"
(cdr rule)
(apply #'format message args)
0)))
;;;###autoload
(defmacro format! (message &rest args)
"An alternative to `format' that strips out ANSI codes if used in an
@ -69,16 +80,6 @@ interactive session."
(pop-to-buffer buf)
(goto-char (point-max)))))
;;;###autoload
(defun doom-ansi-apply (code format &rest args)
(let ((rule (or (assq code doom-message-fg)
(assq code doom-message-bg)
(assq code doom-message-fx))))
(format "\e[%dm%s\e[%dm"
(cdr rule)
(apply #'format format args)
0)))
;;;###autoload
(defmacro warn! (message &rest args)
"Output a colored warning for the current module in the *Messages* buffer."