Change circadian to +sunrise-sunset

I think this'll be less buggy overall.
This commit is contained in:
Case Duckworth 2021-12-25 12:23:45 -06:00
parent 30cd6555bf
commit 1a1e26f23d
2 changed files with 37 additions and 12 deletions

15
init.el
View File

@ -257,10 +257,6 @@
(:face aw-mode-line-face ((t (:foreground "red"))))
(+ace-window-display-mode +1))
(setup (:straight acme-theme)
;; (load-theme 'acme t)
)
(setup (:straight anzu)
(:option anzu-cons-mode-line-p nil)
(:+key [remap query-replace] 'anzu-query-replace-regexp
@ -295,16 +291,10 @@
(:hook-into eshell-mode
comint-mode))
(setup (:straight circadian)
(:option circadian-themes '((:sunrise . modus-operandi)
(:sunset . modus-vivendi)))
(add-hook 'after-init-hook 'circadian-setup))
(setup (:straight circe)
(:require _circe
+circe)
(:also-load circe-chanop)
;;(autoload '+irc "+circe" "Connect to IRC." t)
;; Formatting options
(:option circe-format-action (format (format "%%%ds* {nick} {body}"
@ -386,7 +376,7 @@
(:option (append topsy-mode-functions)
'(circe-channel-mode . +circe-current-topic)))
(add-hook 'circadian-after-load-theme-hook 'circe-nick-color-reset)
(add-hook 'modus-themes-after-load-theme-hook 'circe-nick-color-reset)
(add-hook 'kill-emacs-hook '+circe-quit-all@kill-emacs))
(setup (:straight consult)
@ -662,7 +652,8 @@ See also `crux-reopen-as-root-mode'."
(require 'modus-themes (.etc "straight/build/modus-themes/modus-themes"))
(:option modus-themes-bold-constructs t
modus-themes-italic-constructs t
modus-themes-headings '((t . (background)))))
modus-themes-headings '((t . (background))))
(+sunrise-sunset 'modus-themes-load-operandi 'modus-themes-load-vivendi))
(setup (:straight mwim)
(:+key "C-a" #'mwim-beginning

View File

@ -42,5 +42,39 @@ the filesystem, unless INHIBIT-MKDIR is non-nil."
(make-directory (file-name-directory file-name) :parents))
file-name))))
(defun +suppress-messages (oldfn &rest args) ; from pkal
"Advice wrapper for suppressing `message'.
OLDFN is the wrapped function, that is passed the arguments
ARGS."
(let ((msg (current-message)))
(prog1
(let ((inhibit-message t))
(apply oldfn args))
(when msg
(message "%s" msg)))))
(defun +sunrise-sunset (sunrise-command sunset-command)
"Run SUNRISE-COMMAND at sunrise, and SUNSET-COMMAND at 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 (+suppress-messages #'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))))
(provide 'acdw)
;;; acdw.el ends here