[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: custom + theme recursion
From: |
Chong Yidong |
Subject: |
Re: custom + theme recursion |
Date: |
Tue, 22 Nov 2011 13:59:18 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux) |
address@hidden writes:
> So, lets say I have a variable zen-state. when zen-state is set, I
> want to change custom-enabled-themes. I also want zen-state to be a
> customizable variable.
>
> For some reason this causes recursion. I don't think that is intuitive,
> because zen-state is supposed to be in the user-theme, which has the
> highest precedence of the themes, and the other themes should have no
> opinion of the value of zen-state.
>
> Anyway, how should I reason about themes and custom?
Sorry for the delay. Here, I think, is the problem: you have a custom
:set function that calls `enable-theme', and the code in `enable-theme'
calls `custom-theme-recalc-variable' to apply all variables in every
theme (to ensure that theme values are applied in the correct order).
Obviously, `custom-theme-recalc-variable' ends up calling the :set
function again, etc.
I'm not sure what's a good way to address this within Emacs itself, but
you can get around it in your own code by doing
(unless (custom-theme-enabled-p 'zen)
(enable-theme 'zen))