Autoload format library
If you byte-compile your config, the expanded forms of this library's macros (like print! or format!) will use internal functions that aren't autoloaded (like `doom--format`, mentioned in #1768), causing void-function errors.
This commit is contained in:
parent
4045827d61
commit
9d775ca798
1 changed files with 7 additions and 0 deletions
|
@ -91,6 +91,7 @@ Accepts 'ansi and 'text-properties. nil means don't render colors.")
|
||||||
;;
|
;;
|
||||||
;;; Library
|
;;; Library
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun doom--format (output)
|
(defun doom--format (output)
|
||||||
(if (string-empty-p (string-trim output))
|
(if (string-empty-p (string-trim output))
|
||||||
""
|
""
|
||||||
|
@ -99,6 +100,7 @@ Accepts 'ansi and 'text-properties. nil means don't render colors.")
|
||||||
"\n" (concat "\n" (make-string doom-format-indent 32))
|
"\n" (concat "\n" (make-string doom-format-indent 32))
|
||||||
output t t))))
|
output t t))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun doom--format-print (output)
|
(defun doom--format-print (output)
|
||||||
(unless (string-empty-p output)
|
(unless (string-empty-p output)
|
||||||
(if (not noninteractive)
|
(if (not noninteractive)
|
||||||
|
@ -107,6 +109,7 @@ Accepts 'ansi and 'text-properties. nil means don't render colors.")
|
||||||
(terpri)) ; newline
|
(terpri)) ; newline
|
||||||
t))
|
t))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun doom--format-indent (width text &optional prefix)
|
(defun doom--format-indent (width text &optional prefix)
|
||||||
"Indent TEXT by WIDTH spaces. If ARGS, format TEXT with them."
|
"Indent TEXT by WIDTH spaces. If ARGS, format TEXT with them."
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
|
@ -121,6 +124,7 @@ Accepts 'ansi and 'text-properties. nil means don't render colors.")
|
||||||
(insert prefix)))
|
(insert prefix)))
|
||||||
(buffer-string)))
|
(buffer-string)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun doom--format-autofill (&rest msgs)
|
(defun doom--format-autofill (&rest msgs)
|
||||||
"Ensure MSG is split into lines no longer than `fill-column'."
|
"Ensure MSG is split into lines no longer than `fill-column'."
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
|
@ -131,6 +135,7 @@ Accepts 'ansi and 'text-properties. nil means don't render colors.")
|
||||||
(fill-region (point-min) (point-max))
|
(fill-region (point-min) (point-max))
|
||||||
(buffer-string))))
|
(buffer-string))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun doom--format-color (style format &rest args)
|
(defun doom--format-color (style format &rest args)
|
||||||
"Apply STYLE to formatted MESSAGE with ARGS.
|
"Apply STYLE to formatted MESSAGE with ARGS.
|
||||||
|
|
||||||
|
@ -159,6 +164,7 @@ Otherwise, it maps colors to a term-color-* face."
|
||||||
((cddr (assq style doom-format-ansi-alist)))))))
|
((cddr (assq style doom-format-ansi-alist)))))))
|
||||||
(_ message))))
|
(_ message))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun doom--format-class (class format &rest args)
|
(defun doom--format-class (class format &rest args)
|
||||||
"Apply CLASS to formatted format with ARGS.
|
"Apply CLASS to formatted format with ARGS.
|
||||||
|
|
||||||
|
@ -172,6 +178,7 @@ transformative logic."
|
||||||
(args (apply #'format format args))
|
(args (apply #'format format args))
|
||||||
(format))))
|
(format))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun doom--format-apply (forms &optional sub)
|
(defun doom--format-apply (forms &optional sub)
|
||||||
"Replace color-name functions with calls to `doom--format-color'."
|
"Replace color-name functions with calls to `doom--format-color'."
|
||||||
(cond ((null forms) nil)
|
(cond ((null forms) nil)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue