From: joakim@verona.se
To: emacs-devel@gnu.org
Subject: custom + theme recursion
Date: Fri, 04 Nov 2011 12:24:20 +0100 [thread overview]
Message-ID: <m3obws166z.fsf@chopper.vpn.verona.se> (raw)
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?
Here is the relevant snippets from zen-mode.el
(defcustom zen-state 0
"Current zen state. 0 means no zen. other states correspond to a theme."
:group 'zen-mode
:set 'zen-set-state)
(defun zen-set-state (name new-state)
"Which zen NEW-STATE to enter."
(interactive (list "zen-state" (read-number "zen:")))
(if (> 0 new-state) (setq new-state 0))
(if (>= new-state 3) (setq new-state 3));;TODO
;; 0 means a wordly state.
;;other states are themes
(if zen-state (disable-theme (zen-state-theme zen-state)))
;; (if new-state (enable-theme (zen-state-theme new-state)))
;;enable-theme doesnt work in the way I expected
;; this works. somewhat.
(if (> new-state 0)
(custom-set-variables (list 'custom-enabled-themes
(list 'quote (append (list (zen-state-theme new-state)) custom-enabled-themes )) nil)
))
(setq zen-state new-state)
(message "Now entering Zen %d" zen-state)
)
--
Joakim Verona
next reply other threads:[~2011-11-04 11:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-04 11:24 joakim [this message]
2011-11-22 5:59 ` custom + theme recursion Chong Yidong
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=m3obws166z.fsf@chopper.vpn.verona.se \
--to=joakim@verona.se \
--cc=emacs-devel@gnu.org \
/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).