syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.69k stars 4.9k forks source link

[develop] [visual] [low prio] `geolocation-enable-automatic-theme-changer`: theme colors only partially changed on automatic theme switch after `desktop-read` #14971

Closed stradicat closed 2 years ago

stradicat commented 3 years ago

Description :octocat:

Theme colors, when using geolocation-enable-automatic-theme-changer, are only partially changed on automatic theme switch between Emacs exit and re-opening, after desktop-read:

If I exit Emacs after sunset with the dark theme on, and then open Emacs again the next morning after dawn executing desktop-read, the saved desktop state will try to bring up the dark theme but the light theme will be enforced by the time of day. This garbles the theme colours on both light and dark themes.

This is a minor quirk/annoyance, but it's been present since the 0.100.xdays, and forces the user to hit SPC T n twice to force-cycle between light and dark themes for correct display. I'm not fluent in elisp, so I haven't been able to figure this out.

Reproduction guide :beetle:

Alternatively:

Observed behaviour: :eyes: :broken_heart: Theme colours are, for the most part, partially loaded after desktop-read, some background and text colours for UI elements belong to one theme whilst simultaneously other elements' colours belong to the opposite theme.

Expected behaviour: :heart: :smile: Emacs opens with the corresponding theme correctly applied to every UI element.

System Info :computer:

lebensterben commented 3 years ago

what if the logic of checking current time is executed whenever a new file is opened?

it has several benefits. First, you don't need to manually restart Emacs daemon. Second, I think it will avoid the conflict caused by the stored (ou dated) external state. Actually we don't need to store this state at all.

Instead we can store the last time the theme is switched due to day/night transition. So on opening of a new file, it promptly passes if the last switch is not long ago enough.

stradicat commented 3 years ago

Or somehow establishing the corresponding theme at init time, and not letting desktop-read manage the theme state.

lebensterben commented 3 years ago

not letting desktop-read manage the theme state

No, you should call desktop-read in the first place. If there's any config needs to be persistent, you should instead store them in your init file.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!