about summary refs log tree commit diff stats
path: root/lisp/acdw-setup.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/acdw-setup.el')
-rw-r--r--lisp/acdw-setup.el103
1 files changed, 0 insertions, 103 deletions
diff --git a/lisp/acdw-setup.el b/lisp/acdw-setup.el deleted file mode 100644 index 33ab835..0000000 --- a/lisp/acdw-setup.el +++ /dev/null
@@ -1,103 +0,0 @@
1;;; acdw-setup.el -- my `setup' commands -*- lexical-binding: t -*-
2
3;; Author: Case Duckworth <(rot13-string "npqj@npqj.arg")>
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;;; Commentary:
15
16;; setup.el makes defining local macros for `setup' forms quite simple, at
17;; least to my mind. Here are some of the ones I've defined.
18
19;;; Code:
20
21(require 'setup)
22
23(setup-define :autoload
24 (lambda (func)
25 (if (listp func)
26 (let ((plist (cdr func)))
27 `(autoload ',(car func)
28 ,(symbol-name (setup-get 'feature))
29 ,(plist-get plist :docstring)
30 ,(plist-get plist :interactive)
31 ,(plist-get plist :type)))
32 `(autoload ',func ,(symbol-name (setup-get 'feature)))))
33 :documentation "Autoload FUNC from FEATURE.
34`:autoload' can be passed a list with keywords:
35:docstring - The DOCSTRING to give the autoloaded function.
36:interactive - Whether the function is INTERACTIVE or not.
37:type - Either `nil', `keymap', or `macro': see `autoload' for details."
38 :repeatable t)
39
40(setup-define :require-after
41 (lambda (seconds)
42 `(run-with-idle-timer ,seconds nil
43 #'require ',(setup-get 'feature) nil t))
44 :documentation "Requre FEATURE, after SECONDS idle time.")
45
46(setup-define :face
47 (lambda (face spec)
48 `(custom-set-faces '(,face ,spec 'now "Customized by `setup'.")))
49 :documentation "Customize FACE with SPEC using `custom-set-faces'."
50 :repeatable t)
51
52(setup-define :file-match
53 ;; Hotfix; patch here: https://github.com/phikal/setup.el/pull/1
54 (lambda (pat)
55 `(add-to-list 'auto-mode-alist (cons ,pat ',(setup-get 'mode))))
56 :documentation "Associate the current mode with files that match PAT."
57 :debug '(form)
58 :repeatable t)
59
60(setup-define :straight
61 (lambda (recipe)
62 `(unless (straight-use-package ',recipe)
63 ,(setup-quit)))
64 :documentation
65 "Install RECIPE with `straight-use-package'.
66This macro can be used as HEAD, and will replace itself with the
67first RECIPE's package."
68 :repeatable t
69 :shorthand (lambda (sexp)
70 (let ((recipe (cadr sexp)))
71 (if (consp recipe)
72 (car recipe)
73 recipe))))
74
75(setup-define :straight-when
76 (lambda (recipe condition)
77 `(if ,condition
78 (straight-use-package ',recipe)
79 ,(setup-quit)))
80 :documentation
81 "Install RECIPE with `straight-use-package' when CONDITION is met.
82If CONDITION is false, stop evaluating the body. This macro can
83be used as HEAD, and will replace itself with the RECIPE's
84package. This macro is not repeatable."
85 :repeatable nil
86 :indent 1
87 :shorthand (lambda (sexp)
88 (let ((recipe (cadr sexp)))
89 (if (consp recipe) (car recipe) recipe))))
90
91;; https://www.emacswiki.org/emacs/SetupEl
92(setup-define :load-after
93 (lambda (&rest features)
94 (let ((body `(require ',(setup-get 'feature))))
95 (dolist (feature (if (listp features)
96 (nreverse features)
97 (list features)))
98 (setq body `(with-eval-after-load ',feature ,body)))
99 body))
100 :documentation "Load the current feature after FEATURES.")
101
102(provide 'acdw-setup)
103;;; acdw-setup.el ends here