From 21b5d80814520540454c1167ca0495dd023c54dd Mon Sep 17 00:00:00 2001
From: Case Duckworth
Date: Thu, 9 Jun 2022 09:16:50 -0500
Subject: Fix startup complaining

---
 lisp/+apheleia.el  | 45 ------------------------------------------
 lisp/+compile.el   |  3 ++-
 lisp/+cus-edit.el  |  6 +++++-
 lisp/+nyan-mode.el |  3 +++
 lisp/+setup.el     | 58 ++++++++++++++++++++++++++++++++++++++++++++++++------
 5 files changed, 62 insertions(+), 53 deletions(-)

(limited to 'lisp')

diff --git a/lisp/+apheleia.el b/lisp/+apheleia.el
index df651b8..9ed731c 100644
--- a/lisp/+apheleia.el
+++ b/lisp/+apheleia.el
@@ -2,7 +2,6 @@
 
 ;;; Code:
 
-(require 'apheleia)
 (require 'cl-lib)
 
 ;; https://github.com/raxod502/apheleia/pull/63#issue-1077529623
@@ -14,49 +13,5 @@
                    (point-max))
     (funcall callback)))
 
-
-;;; `setup' integration
-
-(require 'setup)
-
-(setup-define :apheleia
-  (lambda (name formatter &optional mode -pend)
-    (let* ((mode (or mode (setup-get 'mode)))
-           (current-formatters (and -pend
-                                    (alist-get mode apheleia-formatters))))
-      `(progn
-         (setf (alist-get ',name apheleia-formatters)
-               ,formatter)
-         (setf (alist-get ',mode apheleia-mode-alist)
-               ',(pcase -pend
-                   (:append (append (ensure-list current-formatters)
-                                    (list name)))
-                   (:prepend (cons name (ensure-list current-formatters)))
-                   ('nil name)
-                   (_ (error "Improper `:apheleia' -PEND argument")))))))
-  :documentation
-   "Register a formatter to `apheleia''s lists.
-NAME is the name given to the formatter in `apheleia-formatters'
-and `apheleia-mode-alist'.  FORMATTER is the command paired with
-NAME in `apheleia-formatters'.  MODE is the mode or modes to add
-NAME to in `apheleia-mode-alist'.  If MODE is not given or nil,
-use the setup form's MODE.  Optional argument -PEND can be one of
-`:append' or `:prepend', and if given will append or prepend the
-given NAME to the current formatters for the MODE in
-`apheleia-mode-alist', rather than replace them (the default).
-
-Example:
-(setup
- (:apheleia isort (\"isort\" \"--stdout\" \"-\")
-                  python-mode))
-; =>
-(progn
-  (setf (alist-get 'isort apheleia-formatters)
-        '(\"isort\" \"--stdout\" \"-\"))
-  (setf (alist-get 'python-mode apheleia-mode-alist)
-        'isort))
-
-This form cannot be repeated, and it cannot be used as HEAD.")
-
 (provide '+apheleia)
 ;;; +apheleia.el ends here
diff --git a/lisp/+compile.el b/lisp/+compile.el
index b20ae4d..a69db7d 100644
--- a/lisp/+compile.el
+++ b/lisp/+compile.el
@@ -7,7 +7,8 @@
 (defcustom +compile-function nil
   "Function to run to \"compile\" a buffer."
   :type 'function
-  :local t)
+  :local t
+  :risky nil)
 
 (defun +compile-dispatch (&optional arg)
   "Run `+compile-function', if bound, or `compile'.
diff --git a/lisp/+cus-edit.el b/lisp/+cus-edit.el
index 4631811..a67279c 100644
--- a/lisp/+cus-edit.el
+++ b/lisp/+cus-edit.el
@@ -33,6 +33,9 @@
 (defcustom +custom-variable-allowlist nil
   "Variables to allow changing while loading the Custom file.")
 
+(defcustom +custom-after-load-hook nil
+  "Functions to run after loading the custom file.")
+
 (defun +custom-load-ignoring-most-customizations (&optional
                                                      error
                                                      nomessage
@@ -55,7 +58,8 @@ pass t to it."
                                     (memq (car el)
                                           +custom-variable-allowlist))
                                   args)))))
