about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el99
-rw-r--r--lisp/+setup.el133
2 files changed, 136 insertions, 96 deletions
diff --git a/init.el b/init.el index ddef209..c1a1cd2 100644 --- a/init.el +++ b/init.el
@@ -255,7 +255,7 @@
255 255
256(setup dired 256(setup dired
257 (:also-load dired-x +dired) 257 (:also-load dired-x +dired)
258 (:also-straight dired+) 258 (:straight dired+)
259 (:option dired-recursive-copies 'always 259 (:option dired-recursive-copies 'always
260 dired-recursive-deletes 'always 260 dired-recursive-deletes 'always
261 dired-create-destination-dirs 'always 261 dired-create-destination-dirs 'always
@@ -543,8 +543,8 @@
543 :build (:not autoloads) 543 :build (:not autoloads)
544 :files (:defaults 544 :files (:defaults
545 "lisp/*.el" 545 "lisp/*.el"
546 ("etc/styles/" "etc/styles/*"))) 546 ("etc/styles/" "etc/styles/*"))))
547 (org-contrib 547 (:straight (org-contrib
548 :type git :host nil 548 :type git :host nil
549 :repo "https://git.sr.ht/~bzg/org-contrib")) 549 :repo "https://git.sr.ht/~bzg/org-contrib"))
550 ;; DO NOT load system-installed org !!! 550 ;; DO NOT load system-installed org !!!
@@ -860,7 +860,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
860 (:with-mode adaptive-wrap-prefix-mode 860 (:with-mode adaptive-wrap-prefix-mode
861 (:hook-into visual-column-mode))) 861 (:hook-into visual-column-mode)))
862 862
863(setup (:straight-when affe 863(setup (:straight affe
864 (or (executable-find "rg") 864 (or (executable-find "rg")
865 (and (executable-find "find") 865 (and (executable-find "find")
866 (executable-find "grep")))) 866 (executable-find "grep"))))
@@ -905,9 +905,9 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
905 (setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark))) 905 (setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark)))
906 906
907(setup (:straight bbdb) 907(setup (:straight bbdb)
908 (:straight bbdb-vcard)
908 (:require bbdb-autoloads 909 (:require bbdb-autoloads
909 bbdb) 910 bbdb)
910 (:also-straight bbdb-vcard)
911 (bbdb-initialize 'gnus 'message)) 911 (bbdb-initialize 'gnus 'message))
912 912
913(setup (:straight (bongo :type git 913(setup (:straight (bongo :type git
@@ -1289,7 +1289,8 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
1289 (setf (alist-get 'consult-notmuch vertico-multiform-commands) '(buffer) 1289 (setf (alist-get 'consult-notmuch vertico-multiform-commands) '(buffer)
1290 (alist-get 'consult-notmuch-tree vertico-multiform-commands) '(buffer)))) 1290 (alist-get 'consult-notmuch-tree vertico-multiform-commands) '(buffer))))
1291 1291
1292(setup (:straight corfu) (:quit "Turns out, I actually like minibuffer completion better.") 1292(setup (:straight corfu
1293 :quit "Turns out, I actually like minibuffer completion better.")
1293 (+with-ensure-after-init 1294 (+with-ensure-after-init
1294 (corfu-global-mode +1))) 1295 (corfu-global-mode +1)))
1295 1296
@@ -1366,7 +1367,7 @@ See also `crux-reopen-as-root-mode'."
1366(setup (:straight dumb-jump) 1367(setup (:straight dumb-jump)
1367 (add-hook 'xref-backend-functions #'dumb-jump-xref-activate)) 1368 (add-hook 'xref-backend-functions #'dumb-jump-xref-activate))
1368 1369
1369(setup (:straight-when ebuku 1370(setup (:straight ebuku
1370 (executable-find "buku")) 1371 (executable-find "buku"))
1371 (:option ebuku-display-on-startup 'recent 1372 (:option ebuku-display-on-startup 'recent
1372 ebuku-recent-count 100)) 1373 ebuku-recent-count 100))
@@ -1490,12 +1491,13 @@ See also `crux-reopen-as-root-mode'."
1490(setup (:straight eshell-syntax-highlighting) 1491(setup (:straight eshell-syntax-highlighting)
1491 (:hook-into eshell-mode)) 1492 (:hook-into eshell-mode))
1492 1493
1493;; (setup (:straight eshell-vterm) 1494(setup (:straight eshell-vterm
1494;; (:load-after eshell) 1495 :quit)
1495;; (defalias 'eshell/v 'eshell-exec-visual) 1496 (:load-after eshell)
1496;; (eshell-vterm-mode +1)) 1497 (defalias 'eshell/v 'eshell-exec-visual)
1498 (eshell-vterm-mode +1))
1497 1499
1498(setup (:straight-when exec-path-from-shell 1500(setup (:straight exec-path-from-shell
1499 (eq system-type 'gnu/linux)) 1501 (eq system-type 'gnu/linux))
1500 (require 'exec-path-from-shell) 1502 (require 'exec-path-from-shell)
1501 (dolist (var '("SSH_AUTH_SOCK" 1503 (dolist (var '("SSH_AUTH_SOCK"
@@ -1544,8 +1546,8 @@ See also `crux-reopen-as-root-mode'."
1544 (with-eval-after-load 'vertico-multiform 1546 (with-eval-after-load 'vertico-multiform
1545 (setf (alist-get 'flyspell vertico-multiform-categories) nil))) 1547 (setf (alist-get 'flyspell vertico-multiform-categories) nil)))
1546 1548
1547(setup (:straight-when (forge 1549(setup (:straight (forge
1548 :host github :repo "magit/forge") 1550 :host github :repo "magit/forge")
1549 (eq system-type 'gnu/linux)) 1551 (eq system-type 'gnu/linux))
1550 (require 'forge) 1552 (require 'forge)
1551 (add-to-list 'forge-alist 1553 (add-to-list 'forge-alist
@@ -1570,10 +1572,10 @@ See also `crux-reopen-as-root-mode'."
1570 :files ("elisp/*.el" "doc/*" "geiser-pkg.el") 1572 :files ("elisp/*.el" "doc/*" "geiser-pkg.el")
1571 :pre-build ("make" "-Cdoc" "geiser.info") 1573 :pre-build ("make" "-Cdoc" "geiser.info")
1572 :host gitlab 1574 :host gitlab
1573 :repo "emacs-geiser/geiser") 1575 :repo "emacs-geiser/geiser"))
1574 geiser-chicken 1576 (:straight geiser-chicken)
1575 macrostep-geiser 1577 (:straight macrostep-geiser)
1576 scheme-complete) 1578 (:straight scheme-complete)
1577 (:require +chicken) 1579 (:require +chicken)
1578 (setf (alist-get "\\.scm\\'" auto-mode-alist nil nil #'string=) 1580 (setf (alist-get "\\.scm\\'" auto-mode-alist nil nil #'string=)
1579 'scheme-mode)) 1581 'scheme-mode))
@@ -1582,7 +1584,8 @@ See also `crux-reopen-as-root-mode'."
1582 :host github :repo "magit/git-modes")) 1584 :host github :repo "magit/git-modes"))
1583 (:require git-modes)) 1585 (:require git-modes))
1584 1586
1585(setup (:straight god-mode) (:quit "I could never get the hang of this.") 1587(setup (:straight god-mode
1588 :quit "I could never get the hang of this.")
1586 (setq god-mode-enable-function-key-translation nil) 1589 (setq god-mode-enable-function-key-translation nil)
1587 (:require god-mode 1590 (:require god-mode
1588 +god-mode) 1591 +god-mode)
@@ -1631,6 +1634,9 @@ See also `crux-reopen-as-root-mode'."
1631 (paredit-forward-delete arg)))) 1634 (paredit-forward-delete arg))))
1632 (global-hungry-delete-mode +1)) 1635 (global-hungry-delete-mode +1))
1633 1636
1637(setup (:straight i3wm-config-mode
1638 (executable-find "i3")))
1639
1634(setup (:straight info+) 1640(setup (:straight info+)
1635 (:load-after info) 1641 (:load-after info)
1636 (:option Info-fontify-isolated-quote-flag nil 1642 (:option Info-fontify-isolated-quote-flag nil
@@ -1693,7 +1699,7 @@ See also `crux-reopen-as-root-mode'."
1693 :host github :repo "duckwork/keepassxc-shim.el")) 1699 :host github :repo "duckwork/keepassxc-shim.el"))
1694 (keepassxc-shim-activate)) 1700 (keepassxc-shim-activate))
1695 1701
1696(setup (:straight-when keychain-environment 1702(setup (:straight keychain-environment
1697 (executable-find "keychain")) 1703 (executable-find "keychain"))
1698 (keychain-refresh-environment)) 1704 (keychain-refresh-environment))
1699 1705
@@ -1782,7 +1788,8 @@ See also `crux-reopen-as-root-mode'."
1782 #'hl-line-mode 1788 #'hl-line-mode
1783 #'lin-mode)) 1789 #'lin-mode))
1784 1790
1785(setup (:straight md4rd) (:quit "Janky a.f.") 1791(setup (:straight md4rd
1792 :quit)
1786 ;; `md4rd' is ... a bit janky, tbh. But I'm including this here so I have it. 1793 ;; `md4rd' is ... a bit janky, tbh. But I'm including this here so I have it.
1787 ;; TODO: enable opening Reddit links in md4rd 1794 ;; TODO: enable opening Reddit links in md4rd
1788 (:also-load _md4rd) 1795 (:also-load _md4rd)
@@ -1873,7 +1880,8 @@ See also `crux-reopen-as-root-mode'."
1873 (:when-loaded 1880 (:when-loaded
1874 (notmuch-bookmarks-mode +1))) 1881 (notmuch-bookmarks-mode +1)))
1875 1882
1876(setup (:straight notmuch-labeler) (:quit "This is buggy") 1883(setup (:straight notmuch-labeler
1884 :quit "Buggy")
1877 (:load-after notmuch)) 1885 (:load-after notmuch))
1878 1886
1879(setup (:straight ol-notmuch)) 1887(setup (:straight ol-notmuch))
@@ -1969,17 +1977,13 @@ See also `crux-reopen-as-root-mode'."
1969 lisp-interaction-mode 1977 lisp-interaction-mode
1970 scheme-mode)) 1978 scheme-mode))
1971 1979
1972(setup (:straight pdf-tools) 1980(setup (:straight pdf-tools
1981 (or (executable-find "gcc")
1982 (executable-find "g++")))
1983 (setf (alist-get "\\.pdf\\'" auto-mode-alist nil nil #'equal)
1984 #'pdf-view-mode)
1973 (pdf-tools-install)) 1985 (pdf-tools-install))
1974 1986
1975;; (setup (:straight-when pdf-tools
1976;; ;; Ensure we can build `pdf-tools'
1977;; (or (executable-find "gcc")
1978;; (executable-find "g++")))
1979;; (setf (alist-get "\\.pdf\\'" auto-mode-alist nil nil #'equal)
1980;; #'pdf-view-mode)
1981;; (pdf-tools-install t))
1982
1983(setup (:straight (plancat 1987(setup (:straight (plancat
1984 :host github 1988 :host github
1985 :repo "duckwork/plancat.el" 1989 :repo "duckwork/plancat.el"
@@ -2078,7 +2082,7 @@ See also `crux-reopen-as-root-mode'."
2078 (alert-add-rule :category "slack" 2082 (alert-add-rule :category "slack"
2079 :style 'ignore))) 2083 :style 'ignore)))
2080 2084
2081(setup (:straight-when sly 2085(setup (:straight sly
2082 (defvar +lisp-bin (executable-find "sbcl"))) 2086 (defvar +lisp-bin (executable-find "sbcl")))
2083 (:also-load sly-autoloads 2087 (:also-load sly-autoloads
2084 +sly) 2088 +sly)
@@ -2120,7 +2124,7 @@ See also `crux-reopen-as-root-mode'."
2120 (auto-save-visited-mode -1) 2124 (auto-save-visited-mode -1)
2121 (super-save-mode +1)) 2125 (super-save-mode +1))
2122 2126
2123(setup (:straight-when systemd 2127(setup (:straight systemd
2124 (executable-find "systemd")) 2128 (executable-find "systemd"))
2125 (:option systemd-man-function 'woman)) 2129 (:option systemd-man-function 'woman))
2126 2130
@@ -2189,10 +2193,8 @@ See also `crux-reopen-as-root-mode'."
2189 2193
2190(setup (:straight unfill)) 2194(setup (:straight unfill))
2191 2195
2192(setup (:straight valign) 2196(setup (:straight valign
2193 (:hook-into org-mode)) 2197 :quit "Doesn't work with narrowed tables.")
2194
2195(setup (:straight valign) (:quit "Doesn't work with narrowed tables.")
2196 (:option valign-fancy-bar t) 2198 (:option valign-fancy-bar t)
2197 (:hook-into org-mode 2199 (:hook-into org-mode
2198 markdown-mode)) 2200 markdown-mode))
@@ -2246,21 +2248,22 @@ See also `crux-reopen-as-root-mode'."
2246(setup (:straight vlf) 2248(setup (:straight vlf)
2247 (:require vlf-setup)) 2249 (:require vlf-setup))
2248 2250
2251(setup (:straight vterm
2252 (and module-file-suffix
2253 (executable-find "cmake"))
2254 :quit)
2255 (:also-load +vterm)
2256 (:option vterm-always-compile-module t
2257 vterm-buffer-name-string "vterm: %s"
2258 vterm-max-scrollback 100000 ; max allowed by vterm-module.h
2259 )
2260 (advice-add 'counsel-yank-pop-action :around
2261 #'+vterm-counsel-yank-pop-action))
2262
2249(setup (:straight (vundo 2263(setup (:straight (vundo
2250 :host github 2264 :host github
2251 :repo "casouri/vundo"))) 2265 :repo "casouri/vundo")))
2252 2266
2253;; (setup (:straight-when vterm
2254;; (and module-file-suffix
2255;; (executable-find "cmake")))
2256;; (:also-load +vterm)
2257;; (:option vterm-always-compile-module t
2258;; vterm-buffer-name-string "vterm: %s"
2259;; vterm-max-scrollback 100000 ; max allowed by vterm-module.h
2260;; )
2261;; (advice-add 'counsel-yank-pop-action :around
2262;; #'+vterm-counsel-yank-pop-action))
2263
2264(setup (:straight web-mode) 2267(setup (:straight web-mode)
2265 (setf (alist-get (rx "." (or "htm" "html" "phtml" "tpl.php" 2268 (setf (alist-get (rx "." (or "htm" "html" "phtml" "tpl.php"
2266 "asp" "gsp" "jsp" "ascx" "aspx" 2269 "asp" "gsp" "jsp" "ascx" "aspx"
diff --git a/lisp/+setup.el b/lisp/+setup.el index 7c658b6..975bcde 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el
@@ -23,6 +23,7 @@
23(require 'el-patch) 23(require 'el-patch)
24(require 'setup) 24(require 'setup)
25(require 'straight) 25(require 'straight)
26(require 'cl-lib)
26 27
27(defun +setup-warn (message &rest args) 28(defun +setup-warn (message &rest args)
28 "Warn the user that something bad happened in `setup'." 29 "Warn the user that something bad happened in `setup'."
@@ -66,57 +67,93 @@ If PATH does not exist, abort the evaluation."
66;;; Straight.el 67;;; Straight.el
67 68
68(with-eval-after-load 'straight 69(with-eval-after-load 'straight
69 (setup-define :also-straight 70 (defun setup--straight-handle-arg (arg var)
70 (lambda (recipe) `(setup (:straight ,recipe))) 71 (cond
71 :documentation 72 ((and (boundp var) (symbol-value var)) t)
72 "Install RECIPE with `straight-use-package', after loading FEATURE." 73 ((keywordp arg) (set var t))
73 :repeatable t 74 ((functionp arg) (set var nil) (funcall arg))
74 :after-loaded t) 75 ((listp arg) (set var nil) (eval arg :lexical))))
75
76 (defun +setup-straight-shorthand (sexp)
77 "Shorthand for `:straight' and other local macros."
78 (let ((recipe (cadr sexp)))
79 (or (car-safe recipe) recipe)))
80 76
81 (setup-define :straight 77 (setup-define :straight
82 (lambda (recipe) 78 (lambda (recipe &rest predicates)
83 `(unless (ignore-errors (straight-use-package ',recipe) t) 79 (let* ((skp (make-symbol "straight-keyword-p"))
84 (+setup-warn ":straight error: %S" ',recipe) 80 (straight-use-p
85 ,(setup-quit))) 81 (cl-every (lambda (f) (setup--straight-handle-arg f skp))
86 :documentation 82 predicates))
87 "Install RECIPE with `straight-use-package'. 83 (form `(unless (and ,straight-use-p
88This macro can be used as HEAD, and will replace itself with the 84 (condition-case e
89first RECIPE's package." 85 (straight-use-package ',recipe)
90 :repeatable t 86 (error
91 :shorthand #'+setup-straight-shorthand) 87 (+setup-warn ":straight error: %S"
92 88 ',recipe)
93 (setup-define :straight-after 89 ,(setup-quit))
94 (lambda (recipe feature) 90 (:success t)))
95 `(with-eval-after-load ,feature 91(defun setup--straight-handle-arg (arg var)
96 (setup (:straight ,recipe)))) 92 (cond
97 :indent 1 93 ((and (boundp var) (symbol-value var)) t)
98 :documentation 94 ((keywordp arg) (set var t))
99 "Install RECIPE with `straight-use-package', after FEATURE. 95 ((functionp arg) (set var nil) (funcall arg))
100This macro can be used as HEAD, and will replace itself with the 96 ((listp arg) (set var nil) (eval arg :lexical))))
101first RECIPE's package." 97
102 :shorthand #'+setup-straight-shorthand) 98(setup-define :straight
103 99 (lambda (recipe &rest predicates)
104 (setup-define :straight-when 100 (let* ((skp (make-symbol "straight-keyword-p"))
105 (lambda (recipe condition) 101 (straight-use-p
106 `(if ,condition 102 (cl-every (lambda (f) (setup--straight-handle-arg f skp))
107 (unless (ignore-errors (straight-use-package ',recipe) t) 103 predicates))
108 (+setup-warn ":straight error: %S" ',recipe) 104 (form `(unless (and ,straight-use-p
109 ,(setup-quit)) 105 (condition-case e
110 (message "Setup: :straight-when returned nil %S" ',recipe) 106 (straight-use-package ',recipe)
111 ,(setup-quit))) 107 (error
112 :documentation 108 (+setup-warn ":straight error: %S"
113 "Install RECIPE with `straight-use-package' when CONDITION is met. 109 ',recipe)
114If CONDITION is false, or if `straight-use-package' fails, stop 110 ,(setup-quit))
115evaluating the body. This macro can be used as HEAD, and will 111 (:success t)))
116replace itself with the RECIPE's package." 112 ,(setup-quit))))
117 :repeatable 2 113 ;; Keyword arguments --- :quit is special and should short-circuit
114 (if (memq :quit predicates)
115 (setq form `,(setup-quit))
116 ;; Otherwise, handle the rest of them ...
117 (when-let ((after (cadr (memq :after predicates))))
118 (setq form `(with-eval-after-load ,(if (eq after t)
119 (setup-get 'feature)
120 after)
121 ,form))))
122 ;; Finally ...
123 form))
124 :documentation "Install RECIPE with `straight-use-package'.
125If PREDICATES are given, only install RECIPE if all of them return non-nil.
126The following keyword arguments are also recognized:
127- :quit --- immediately stop evaluating. Good for commenting.
128- :after FEATURE --- only install RECIPE after FEATURE is loaded.
129 If FEATURE is t, install RECIPE after the current feature."
130 :repeatable nil
131 :indent 1
132 :shorthand (lambda (sexp)
133 (let ((recipe (cadr sexp)))
134 (or (car-safe recipe) recipe)))) ,(setup-quit))))
135 ;; Keyword arguments --- :quit is special and should short-circuit
136 (if (memq :quit predicates)
137 (setq form `,(setup-quit))
138 ;; Otherwise, handle the rest of them ...
139 (when-let ((after (cadr (memq :after predicates))))
140 (setq form `(with-eval-after-load ,(if (eq after t)
141 (setup-get 'feature)
142 after)
143 ,form))))
144 ;; Finally ...
145 form))
146 :documentation "Install RECIPE with `straight-use-package'.
147If PREDICATES are given, only install RECIPE if all of them return non-nil.
148The following keyword arguments are also recognized:
149- :quit --- immediately stop evaluating. Good for commenting.
150- :after FEATURE --- only install RECIPE after FEATURE is loaded.
151 If FEATURE is t, install RECIPE after the current feature."
152 :repeatable nil
118 :indent 1 153 :indent 1
119 :shorthand #'+setup-straight-shorthand)) 154 :shorthand (lambda (sexp)
155 (let ((recipe (cadr sexp)))
156 (or (car-safe recipe) recipe)))))
120 157
121 158
122;;; Redefines of `setup' forms 159;;; Redefines of `setup' forms