about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-08-30 22:17:09 -0500
committerCase Duckworth2021-08-30 22:17:09 -0500
commit0dec964d67eac8138c553b23a4273e343ba5f618 (patch)
tree234e3a503d151e4b791181c73e6127ed1c53cd65
parentUse global-goto-address-mode instead of individual hooks (diff)
downloademacs-0dec964d67eac8138c553b23a4273e343ba5f618.tar.gz
emacs-0dec964d67eac8138c553b23a4273e343ba5f618.zip
Add `:straight-if' setup form
-rw-r--r--init.el47
1 files changed, 34 insertions, 13 deletions
diff --git a/init.el b/init.el index 3bec7f4..6f3ecb2 100644 --- a/init.el +++ b/init.el
@@ -23,16 +23,35 @@
23(require 'setup) 23(require 'setup)
24 24
25(setup setup 25(setup setup
26 ;; Install a package using `straight-use-package'
26 (setup-define :straight 27 (setup-define :straight
27 (lambda (recipe) 28 (lambda (recipe)
28 `(straight-use-package ',recipe)) 29 `(straight-use-package ',recipe))
29 :documentation "Install RECIPE with `straight-use-package'." 30 :documentation
31 "Install RECIPE with `straight-use-package'.
32This macro can be used as HEAD, and will replace itself with the
33first RECIPE's package."
30 :repeatable t 34 :repeatable t
31 :shorthand (lambda (sexp) 35 :shorthand (lambda (sexp)
32 (let ((recipe (cadr sexp))) 36 (let ((recipe (cadr sexp)))
33 (if (consp recipe) 37 (if (consp recipe)
34 (car recipe) 38 (car recipe)
35 recipe))))) 39 recipe))))
40 ;; Install a package with straight, but only under a condition
41 (setup-define :straight-if
42 (lambda (recipe condition)
43 `(if ,condition
44 (straight-use-package ',recipe)
45 ,(setup-quit)))
46 :documentation
47 "Install RECIPE with `straight-use-package' when CONDITION is met.
48If CONDITION is false, stop evaluating the body. This macro can
49be used as HEAD, and will replace itself with the RECIPE's
50package. This macro is not repeatable."
51 :repeatable nil
52 :shorthand (lambda (sexp)
53 (let ((recipe (cadr sexp)))
54 (if (consp recipe) (car recipe) recipe)))))
36 55
37;;;; `no-littering' 56;;;; `no-littering'
38(setup (:straight no-littering) 57(setup (:straight no-littering)
@@ -1362,8 +1381,8 @@ like a dumbass."
1362 (add-hook 'help-mode-hook #'epithet-rename-buffer) 1381 (add-hook 'help-mode-hook #'epithet-rename-buffer)
1363 (add-hook 'occur-mode-hook #'epithet-rename-buffer)) 1382 (add-hook 'occur-mode-hook #'epithet-rename-buffer))
1364 1383
1365(setup (:straight eradio) 1384(setup (:straight-if eradio
1366 (:needs "mpv") 1385 (executable-find "mpv"))
1367 (:option 1386 (:option
1368 eradio-player '("mpv" "--no-video" "--no-terminal") 1387 eradio-player '("mpv" "--no-video" "--no-terminal")
1369 eradio-channels `(("KLSU" . 1388 eradio-channels `(("KLSU" .
@@ -1428,8 +1447,8 @@ successive invocations."
1428 (:global "C-=" er/expand-region 1447 (:global "C-=" er/expand-region
1429 "C-SPC" acdw/set-mark-or-expand-region)) 1448 "C-SPC" acdw/set-mark-or-expand-region))
1430 1449
1431(setup (:straight fennel-mode) 1450(setup (:straight-if fennel-mode
1432 (:needs "fennel") 1451 (executable-find "fennel"))
1433 (autoload 'fennel-repl "fennel-mode" nil t) 1452 (autoload 'fennel-repl "fennel-mode" nil t)
1434 (add-to-list 'auto-mode-alist '("\\.fnl\\'" . fennel-mode))) 1453 (add-to-list 'auto-mode-alist '("\\.fnl\\'" . fennel-mode)))
1435 1454
@@ -1483,8 +1502,8 @@ successive invocations."
1483(setup (:straight lacarte) 1502(setup (:straight lacarte)
1484 (:global "<f10>" lacarte-execute-menu-command)) 1503 (:global "<f10>" lacarte-execute-menu-command))
1485 1504
1486(setup (:straight ledger-mode) 1505(setup (:straight-if ledger-mode
1487 (:needs "ledger")) 1506 (executable-find "ledger")))
1488 1507
1489(setup (:straight lua-mode) 1508(setup (:straight lua-mode)
1490 (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))) 1509 (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode)))
@@ -1764,11 +1783,13 @@ successive invocations."
1764 1783
1765 (simple-modeline-mode +1)) 1784 (simple-modeline-mode +1))
1766 1785
1767(setup (:straight sly) 1786(setup (:straight-if sly
1768 (defvar acdw/lisp-bin (or (executable-find "sbcl") 1787 (progn (defvar acdw/lisp-bin
1769 (executable-find "clisp") 1788 (or (executable-find "sbcl")
1770 "")) 1789 (executable-find "clisp")
1771 (:needs acdw/lisp-bin) 1790 ""))
1791 (executable-find acdw/lisp-bin)))
1792
1772 (:option inferior-lisp-program acdw/lisp-bin 1793 (:option inferior-lisp-program acdw/lisp-bin
1773 sly-kill-without-query-p t) 1794 sly-kill-without-query-p t)
1774 1795