From 9d775ca798cf98cecbe3537ec1ecbe33add7f366 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 9 Sep 2019 13:59:13 -0400 Subject: [PATCH] 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. --- core/autoload/format.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/autoload/format.el b/core/autoload/format.el index 7de5af711..8e4df3882 100644 --- a/core/autoload/format.el +++ b/core/autoload/format.el @@ -91,6 +91,7 @@ Accepts 'ansi and 'text-properties. nil means don't render colors.") ;; ;;; Library +;;;###autoload (defun doom--format (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)) output t t)))) +;;;###autoload (defun doom--format-print (output) (unless (string-empty-p output) (if (not noninteractive) @@ -107,6 +109,7 @@ Accepts 'ansi and 'text-properties. nil means don't render colors.") (terpri)) ; newline t)) +;;;###autoload (defun doom--format-indent (width text &optional prefix) "Indent TEXT by WIDTH spaces. If ARGS, format TEXT with them." (with-temp-buffer @@ -121,6 +124,7 @@ Accepts 'ansi and 'text-properties. nil means don't render colors.") (insert prefix))) (buffer-string))) +;;;###autoload (defun doom--format-autofill (&rest msgs) "Ensure MSG is split into lines no longer than `fill-column'." (with-temp-buffer @@ -131,6 +135,7 @@ Accepts 'ansi and 'text-properties. nil means don't render colors.") (fill-region (point-min) (point-max)) (buffer-string)))) +;;;###autoload (defun doom--format-color (style format &rest 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))))))) (_ message)))) +;;;###autoload (defun doom--format-class (class format &rest args) "Apply CLASS to formatted format with ARGS. @@ -172,6 +178,7 @@ transformative logic." (args (apply #'format format args)) (format)))) +;;;###autoload (defun doom--format-apply (forms &optional sub) "Replace color-name functions with calls to `doom--format-color'." (cond ((null forms) nil)