summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tag-emacs/emacs.d/init.org31
1 files changed, 30 insertions, 1 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index af96248..4dcbe05 100644
--- a/tag-emacs/emacs.d/init.org
+++ b/tag-emacs/emacs.d/init.org
@@ -237,7 +237,8 @@ lot of modes.
 #+BEGIN_SRC emacs-lisp
   (req-package solarized-theme
     :config (progn
-              (load-theme 'solarized-light t)))
+              (load-theme 'solarized-light t t)
+              (load-theme 'solarized-dark t t)))
 #+END_SRC
 
 Colourise colour names in certain types of buffer.  I don’t use this
@@ -837,6 +838,34 @@ Sometimes I want to insert a date or time into a buffer.
     (insert (format-time-string format))))
 #+END_SRC
 
+** Time of Day
+
+#+BEGIN_SRC emacs-lisp
+  (req-package rase
+    :config (progn
+              (defun switch-themes (sun-event &optional first-run)
+                "Switch themes on sunrise and sunset."
+                (if first-run            ; set theme on initialization
+                    (cond ((memq sun-event '(sunrise midday))
+                           (disable-theme 'solarized-dark)
+                           (enable-theme 'solarized-light))
+                          ((memq sun-event '(sunset midnight))
+                           (disable-theme 'solarized-light)
+                           (enable-theme 'solarized-dark)))
+                  (cond ((eq sun-event 'sunrise) ; after initialization deal only
+                         (disable-theme 'solarized-dark) ; with sunrise and sunset
+                         (enable-theme 'solarized-light))
+                        ((eq sun-event 'sunset)
+                         (disable-theme 'solarized-light)
+                         (enable-theme 'solarized-dark)))))
+
+              ;; sign this function to be invoked on sun events
+              (add-hook 'rase-functions 'switch-themes)
+
+              ;; start the run-at-sun-event daemon, invoking hooks immediately
+              (rase-start t)))
+#+END_SRC
+
 * Directories
 
 Dired works quite nicely, but not always in the way I want.  I don’t