all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Different emacs24 deftheme for emacsclient -t/-c frames
@ 2012-02-20 15:42 Maik Beckmann
  2012-02-20 19:22 ` suvayu ali
  2012-02-20 21:50 ` Maik Beckmann
  0 siblings, 2 replies; 3+ messages in thread
From: Maik Beckmann @ 2012-02-20 15:42 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Different emacs24 deftheme for emacsclient -t/-c frames
  2012-02-20 15:42 Different emacs24 deftheme for emacsclient -t/-c frames Maik Beckmann
@ 2012-02-20 19:22 ` suvayu ali
  2012-02-20 21:50 ` Maik Beckmann
  1 sibling, 0 replies; 3+ messages in thread
From: suvayu ali @ 2012-02-20 19:22 UTC (permalink / raw)
  To: Maik Beckmann; +Cc: help-gnu-emacs

On Mon, Feb 20, 2012 at 16:42, Maik Beckmann
<beckmann.maik@googlemail.com> wrote:
> 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?

What you are looking for is something similar to the
color-theme-is-global variable for vanilla Emacs 24. But I don't think
there is any. However I could be wrong, I had looked at this quite a
while back.

If you find something, I would be interested to know.

GL

-- 
Suvayu

Open source is the future. It sets us free.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Different emacs24 deftheme for emacsclient -t/-c frames
  2012-02-20 15:42 Different emacs24 deftheme for emacsclient -t/-c frames Maik Beckmann
  2012-02-20 19:22 ` suvayu ali
@ 2012-02-20 21:50 ` Maik Beckmann
  1 sibling, 0 replies; 3+ messages in thread
From: Maik Beckmann @ 2012-02-20 21:50 UTC (permalink / raw)
  To: help-gnu-emacs

I consider this thread closed, lets continue here:
 - http://lists.gnu.org/archive/html/help-gnu-emacs/2012-02/msg00227.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-20 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-20 15:42 Different emacs24 deftheme for emacsclient -t/-c frames Maik Beckmann
2012-02-20 19:22 ` suvayu ali
2012-02-20 21:50 ` Maik Beckmann

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.