guidoschmidt / circadian.el

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

Theme not fully loaded on switch #9

Open basille opened 6 years ago

basille commented 6 years ago

Thanks for this great package! And for the theme suggestions, I love them!

I'm using a very similar setup as the one from the README:

  (setq calendar-latitude 26.084534)
  (setq calendar-longitude -80.238454)
  (setq circadian-themes '((:sunrise . apropospriate-light)
                           (:sunset  . nord)))
  (circadian-setup)

The switch as sunrise/sunset does occur, but leaves me with a theme not fully loaded. Here is a screenshot of a session using Polymode on a RMarkdown file (so essentially mixing Markdown and ESS mode), after a sunset switch to Nord theme:

screenshot from 2017-12-01 17-29-06

Simply closing and restarting Emacs shows what I should have:

screenshot from 2017-12-01 17-33-33

What's missing is the correct background in the ESS chunk. Not too sure where to starts from here…

guidoschmidt commented 6 years ago

Hey basille,

glad you like the package 👍 And thanks a lot for reporting that bug - I had issues like this before, too. I thought the last update would have fixed it.

Which Emacs version and which package-version of circadian are you using, so I can try to work out what's going on.

basille commented 6 years ago

Sorry I should have started with this:

basille commented 6 years ago

I also have problems in the morning when switching back to `apropospriate-light, now in the mode line. Here is what I have after automatic switching:

screenshot from 2017-12-08 08-51-46

Here is how it should be:

screenshot from 2017-12-08 08-54-05

Notice the vertical black bars which are not part of the theme.

guidoschmidt commented 6 years ago

Thanks for the information - I will try to check on the issue as soon as possible 🙂

guidoschmidt commented 6 years ago

@basille How do you install the themes, that you want to be loaded by circadian? I could reproduce the behaviour, you are experiencing only when installing themes with use-package. If you install them via use-package, too, try to add the :defer keyword - that solved the issue for me.

;; Try to add `:defer` keyword, if you're using use-package
(use-package apropospriate-theme :ensure :defer)
(use-package nord-theme :ensure :defer)

(use-package circadian
  :ensure
  :init
  :config
  (setq calendar-latitude 26.084534)
  (setq calendar-longitude -80.238454)
  (setq circadian-themes '((:sunrise . apropospriate-light)
                                           (:sunset  . nord)))
  (circadian-setup))

Let me know, if that solved your issue, too - otherwise I'll need to have a deeper look on what is going on in detail 🕵️

basille commented 6 years ago

Thanks @guidoschmidt to look into it. As a matter of fact, I do not use use-package, but a custom init.org file that installs additional packages with package-install <whatever_package>. I'm not too familiar with use-package though — what does :defer do? Should I load the themes with something special? My setup regarding themes is really this only snippet from my initial post.

guidoschmidt commented 6 years ago

@basille Do you still have this issue? I just recently found out, that Emacs is loading a theme by default, when you do (require 'nord-theme) e.g (Didn't run into that issue, as I was using use-package from the very beginning - :defer just auto-loads the package lazily when it's need). Maybe you have some lines that require a theme in your init.org after (circadian-setup) has been called? 🤔

Additionally, did you check your timezone configuration, maybe circadian has issues fetching the correct sunrise/sunset time?

basille commented 6 years ago

@guidoschmidt , thanks for your follow-up! As a matter of fact, I still have the same problem, and I regularly close and reopen Emacs when theme switches… You can find my complete .emacs here, but essentially, theme configuration is pretty much the first thing that happens… and coordinates are configured through calendar-latitude and calendar-longitude as shown in my initial post.

guidoschmidt commented 6 years ago

@basille I just recently found some time to check your config - sorry for the long time period 😦

I cloned your .emacs.d and tried the recent version of circadian (0.3.2 - published yesterday) which worked fine so far. It turned out, that the nord-theme seems to be setting a bunch of custom-face-attributes, that are not part of default themeing. You could try to reset the custom-face-attributes using a hook:

(setq circadian-themes '((:sunrise . apropospriate-light) 
                         (:sunset . nord)))

;; This resets the custom-face-attributes list and will hopefully clear all customizations
;; that the nord-theme has set.
(add-hook 'circadian-before-load-theme-hook
          #'(lambda (theme)
              (setq custom-face-attributes '())))

(circadian-setup)

Could you try if that resolves your issue? 🤔 Another solution would be to rely on another theme instead of nord

basille commented 6 years ago

@guidoschmidt, I have modified my setup in the meanwhile: the mode-line was actually using powerline, which I removed entirely due to various issues (mostly readability, but also this issue), and I need to do more testing about it. Unfortunately, themes only switch twice a day, and I don't necessarily have Emacs open at this moment! I'll definitely report back (and try the trick you just posted if need be). Thanks!

basille commented 6 years ago

Hi @guidoschmidt, I tried the additional setup you suggested, but I still have the original issue (at the beginning of this thread), i.e. R chunks in Polymode not switching to the new mode together with the rest of the interface.

guidoschmidt commented 1 year ago

@basille did this issue resolve somehow? Looks like in your .emacs.d repository, you are using circadian? Is it working as expected, because still I can't really reproduce how that behaviour 🙈

basille commented 1 year ago

Thanks @guidoschmidt for checking in, and sorry for the late answer! Unfortunately, I still have the same issues when switching to Nord theme — it may just have to do with this theme, to be honest I did not try other themes, and kind of got used to closing and restarting Emacs altogether… 🤦‍♂️

Would you like me to check with another night theme? (any suggestion for a good one?)

guidoschmidt commented 1 year ago

All fine - I haven't worked on circadian for quite a while myself. I'm using doom-themes a lot, you could try with doom-nord e.g. hopefully it's really a specific issue with the theme and this helps

basille commented 1 year ago

Thanks for the suggestion. Nice themes! So I quickly played around using both doom-one and doom-one-light and unfortunately, same thing always happens: Whenever there's a switch, embedded R code blocks keep the previous one until they're edited. It seems to me that there's a conflict between the way circadian switches themes, and how polymode deals with embedded chunks. Do you think it might be worth asking there too?

basille commented 1 year ago

I just played around with another extension (Auto-Dark for Emacs), which shows the exact same problem on switching. Seems to reinforce the idea that the bug might actually be on the polymode side. Let me try there.

guidoschmidt commented 3 months ago

@basille sorry this is not working for you for such a long time now. You could try a fresh Emacs config with almost nothing but your desired themes and circadian.el installed, to see if the issue still remains?