[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reloading themes in user option setters

From: Philip Kaludercic
Subject: Reloading themes in user option setters
Date: Fri, 25 Jun 2021 19:12:03 +0000


in a recent discussion on the modus-themes issue tracker[0], the concept
of reloading a user theme in the :set function of a user option was
debated. The plan is to add this to the next version, that might or
might not be part of the next Emacs release.

For those who don't know, modus-themes provides a number of user options
to change details, e.g. the usage of variable-pitch outside of buffers

About a month ago I wanted to make it easier to explore the space for
customization, by adding a custom setter to all applicable options, that
reload the current modus-theme, when the value is changed[1].  The idea
was to resemble the way that Emacs immediately changes faces when the
user changes something. The feature worked and it was merged.

In the aforementioned thread[0], we noticed that this can result in a
significant increase of the time needed to load the theme. It turns out
that the combination of customizing user options by adding them to the
"user" theme and using load-theme results in the theme being reloaded
for every user option.

One way to avoid this is to in the setter check if 
`custom--inhibit-theme-enable' is
set to nil[2], before reloading the themes. This works,
because enable-theme sets the value to nil. The issue here is that
custom--inhibit-theme-enable is designated to be an internal variable,
so we were not sure whether or not this is a good solution, considering
that this change might eventually be added to the core.

For that reason we would be interested in hearing opinions from the
readers of this list on the proposed solution or on the feature
itself. I am uncertain if the behaviour should or should not be
considered a bug, but even if that were to be the case, modus-themes
cannot rely on a bug fix in the next version because it still targets
older versions.

[0] https://gitlab.com/protesilaos/modus-themes/-/issues/213
[1] https://gitlab.com/protesilaos/modus-themes/-/merge_requests/38
[2] https://gitlab.com/protesilaos/modus-themes/-/issues/213#note_606022214

        Philip K.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]