LionyxML / auto-dark-emacs

Auto-Dark-Emacs is an auto changer between 2 themes, dark/light, following MacOS, Linux or Windows Dark Mode settings
GNU General Public License v2.0
156 stars 35 forks source link

[FR] Fallback in case no detection mechanism could be determined #66

Open edgar-vincent opened 2 months ago

edgar-vincent commented 2 months ago

Hi!

Thanks for this excellent package. I recently used my usual Emacs configuration, which enables auto-dark, in a Docker container. Of course, auto-dark failed with this error: Could not determine a viable theme detection mechanism!, which is to be expected.

The problem is that this interfered with Emacs' initialisation process. Would it be possible to switch to a default fallback theme if auto-dark fails and skip the error?

If you're interested, I'd be happy to provide a PR. Actually, it could be an extension of https://github.com/LionyxML/auto-dark-emacs/pull/62/.

Thanks again!

EV

LionyxML commented 1 month ago

Thanks for reaching out @edgar-vincent.

Indeed it is a point of improvement, I'll keep this is mind. Auto-dark could 'not load' without breaking Emacs boot 😅

sellout commented 1 month ago

Rough thought is to

  1. replace (error …) with (lwarn 'auto-dark :error …),
  2. add something to the messages about having to manually set auto-dark-detection-method, then
  3. have unregister-/register-change-listener fire on changes to auto-dark-detection-method.

Right now the change listener is only registered when the mode is enabled, so step 3 makes it a little more ergonomic for users to post-hoc set the change listener.

I‘m happy to make these changes to #62.