diff options
author | Case Duckworth | 2021-03-25 12:03:59 -0500 |
---|---|---|
committer | Case Duckworth | 2021-03-25 12:03:59 -0500 |
commit | 870d1595e4137b84481df678cf41871dfde1fbbd (patch) | |
tree | 41fcc488f3a420df018e3ab966571f264ea5813b /lisp | |
parent | Add `god-mode' (diff) | |
download | emacs-870d1595e4137b84481df678cf41871dfde1fbbd.tar.gz emacs-870d1595e4137b84481df678cf41871dfde1fbbd.zip |
White space
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw.el | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 4493275..bd6c02a 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -37,20 +37,20 @@ Ready for use with `after-focus-change-function'." | |||
37 | (defun acdw/sunrise-sunset (sunrise-command sunset-command) | 37 | (defun acdw/sunrise-sunset (sunrise-command sunset-command) |
38 | "Run commands at sunrise and sunset." | 38 | "Run commands at sunrise and sunset." |
39 | (let* ((times-regex (rx (* nonl) | 39 | (let* ((times-regex (rx (* nonl) |
40 | (: (any ?s ?S) "unrise") " " | 40 | (: (any ?s ?S) "unrise") " " |
41 | (group (repeat 1 2 digit) ":" | 41 | (group (repeat 1 2 digit) ":" |
42 | (repeat 1 2 digit) | 42 | (repeat 1 2 digit) |
43 | (: (any ?a ?A ?p ?P) (any ?m ?M))) | 43 | (: (any ?a ?A ?p ?P) (any ?m ?M))) |
44 | (* nonl) | 44 | (* nonl) |
45 | (: (any ?s ?S) "unset") " " | 45 | (: (any ?s ?S) "unset") " " |
46 | (group (repeat 1 2 digit) ":" | 46 | (group (repeat 1 2 digit) ":" |
47 | (repeat 1 2 digit) | 47 | (repeat 1 2 digit) |
48 | (: (any ?a ?A ?p ?P) (any ?m ?M))) | 48 | (: (any ?a ?A ?p ?P) (any ?m ?M))) |
49 | (* nonl))) | 49 | (* nonl))) |
50 | (ss (sunrise-sunset)) | 50 | (ss (sunrise-sunset)) |
51 | (_m (string-match times-regex ss)) | 51 | (_m (string-match times-regex ss)) |
52 | (sunrise-time (match-string 1 ss)) | 52 | (sunrise-time (match-string 1 ss)) |
53 | (sunset-time (match-string 2 ss))) | 53 | (sunset-time (match-string 2 ss))) |
54 | (run-at-time sunrise-time (* 60 60 24) sunrise-command) | 54 | (run-at-time sunrise-time (* 60 60 24) sunrise-command) |
55 | (run-at-time sunset-time (* 60 60 24) sunset-command) | 55 | (run-at-time sunset-time (* 60 60 24) sunset-command) |
56 | (run-at-time "12:00am" (* 60 60 24) sunset-command))) | 56 | (run-at-time "12:00am" (* 60 60 24) sunset-command))) |
@@ -58,15 +58,15 @@ Ready for use with `after-focus-change-function'." | |||
58 | ;;; Directories (think `no-littering') | 58 | ;;; Directories (think `no-littering') |
59 | 59 | ||
60 | (defvar acdw/dir (expand-file-name | 60 | (defvar acdw/dir (expand-file-name |
61 | (convert-standard-filename "var/") | 61 | (convert-standard-filename "var/") |
62 | user-emacs-directory) | 62 | user-emacs-directory) |
63 | "A directory to hold extra configuration and emacs data.") | 63 | "A directory to hold extra configuration and emacs data.") |
64 | 64 | ||
65 | (defun acdw/in-dir (file &optional make-directory) | 65 | (defun acdw/in-dir (file &optional make-directory) |
66 | "Expand FILE relative to `acdw/dir', optionally creating its | 66 | "Expand FILE relative to `acdw/dir', optionally creating its |
67 | directory." | 67 | directory." |
68 | (let ((f (expand-file-name (convert-standard-filename file) | 68 | (let ((f (expand-file-name (convert-standard-filename file) |
69 | acdw/dir))) | 69 | acdw/dir))) |
70 | (when make-directory | 70 | (when make-directory |
71 | (make-directory (file-name-directory f) 'parents)) | 71 | (make-directory (file-name-directory f) 'parents)) |
72 | f)) | 72 | f)) |
@@ -81,11 +81,11 @@ ASSIGNMENTS is a list where each element is of the form | |||
81 | (let (setting) ; for return value | 81 | (let (setting) ; for return value |
82 | (dolist (assignment assignments setting) | 82 | (dolist (assignment assignments setting) |
83 | (customize-set-variable (car assignment) | 83 | (customize-set-variable (car assignment) |
84 | (cadr assignment) | 84 | (cadr assignment) |
85 | (if (and (caddr assignment) | 85 | (if (and (caddr assignment) |
86 | (stringp (caddr assignment))) | 86 | (stringp (caddr assignment))) |
87 | (caddr assignment) | 87 | (caddr assignment) |
88 | "Customized by `acdw/set'.")) | 88 | "Customized by `acdw/set'.")) |
89 | (setq setting (car assignment))))) | 89 | (setq setting (car assignment))))) |
90 | 90 | ||
91 | ;;; Faces | 91 | ;;; Faces |
@@ -118,19 +118,19 @@ ARGS accept the following keywords: | |||
118 | 118 | ||
119 | :after FEATURE .. `autoload' all functions after FEATURE." | 119 | :after FEATURE .. `autoload' all functions after FEATURE." |
120 | (let ((after (plist-get args :after)) | 120 | (let ((after (plist-get args :after)) |
121 | (command-list)) | 121 | (command-list)) |
122 | (dolist (spec hook-specs) | 122 | (dolist (spec hook-specs) |
123 | (let* ((hooks (car spec)) | 123 | (let* ((hooks (car spec)) |
124 | (funcs (cadr spec)) | 124 | (funcs (cadr spec)) |
125 | (depth (or (caddr spec) 0)) | 125 | (depth (or (caddr spec) 0)) |
126 | (local (cadddr spec))) | 126 | (local (cadddr spec))) |
127 | (when (not (listp hooks)) (setq hooks (list hooks))) | 127 | (when (not (listp hooks)) (setq hooks (list hooks))) |
128 | (when (not (listp funcs)) (setq funcs (list funcs))) | 128 | (when (not (listp funcs)) (setq funcs (list funcs))) |
129 | (dolist (hook hooks) | 129 | (dolist (hook hooks) |
130 | (dolist (func funcs) | 130 | (dolist (func funcs) |
131 | (push `(add-hook ',hook #',func ,depth ,local) command-list) | 131 | (push `(add-hook ',hook #',func ,depth ,local) command-list) |
132 | (when after | 132 | (when after |
133 | (push `(autoload #',func ,after) command-list)))))) | 133 | (push `(autoload #',func ,after) command-list)))))) |
134 | `(progn | 134 | `(progn |
135 | ,@command-list))) | 135 | ,@command-list))) |
136 | 136 | ||
@@ -161,25 +161,25 @@ The following keywords are recognized: | |||
161 | defined in a different file than the command it binds (looking | 161 | defined in a different file than the command it binds (looking |
162 | at you, `org-mode')." | 162 | at you, `org-mode')." |
163 | (let ((after (when-let (sym (plist-get args :after)) | 163 | (let ((after (when-let (sym (plist-get args :after)) |
164 | (if (not (listp sym)) | 164 | (if (not (listp sym)) |
165 | (list sym) | 165 | (list sym) |
166 | sym))) | 166 | sym))) |
167 | (map-after (plist-get args :map-after)) | 167 | (map-after (plist-get args :map-after)) |
168 | (keymap (or (plist-get args :map) acdw/bind-default-map)) | 168 | (keymap (or (plist-get args :map) acdw/bind-default-map)) |
169 | (keycode (if (vectorp key) key (kbd key))) | 169 | (keycode (if (vectorp key) key (kbd key))) |
170 | (command-list)) | 170 | (command-list)) |
171 | (let ((define-key-command `(define-key ,keymap ,keycode ',command))) | 171 | (let ((define-key-command `(define-key ,keymap ,keycode ',command))) |
172 | (if map-after | 172 | (if map-after |
173 | (push `(with-eval-after-load ,map-after | 173 | (push `(with-eval-after-load ,map-after |
174 | ,define-key-command) | 174 | ,define-key-command) |
175 | command-list) | 175 | command-list) |
176 | (push define-key-command command-list))) | 176 | (push define-key-command command-list))) |
177 | (when after | 177 | (when after |
178 | (unless (fboundp command) | 178 | (unless (fboundp command) |
179 | (push `(autoload ',command ,@after) command-list)) | 179 | (push `(autoload ',command ,@after) command-list)) |
180 | (unless (or map-after | 180 | (unless (or map-after |
181 | (eq keymap acdw/bind-default-map)) | 181 | (eq keymap acdw/bind-default-map)) |
182 | (push `(autoload ',keymap ,(car after) nil nil 'keymap) command-list))) | 182 | (push `(autoload ',keymap ,(car after) nil nil 'keymap) command-list))) |
183 | `(progn | 183 | `(progn |
184 | ,@command-list))) | 184 | ,@command-list))) |
185 | 185 | ||
@@ -197,9 +197,9 @@ The following keywords are recognized: | |||
197 | KEYMAP can be nil." | 197 | KEYMAP can be nil." |
198 | (declare (indent 2)) | 198 | (declare (indent 2)) |
199 | (let ((bind-list) | 199 | (let ((bind-list) |
200 | (extra-args (if keymap | 200 | (extra-args (if keymap |
201 | `(:after ,file :map ,keymap) | 201 | `(:after ,file :map ,keymap) |
202 | `(:after ,file)))) | 202 | `(:after ,file)))) |
203 | (dolist (binding bindings) | 203 | (dolist (binding bindings) |
204 | (push `(acdw/bind ,@binding ,@extra-args) bind-list)) | 204 | (push `(acdw/bind ,@binding ,@extra-args) bind-list)) |
205 | `(progn | 205 | `(progn |
@@ -213,34 +213,34 @@ KEYMAP can be nil." | |||
213 | ARGS can include the following keywords: | 213 | ARGS can include the following keywords: |
214 | 214 | ||
215 | :local BOOL .. if BOOL is non-nil, don't run `straight-use-package' on | 215 | :local BOOL .. if BOOL is non-nil, don't run `straight-use-package' on |
216 | PACKAGE. Good for using `acdw/pkg' on local features. | 216 | PACKAGE. Good for using `acdw/pkg' on local features. |
217 | :require BOOL .. if BOOL is non-nil, run `require' on PACKAGE before anything. | 217 | :require BOOL .. if BOOL is non-nil, run `require' on PACKAGE before anything. |
218 | :now FORMS .. run FORMS immediately. | 218 | :now FORMS .. run FORMS immediately. |
219 | :then FORMS .. run FORMS after loading PACKAGE, using `with-eval-after-load'. | 219 | :then FORMS .. run FORMS after loading PACKAGE, using `with-eval-after-load'. |
220 | :set SETTINGS .. pass SETTINGS to `acdw/set', right after `:now' forms. | 220 | :set SETTINGS .. pass SETTINGS to `acdw/set', right after `:now' forms. |
221 | SETTINGS should be properly quoted, just like they'd be passed | 221 | SETTINGS should be properly quoted, just like they'd be passed |
222 | to the function. | 222 | to the function. |
223 | :binds BINDS .. run `acdw/bind-after-map' on BINDS. | 223 | :binds BINDS .. run `acdw/bind-after-map' on BINDS. |
224 | :hooks HOOKS .. run `acdw/hooks' on HOOKS." | 224 | :hooks HOOKS .. run `acdw/hooks' on HOOKS." |
225 | (declare (indent 1)) | 225 | (declare (indent 1)) |
226 | (let ((local-pkg (plist-get args :local)) | 226 | (let ((local-pkg (plist-get args :local)) |
227 | (require-pkg (plist-get args :require)) | 227 | (require-pkg (plist-get args :require)) |
228 | (now-forms (plist-get args :now)) | 228 | (now-forms (plist-get args :now)) |
229 | (settings (plist-get args :set)) | 229 | (settings (plist-get args :set)) |
230 | (binds (plist-get args :binds)) | 230 | (binds (plist-get args :binds)) |
231 | (hooks (plist-get args :hooks)) | 231 | (hooks (plist-get args :hooks)) |
232 | (then-forms (plist-get args :then)) | 232 | (then-forms (plist-get args :then)) |
233 | (requirement (if (listp package) | 233 | (requirement (if (listp package) |
234 | (car package) | 234 | (car package) |
235 | package)) | 235 | package)) |
236 | (final-form)) | 236 | (final-form)) |
237 | (when then-forms | 237 | (when then-forms |
238 | (push `(with-eval-after-load ',requirement ,@then-forms) final-form)) | 238 | (push `(with-eval-after-load ',requirement ,@then-forms) final-form)) |
239 | (when hooks | 239 | (when hooks |
240 | (push `(acdw/hooks ,hooks :after ,(symbol-name requirement)) final-form)) | 240 | (push `(acdw/hooks ,hooks :after ,(symbol-name requirement)) final-form)) |
241 | (when binds | 241 | (when binds |
242 | (push `(acdw/bind-after-map ,(symbol-name requirement) nil ,binds) | 242 | (push `(acdw/bind-after-map ,(symbol-name requirement) nil ,binds) |
243 | final-form)) | 243 | final-form)) |
244 | (when settings | 244 | (when settings |
245 | (push `(acdw/set ,settings) final-form)) | 245 | (push `(acdw/set ,settings) final-form)) |
246 | (when now-forms | 246 | (when now-forms |
@@ -273,7 +273,7 @@ ARGS can include the following keywords: | |||
273 | ;; Set up a leader key for `acdw/mode' | 273 | ;; Set up a leader key for `acdw/mode' |
274 | (defvar acdw/leader | 274 | (defvar acdw/leader |
275 | (let ((map (make-sparse-keymap)) | 275 | (let ((map (make-sparse-keymap)) |
276 | (c-z (global-key-binding "\C-z"))) | 276 | (c-z (global-key-binding "\C-z"))) |
277 | (define-key acdw/map "\C-z" map) | 277 | (define-key acdw/map "\C-z" map) |
278 | (define-key map "\C-z" c-z) | 278 | (define-key map "\C-z" c-z) |
279 | map)) | 279 | map)) |