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 | |
parent | Finish up acdw/pkg (diff) | |
download | emacs-755cb7a95372c5c95719026ca6ed47ff071f94e8.tar.gz emacs-755cb7a95372c5c95719026ca6ed47ff071f94e8.zip |
uhhhhhhhh... stuff?
-rw-r--r-- | init.el | 33 | ||||
-rw-r--r-- | lisp/acdw.el | 23 |
2 files changed, 53 insertions, 3 deletions
diff --git a/init.el b/init.el index 80a60da..19f6984 100644 --- a/init.el +++ b/init.el | |||
@@ -18,13 +18,21 @@ | |||
18 | ;; | 18 | ;; |
19 | ;;; Code: | 19 | ;;; Code: |
20 | 20 | ||
21 | ;; Add `acdw.el' | 21 | ;;; Add `acdw.el' |
22 | (push (expand-file-name "lisp/" | 22 | (push (expand-file-name "lisp/" |
23 | user-emacs-directory) | 23 | user-emacs-directory) |
24 | load-path) | 24 | load-path) |
25 | |||
26 | (require 'acdw) | 25 | (require 'acdw) |
27 | 26 | ||
27 | ;;; About me | ||
28 | (acdw/set | ||
29 | '((user-full-name "Case Duckworth") | ||
30 | (user-mail-address "acdw@acdw.net") | ||
31 | (calendar-location-name "Baton Rouge, LA") | ||
32 | (calendar-latitude 30.4) | ||
33 | (calendar-longitude -91.1) | ||
34 | (calendar-date-style iso))) | ||
35 | |||
28 | ;;; Good defaults | 36 | ;;; Good defaults |
29 | 37 | ||
30 | ;; Lines | 38 | ;; Lines |
@@ -86,6 +94,27 @@ | |||
86 | (auto-save-list-file-prefix | 94 | (auto-save-list-file-prefix |
87 | ,(acdw/in-dir "auto-save-list/.saves-" t)))) | 95 | ,(acdw/in-dir "auto-save-list/.saves-" t)))) |
88 | (auto-save-visited-mode +1) | 96 | (auto-save-visited-mode +1) |
97 | ;; Auto-revert | ||
98 | (when (require 'autorevert) | ||
99 | (global-auto-revert-mode +1)) | ||
100 | ;; Save place | ||
101 | (when (require 'saveplace) | ||
102 | (acdw/set | ||
103 | `((save-place-file ,(acdw/in-dir "places")) | ||
104 | (save-place-forget-unreadable-files ,(eq acdw/system :home)))) | ||
105 | (save-place-mode +1)) | ||
106 | ;; Recent files | ||
107 | (when (require 'recentf) | ||
108 | (acdw/set | ||
109 | `((recentf-save-file ,(acdw/in-dir "recentf")) | ||
110 | (recentf-max-menu-items 100) | ||
111 | (recentf-max-saved-items nil) | ||
112 | (recentf-auto-cleanup 10 "Cleanup the recentf list when idle for 10s.")) | ||
113 | (add-to-list 'recentf-exclude acdw/dir) | ||
114 | (recentf-mode +1))) | ||
115 | |||
116 | ;; Move the custom file | ||
117 | (acdw/set `((custom-file ,(acdw/in-dir "custom.el")))) | ||
89 | 118 | ||
90 | ;; Cursor | 119 | ;; Cursor |
91 | (acdw/set '((cursor-type bar) | 120 | (acdw/set '((cursor-type bar) |
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 |