From 755cb7a95372c5c95719026ca6ed47ff071f94e8 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 8 Mar 2021 22:40:23 -0600 Subject: uhhhhhhhh... stuff? --- init.el | 33 +++++++++++++++++++++++++++++++-- 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 @@ ;; ;;; Code: -;; Add `acdw.el' +;;; Add `acdw.el' (push (expand-file-name "lisp/" user-emacs-directory) load-path) - (require 'acdw) +;;; About me +(acdw/set + '((user-full-name "Case Duckworth") + (user-mail-address "acdw@acdw.net") + (calendar-location-name "Baton Rouge, LA") + (calendar-latitude 30.4) + (calendar-longitude -91.1) + (calendar-date-style iso))) + ;;; Good defaults ;; Lines @@ -86,6 +94,27 @@ (auto-save-list-file-prefix ,(acdw/in-dir "auto-save-list/.saves-" t)))) (auto-save-visited-mode +1) +;; Auto-revert +(when (require 'autorevert) + (global-auto-revert-mode +1)) +;; Save place +(when (require 'saveplace) + (acdw/set + `((save-place-file ,(acdw/in-dir "places")) + (save-place-forget-unreadable-files ,(eq acdw/system :home)))) + (save-place-mode +1)) +;; Recent files +(when (require 'recentf) + (acdw/set + `((recentf-save-file ,(acdw/in-dir "recentf")) + (recentf-max-menu-items 100) + (recentf-max-saved-items nil) + (recentf-auto-cleanup 10 "Cleanup the recentf list when idle for 10s.")) + (add-to-list 'recentf-exclude acdw/dir) + (recentf-mode +1))) + +;; Move the custom file +(acdw/set `((custom-file ,(acdw/in-dir "custom.el")))) ;; Cursor (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'." (when (seq-every-p #'null (mapcar #'frame-focus-state (frame-list))) (apply func args))) +(defun acdw/sunrise-sunset (sunrise-command sunset-command) + "Run commands at sunrise and sunset." + (let* ((times-regex (rx (* nonl) + (: (any ?s ?S) "unrise") " " + (group (repeat 1 2 digit) ":" + (repeat 1 2 digit) + (: (any ?a ?A ?p ?P) (any ?m ?M))) + (* nonl) + (: (any ?s ?S) "unset") " " + (group (repeat 1 2 digit) ":" + (repeat 1 2 digit) + (: (any ?a ?A ?p ?P) (any ?m ?M))) + (* nonl))) + (ss (sunrise-sunset)) + (_m (string-match times-regex ss)) + (sunrise-time (match-string 1 ss)) + (sunset-time (match-string 2 ss))) + (run-at-time sunrise-time (* 60 60 24) sunrise-command) + (run-at-time sunset-time (* 60 60 24) sunset-command) + (run-at-time "12:00am" (* 60 60 24) sunset-command))) + ;;; Directories (think `no-littering') (defvar acdw/dir (expand-file-name @@ -43,7 +64,7 @@ directory." (let ((f (expand-file-name (convert-standard-filename file) acdw/dir))) (when make-directory - (make-directory (file-name-directory file) 'parents)) + (make-directory (file-name-directory f) 'parents)) f)) ;;; Settings -- cgit 1.4.1-21-gabe81