unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@gnu.org>
To: joakim@verona.se
Cc: emacs-devel@gnu.org
Subject: Re: custom + theme recursion
Date: Tue, 22 Nov 2011 13:59:18 +0800	[thread overview]
Message-ID: <87r5104s09.fsf@gnu.org> (raw)
In-Reply-To: <m3obws166z.fsf@chopper.vpn.verona.se> (joakim@verona.se's message of "Fri, 04 Nov 2011 12:24:20 +0100")

joakim@verona.se 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))



      reply	other threads:[~2011-11-22  5:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-04 11:24 custom + theme recursion joakim
2011-11-22  5:59 ` Chong Yidong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r5104s09.fsf@gnu.org \
    --to=cyd@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joakim@verona.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).