about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-06-09 09:16:50 -0500
committerCase Duckworth2022-06-09 09:16:50 -0500
commit21b5d80814520540454c1167ca0495dd023c54dd (patch)
treeb50bd959b44f7dbb6986514f4f88540a848913c8 /lisp
parentblep (diff)
downloademacs-21b5d80814520540454c1167ca0495dd023c54dd.tar.gz
emacs-21b5d80814520540454c1167ca0495dd023c54dd.zip
Fix startup complaining
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+apheleia.el45
-rw-r--r--lisp/+compile.el3
-rw-r--r--lisp/+cus-edit.el6
-rw-r--r--lisp/+nyan-mode.el3
-rw-r--r--lisp/+setup.el58
5 files changed, 62 insertions, 53 deletions
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 @@
2 2
3;;; Code: 3;;; Code:
4 4
5(require 'apheleia)
6(require 'cl-lib) 5(require 'cl-lib)
7 6
8;; https://github.com/raxod502/apheleia/pull/63#issue-1077529623 7;; https://github.com/raxod502/apheleia/pull/63#issue-1077529623
@@ -14,49 +13,5 @@
14 (point-max)) 13 (point-max))
15 (funcall callback))) 14 (funcall callback)))
16 15
17
18;;; `setup' integration
19
20(require 'setup)
21
22(setup-define :apheleia
23 (lambda (name formatter &optional mode -pend)
24 (let* ((mode (or mode (setup-get 'mode)))
25 (current-formatters (and -pend
26 (alist-get mode apheleia-formatters))))
27 `(progn
28 (setf (alist-get ',name apheleia-formatters)
29 ,formatter)
30 (setf (alist-get ',mode apheleia-mode-alist)
31 ',(pcase -pend
32 (:append (append (ensure-list current-formatters)
33 (list name)))
34 (:prepend (cons name (ensure-list current-formatters)))
35 ('nil name)
36 (_ (error "Improper `:apheleia' -PEND argument")))))))
37 :documentation
38 "Register a formatter to `apheleia''s lists.
39NAME is the name given to the formatter in `apheleia-formatters'
40and `apheleia-mode-alist'. FORMATTER is the command paired with
41NAME in `apheleia-formatters'. MODE is the mode or modes to add
42NAME to in `apheleia-mode-alist'. If MODE is not given or nil,
43use the setup form's MODE. Optional argument -PEND can be one of
44`:append' or `:prepend', and if given will append or prepend the
45given NAME to the current formatters for the MODE in
46`apheleia-mode-alist', rather than replace them (the default).
47
48Example:
49(setup
50 (:apheleia isort (\"isort\" \"--stdout\" \"-\")
51 python-mode))
52; =>
53(progn
54 (setf (alist-get 'isort apheleia-formatters)
55 '(\"isort\" \"--stdout\" \"-\"))
56 (setf (alist-get 'python-mode apheleia-mode-alist)
57 'isort))
58
59This form cannot be repeated, and it cannot be used as HEAD.")
60
61(provide '+apheleia) 16(provide '+apheleia)
62;;; +apheleia.el ends here 17;;; +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 @@
7(defcustom +compile-function nil 7(defcustom +compile-function nil
8 "Function to run to \"compile\" a buffer." 8 "Function to run to \"compile\" a buffer."
9 :type 'function 9 :type 'function
10 :local t) 10 :local t
11 :risky nil)
11 12
12(defun +compile-dispatch (&optional arg) 13(defun +compile-dispatch (&optional arg)
13 "Run `+compile-function', if bound, or `compile'. 14 "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 @@
33(defcustom +custom-variable-allowlist nil 33(defcustom +custom-variable-allowlist nil
34 "Variables to allow changing while loading the Custom file.") 34 "Variables to allow changing while loading the Custom file.")
35 35
36(defcustom +custom-after-load-hook nil
37 "Functions to run after loading the custom file.")
38
36(defun +custom-load-ignoring-most-customizations (&optional 39(defun +custom-load-ignoring-most-customizations (&optional
37 error 40 error
38 nomessage 41 nomessage
@@ -55,7 +58,8 @@ pass t to it."
55 (memq (car el) 58 (memq (car el)
56 +custom-variable-allowlist)) 59 +custom-variable-allowlist))
57 args))))) 60 args)))))
58 (load custom-file (not error) nomessage nosuffix must-suffix))) 61 (load custom-file (not error) nomessage nosuffix must-suffix))
62 (run-hooks '+custom-after-load-hook))
59 63
60(defun +cus-edit-expand-widgets (&rest _) 64(defun +cus-edit-expand-widgets (&rest _)
61 "Expand descriptions in `Custom-mode' buffers." 65 "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 @@
24 (advice-add fn :after #'+nyan-mode--fmlu) 24 (advice-add fn :after #'+nyan-mode--fmlu)
25 (advice-remove fn #'+nyan-mode--fmlu)))) 25 (advice-remove fn #'+nyan-mode--fmlu))))
26 26
27(defface +nyan-mode-line nil
28 "Face for the nyan-mode mode-line indicator.")
29
27(define-minor-mode +nyan-local-mode 30(define-minor-mode +nyan-local-mode
28 "My very own `nyan-mode' that isn't global and doesn't update the mode-line." 31 "My very own `nyan-mode' that isn't global and doesn't update the mode-line."
29 :global nil 32 :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."
43 name) 43 name)
44 ,body))) 44 ,body)))
45 45
46
47;;; New forms
48
46(setup-define :quit 49(setup-define :quit
47 'setup-quit 50 'setup-quit
48 :documentation "Quit the current `setup' form. 51 :documentation "Quit the current `setup' form.
@@ -77,7 +80,16 @@ If PATH does not exist, abort the evaluation."
77 (file-name-nondirectory 80 (file-name-nondirectory
78 (directory-file-name (cadr args)))))) 81 (directory-file-name (cadr args))))))
79 82
83(setup-define :needs
84 (lambda (executable)
85 `(unless (executable-find ,executable)
86 ,(setup-quit)))
87 :documentation "If EXECUTABLE is not in the path, stop here."
88 :repeatable 1)
89
80 90
91;;; Package integrations
92
81;;; Straight.el 93;;; Straight.el
82 94
83(defun setup--straight-handle-arg (arg var) 95(defun setup--straight-handle-arg (arg var)
@@ -127,12 +139,46 @@ The following keyword arguments are also recognized:
127 (let ((recipe (cadr sexp))) 139 (let ((recipe (cadr sexp)))
128 (or (car-safe recipe) recipe))))) 140 (or (car-safe recipe) recipe)))))
129 141
130(setup-define :needs 142;;; Apheleia
131 (lambda (executable) 143
132 `(unless (executable-find ,executable) 144(setup-define :apheleia
133 ,(setup-quit))) 145 (lambda (name formatter &optional mode -pend)
134 :documentation "If EXECUTABLE is not in the path, stop here." 146 (let* ((mode (or mode (setup-get 'mode)))
135 :repeatable 1) 147 (current-formatters (and -pend
148 (alist-get mode apheleia-formatters))))
149 `(with-eval-after-load 'apheleia
150 (setf (alist-get ',name apheleia-formatters)
151 ,formatter)
152 (setf (alist-get ',mode apheleia-mode-alist)
153 ',(pcase -pend
154 (:append (append (ensure-list current-formatters)
155 (list name)))
156 (:prepend (cons name (ensure-list current-formatters)))
157 ('nil name)
158 (_ (error "Improper `:apheleia' -PEND argument")))))))
159 :documentation
160 "Register a formatter to `apheleia''s lists.
161NAME is the name given to the formatter in `apheleia-formatters'
162and `apheleia-mode-alist'. FORMATTER is the command paired with
163NAME in `apheleia-formatters'. MODE is the mode or modes to add
164NAME to in `apheleia-mode-alist'. If MODE is not given or nil,
165use the setup form's MODE. Optional argument -PEND can be one of
166`:append' or `:prepend', and if given will append or prepend the
167given NAME to the current formatters for the MODE in
168`apheleia-mode-alist', rather than replace them (the default).
169
170Example:
171(setup
172 (:apheleia isort (\"isort\" \"--stdout\" \"-\")
173 python-mode))
174; =>
175(progn
176 (setf (alist-get 'isort apheleia-formatters)
177 '(\"isort\" \"--stdout\" \"-\"))
178 (setf (alist-get 'python-mode apheleia-mode-alist)
179 'isort))
180
181This form cannot be repeated, and it cannot be used as HEAD.")
136 182
137 183
138;;; Redefines of `setup' forms 184;;; Redefines of `setup' forms