elisp - Emacs Auto Load Color Theme by Time -
can allow emacs automatically load theme ? or command @ customized time ? want m-x load-theme ret solarized-light
when @ office @ 9:00am , m-x laod-theme ret solarized-dark
when home , continued on emacs @ 8:00pm.
to expand on @anton kovalenko's answer, can current time using current-time-string elisp function , extracting current time of day in hours.
if want write total implementation, (warning, not debugged):
;; <color theme initialization code> (setq current-theme '(color-theme-solarized-light)) (defun synchronize-theme (setq hr (string-to-number (substring (current-time-string) 11 13))) ;;closes (setq hour... (if (member hr (number-sequence 6 17)) (setq '(color-theme-solarized-light)) (setq '(color-theme-solarized-dark))) ;; end of (if ... (if (eq current-theme) nil (setq current-theme now) (eval now) ) ) ;; end of (defun ... (run-with-timer 0 3600 synchronize-theme)
for more info on functions used, see next sections of emacs manual:
time of day strings string conversions idle timers contains number sequence emacs elisp
No comments:
Post a Comment