diff options
author | Case Duckworth | 2021-03-08 22:40:23 -0600 |
---|---|---|
committer | Case Duckworth | 2021-03-08 22:40:23 -0600 |
commit | 755cb7a95372c5c95719026ca6ed47ff071f94e8 (patch) | |
tree | 060c4c19a91d36e431c5742e69d356e3ea182a2d /lisp | |
parent | Finish up acdw/pkg (diff) | |
download | emacs-755cb7a95372c5c95719026ca6ed47ff071f94e8.tar.gz emacs-755cb7a95372c5c95719026ca6ed47ff071f94e8.zip |
uhhhhhhhh... stuff?
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw.el | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index f564777..2f0fe7d 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -30,6 +30,27 @@ Ready for use with `after-focus-change-function'." | |||
30 | (when (seq-every-p #'null (mapcar #'frame-focus-state (frame-list))) | 30 | (when (seq-every-p #'null (mapcar #'frame-focus-state (frame-list))) |
31 | (apply func args))) | 31 | (apply func args))) |
32 | 32 | ||
33 | (defun acdw/sunrise-sunset (sunrise-command sunset-command) | ||
34 | "Run commands at sunrise and sunset." | ||
35 | (let* ((times-regex (rx (* nonl) | ||
36 | (: (any ?s ?S) "unrise") " " | ||
37 | (group (repeat 1 2 digit) ":" | ||
38 | (repeat 1 2 digit) | ||
39 | (: (any ?a ?A ?p ?P) (any ?m ?M))) | ||
40 | (* nonl) | ||
41 | (: (any ?s ?S) "unset") " " | ||
42 | (group (repeat 1 2 digit) ":" | ||
43 | (repeat 1 2 digit) | ||
44 | (: (any ?a ?A ?p ?P) (any ?m ?M))) | ||
45 | (* nonl))) | ||
46 | (ss (sunrise-sunset)) | ||
47 | (_m (string-match times-regex ss)) | ||
48 | (sunrise-time (match-string 1 ss)) | ||
49 | (sunset-time (match-string 2 ss))) | ||
50 | (run-at-time sunrise-time (* 60 60 24) sunrise-command) | ||
51 | (run-at-time sunset-time (* 60 60 24) sunset-command) | ||
52 | (run-at-time "12:00am" (* 60 60 24) sunset-command))) | ||
53 | |||
33 | ;;; Directories (think `no-littering') | 54 | ;;; Directories (think `no-littering') |
34 | 55 | ||
35 | (defvar acdw/dir (expand-file-name | 56 | (defvar acdw/dir (expand-file-name |
@@ -43,7 +64,7 @@ directory." | |||
43 | (let ((f (expand-file-name (convert-standard-filename file) | 64 | (let ((f (expand-file-name (convert-standard-filename file) |
44 | acdw/dir))) | 65 | acdw/dir))) |
45 | (when make-directory | 66 | (when make-directory |
46 | (make-directory (file-name-directory file) 'parents)) | 67 | (make-directory (file-name-directory f) 'parents)) |
47 | f)) | 68 | f)) |
48 | 69 | ||
49 | ;;; Settings | 70 | ;;; Settings |