guidoschmidt / circadian.el

Theme-switching for Emacs based on daytime
https://guidoschmidt.github.io/circadian.el
MIT License
169 stars 8 forks source link

FIX: fix infinite recursion in circadian.el #34

Closed LemonBreezes closed 2 months ago

LemonBreezes commented 2 months ago

I am not sure why this is happening, but it seems removing the extraneous cl-second call fixes the issue.

guidoschmidt commented 2 months ago

@LemonBreezes hey thanks, definitively helped to push me in the right direction 🙏🏽

Ok, I think I understand the issue now. It's a combination of things:

  1. I was using the '() syntax to define inner list of themes here in circadian-themes: README.md. Turns out you don't need the quote for inner lists:

    Correct:

    (nth 0 (nth 1 '(1 (:a :b)))) ;; which yields ':a'

    ⚠️ Incorrect

    (nth 0 (nth 1 '(1 '(:a :b)))) ;; which yields 'quote'

    🤦🏽 My elisp is a bit rusty I have to admit

  2. The whole code needed some cleanup, there was circadian-enable-theme, circadian-setup, circadian-activate-current 😕. Before circadian.el was creating timers for all themes in the list, now it will only creates a single timer and re-schedule the next theme-switch after that timer ran.

I'm going to push my latest changes to develop and do some more testing in the upcoming days.

If you're keen to test this a bit, too, you could use the :branch keyword with straight:

(straight-use-package 'circadian :branch develop)

thanks already