diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw-setup.el | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/lisp/acdw-setup.el b/lisp/acdw-setup.el new file mode 100644 index 0000000..ca30249 --- /dev/null +++ b/lisp/acdw-setup.el | |||
@@ -0,0 +1,71 @@ | |||
1 | ;;; acdw-setup.el -- my `setup' commands -*- lexical-binding: t -*- | ||
2 | |||
3 | ;; Author: Case Duckworth <acdw@acdw.net> | ||
4 | |||
5 | ;; This file is NOT part of GNU Emacs. | ||
6 | |||
7 | ;;; License: | ||
8 | ;; Everyone is permitted to do whatever with this software, without | ||
9 | ;; limitation. This software comes without any warranty whatsoever, | ||
10 | ;; but with two pieces of advice: | ||
11 | ;; - Don't hurt yourself. | ||
12 | ;; - Make good choices. | ||
13 | |||
14 | ;;; Code: | ||
15 | |||
16 | (setup-define :autoload | ||
17 | (lambda (func) | ||
18 | (if (listp func) | ||
19 | (let ((plist (cdr func))) | ||
20 | `(autoload ',(car func) | ||
21 | ,(symbol-name (setup-get 'feature)) | ||
22 | ,(plist-get plist :docstring) | ||
23 | ,(plist-get plist :interactive) | ||
24 | ,(plist-get plist :type))) | ||
25 | `(autoload ',func ,(symbol-name (setup-get 'feature))))) | ||
26 | :documentation "Autoload FUNC from FEATURE. | ||
27 | `:autoload' can be passed a list with keywords: | ||
28 | :docstring - The DOCSTRING to give the autoloaded function. | ||
29 | :interactive - Whether the function is INTERACTIVE or not. | ||
30 | :type - Either `nil', `keymap', or `macro': see `autoload' for details." | ||
31 | :repeatable t) | ||
32 | |||
33 | (setup-define :file-match | ||
34 | ;; Hotfix; patch here: https://github.com/phikal/setup.el/pull/1 | ||
35 | (lambda (pat) | ||
36 | `(add-to-list 'auto-mode-alist (cons ,pat ',(setup-get 'mode)))) | ||
37 | :documentation "Associate the current mode with files that match PAT." | ||
38 | :debug '(form) | ||
39 | :repeatable t) | ||
40 | |||
41 | (setup-define :straight | ||
42 | (lambda (recipe) | ||
43 | `(straight-use-package ',recipe)) | ||
44 | :documentation | ||
45 | "Install RECIPE with `straight-use-package'. | ||
46 | This macro can be used as HEAD, and will replace itself with the | ||
47 | first RECIPE's package." | ||
48 | :repeatable t | ||
49 | :shorthand (lambda (sexp) | ||
50 | (let ((recipe (cadr sexp))) | ||
51 | (if (consp recipe) | ||
52 | (car recipe) | ||
53 | recipe)))) | ||
54 | |||
55 | (setup-define :straight-if | ||
56 | (lambda (recipe condition) | ||
57 | `(if ,condition | ||
58 | (straight-use-package ',recipe) | ||
59 | ,(setup-quit))) | ||
60 | :documentation | ||
61 | "Install RECIPE with `straight-use-package' when CONDITION is met. | ||
62 | If CONDITION is false, stop evaluating the body. This macro can | ||
63 | be used as HEAD, and will replace itself with the RECIPE's | ||
64 | package. This macro is not repeatable." | ||
65 | :repeatable nil | ||
66 | :shorthand (lambda (sexp) | ||
67 | (let ((recipe (cadr sexp))) | ||
68 | (if (consp recipe) (car recipe) recipe)))) | ||
69 | |||
70 | (provide 'acdw-setup) | ||
71 | ;;; acdw-setup.el ends here | ||