-    (load custom-file (not error) nomessage nosuffix must-suffix)))
+    (load custom-file (not error) nomessage nosuffix must-suffix))
+  (run-hooks '+custom-after-load-hook))
 
 (defun +cus-edit-expand-widgets (&rest _)
   "Expand descriptions in `Custom-mode' buffers."
diff --git a/lisp/+nyan-mode.el b/lisp/+nyan-mode.el
index fc6775b..33ae9af 100644
--- a/lisp/+nyan-mode.el
+++ b/lisp/+nyan-mode.el
@@ -24,6 +24,9 @@
         (advice-add fn :after #'+nyan-mode--fmlu)
       (advice-remove fn #'+nyan-mode--fmlu))))
 
+(defface +nyan-mode-line nil
+  "Face for the nyan-mode mode-line indicator.")
+
 (define-minor-mode +nyan-local-mode
   "My very own `nyan-mode' that isn't global and doesn't update the mode-line."
   :global nil
diff --git a/lisp/+setup.el b/lisp/+setup.el
index 1f110d6..a08526a 100644
--- a/lisp/+setup.el
+++ b/lisp/+setup.el
@@ -43,6 +43,9 @@ it includes the NAME of the setup form in the warning output."
                                    name)
        ,body)))
 
+
+;;; New forms
+
 (setup-define :quit
   'setup-quit
   :documentation "Quit the current `setup' form.
@@ -77,7 +80,16 @@ If PATH does not exist, abort the evaluation."
                 (file-name-nondirectory
                  (directory-file-name (cadr args))))))
 
+(setup-define :needs
+  (lambda (executable)
+    `(unless (executable-find ,executable)
+       ,(setup-quit)))
+  :documentation "If EXECUTABLE is not in the path, stop here."
+  :repeatable 1)
+
 
+;;; Package integrations
+
 ;;; Straight.el
 
 (defun setup--straight-handle-arg (arg var)
@@ -127,12 +139,46 @@ The following keyword arguments are also recognized:
                  (let ((recipe (cadr sexp)))
                    (or (car-safe recipe) recipe)))))
 
-(setup-define :needs
-  (lambda (executable)
-    `(unless (executable-find ,executable)
-       ,(setup-quit)))
-  :documentation "If EXECUTABLE is not in the path, stop here."
-  :repeatable 1)
+;;; Apheleia
+
+(setup-define :apheleia
+  (lambda (name formatter &optional mode -pend)
+    (let* ((mode (or mode (setup-get 'mode)))
+           (current-formatters (and -pend
+                                    (alist-get mode apheleia-formatters))))
+      `(with-eval-after-load 'apheleia
+         (setf (alist-get ',name apheleia-formatters)
+               ,formatter)
+         (setf (alist-get ',mode apheleia-mode-alist)
+               ',(pcase -pend
+                   (:append (append (ensure-list current-formatters)
+                                    (list name)))
+                   (:prepend (cons name (ensure-list current-formatters)))
+                   ('nil name)
+                   (_ (error "Improper `:apheleia' -PEND argument")))))))
+  :documentation
+  "Register a formatter to `apheleia''s lists.
+NAME is the name given to the formatter in `apheleia-formatters'
+and `apheleia-mode-alist'.  FORMATTER is the command paired with
+NAME in `apheleia-formatters'.  MODE is the mode or modes to add
+NAME to in `apheleia-mode-alist'.  If MODE is not given or nil,
+use the setup form's MODE.  Optional argument -PEND can be one of
+`:append' or `:prepend', and if given will append or prepend the
+given NAME to the current formatters for the MODE in
+`apheleia-mode-alist', rather than replace them (the default).
+
+Example:
+(setup
+ (:apheleia isort (\"isort\" \"--stdout\" \"-\")
+                  python-mode))
+; =>
+(progn
+  (setf (alist-get 'isort apheleia-formatters)
+        '(\"isort\" \"--stdout\" \"-\"))
+  (setf (alist-get 'python-mode apheleia-mode-alist)
+        'isort))
+
+This form cannot be repeated, and it cannot be used as HEAD.")
 
 
 ;;; Redefines of `setup' forms
-- 
cgit 1.4.1-21-gabe81