emacs-devel
[Top][All Lists]
Advanced

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

custom + theme recursion


From: joakim
Subject: custom + theme recursion
Date: Fri, 04 Nov 2011 12:24:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)

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



reply via email to

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