help-gnu-emacs
[Top][All Lists]
Advanced

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

Different emacs24 deftheme for emacsclient -t/-c frames


From: Maik Beckmann
Subject: Different emacs24 deftheme for emacsclient -t/-c frames
Date: Mon, 20 Feb 2012 16:42:19 +0100
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Goj┼Ź) APEL/10.8 Emacs/24.0.93 (x86_64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Hello

I like to use a different theme depending on whether I connect to the running
server with a terminal frame
  % emacsclient -t
or with a gtk frame
  % emacsclient -c

The code I've used for color-theme.el looks like this

  (require 'color-theme)
  (setq color-theme-is-cumulative nil)
  (defun mb/pick-color-theme (frame)
    (select-frame frame)
    (let ((color-theme-is-global nil))
      (if (window-system frame)
         (color-theme-vim-colors)
       (color-theme-pok-wob))))
  
  (add-hook 'after-make-frame-functions 'mb/pick-color-theme)
  
  ;; For when started with emacs or emacs -nw rather than emacs --daemon
  (let ((color-theme-is-global nil))
    (color-theme-initialize)
    (if window-system
        (eval-after-load "color-theme"
       '(color-theme-vim-colors))
      (color-theme-pok-wob)))

Here the result
 - [http://i.imgur.com/2nD17.png]

My question: How does the code look like that does the same for emacs24
deftheme themes?

Here a try

  ;; last t is for NO-ENABLE
  (load-theme 'tango t t)
  (load-theme 'tango-dark t t)
  
  (defun mb/pick-color-theme (frame)
    (select-frame frame)
    (if (window-system frame)
        (progn  
          (disable-theme 'tango-dark) ; in case it was active
          (enable-theme 'tango))
      (progn  
        (disable-theme 'tango) ; in case it was active
        (enable-theme 'tango-dark))))
  (add-hook 'after-make-frame-functions 'mb/pick-color-theme)
  
  ;; For when started with emacs or emacs -nw rather than emacs --daemon
  (if window-system
      (enable-theme 'tango)
    (enable-theme 'tango-dark))

The result
 - [http://i.imgur.com/FocGA.png]
shows when happens if a terminal client is connected after a gtk frame client.
The exisiting gtk frame got affected by (enable-theme 'tango-dark).

Comparing the two code snippets brings up the question: Is there an equivalent
to color-theme-is-global for deftheme themes?  If not, how is the proper way of
doing it?

Thanks,
Maik



reply via email to

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