I am trying to automatically change my Emacs theme according to time set (Thanks to answer provided by Dan).
My code looks like this:
(setq emacs-curr-theme nil) (setq emacs-light-theme 'faff) (setq emacs-dark-theme 'atom-one-dark) (defun emacs-synchronize-theme () (let ((hour nil) (now nil)) (progn (setq hour (string-to-number (substring (current-time-string) 11 13))) (if (member hour (number-sequence 7 13)) (setq now emacs-light-theme) (setq now emacs-dark-theme)) (if (equal now emacs-curr-theme now) nil (progn (setq emacs-curr-theme now) (load-theme emacs-curr-theme t)))))) (defun emacs-set-theme () ;; Load theme only when using GUI (when (display-graphic-p) (run-with-timer 0 900 'emacs-synchronize-theme)))
When I am calling the function
emacs-set-theme from my
init.el, I am getting this error -
Error running timer 'emacs-synchronize-theme': (wrong-number-of-arguments equal 3)
I have no clue what I am doing wrong here. I have checked documentation for
run-with-timer, but unable to figure out the problem by myself.