Fix startup complaining

This commit is contained in:
Case Duckworth 2022-06-09 09:16:50 -05:00
parent af3eb37c8e
commit 21b5d80814
6 changed files with 82 additions and 72 deletions

39
init.el
View File

@ -115,7 +115,6 @@
(add-to-list '+custom-variable-allowlist var))
;; Load customizations now, and after init (to capture other possible
;; variables I want to load) XXX: this is dumb
(+custom-load-ignoring-most-customizations)
(+with-ensure-after-init
(+custom-load-ignoring-most-customizations))
(advice-add #'custom-buffer-create-internal :after #'+cus-edit-expand-widgets)
@ -507,21 +506,21 @@
(:require +finger) ; fixes `finger' to use var below
(:option finger-X.500-host-regexps '(".") ; only send username
)
(require 'transient)
(transient-define-prefix net-utils ()
"Networking utilities"
["Actions"
("p" "Ping" ping)
("i" "Ifconfig" ifconfig)
("w" "Iwconfig" iwconfig)
("n" "Netstat" netstat)
("a" "Arp" arp)
("r" "Route" route)
("h" "Nslookup host" nslookup-host)
("d" "Dig" dig)
("s" "Smb Client" smbclient)
("t" "Traceroute" traceroute)])
(:+key "C-z M-n" #'net-utils))
(with-eval-after-load 'transient
(transient-define-prefix net-utils ()
"Networking utilities"
["Actions"
("p" "Ping" ping)
("i" "Ifconfig" ifconfig)
("w" "Iwconfig" iwconfig)
("n" "Netstat" netstat)
("a" "Arp" arp)
("r" "Route" route)
("h" "Nslookup host" nslookup-host)
("d" "Dig" dig)
("s" "Smb Client" smbclient)
("t" "Traceroute" traceroute)])
(:+key "C-z M-n" #'net-utils)))
(setup notmuch
(:load-from "~/usr/share/emacs/site-lisp/")
@ -1051,9 +1050,11 @@
(setup (:straight bbdb)
(:straight bbdb-vcard)
(:require bbdb-autoloads
bbdb)
(bbdb-initialize 'gnus 'message))
(add-hook '+custom-after-load-hook
(defun +bbdb-load ()
(:require bbdb-autoloads
bbdb)
(bbdb-initialize 'gnus 'message))))
(setup (:straight (bongo :type git
:flavor melpa

View File

@ -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

View File

@ -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'.

View File

@ -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."

View File

@ -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

View File

@ -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