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

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

Re: conditional font faces


From: Suvayu Ali
Subject: Re: conditional font faces
Date: Tue, 02 Mar 2010 03:51:29 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.1

On 02/03/10 02:25 AM, Tim Visher wrote:
On Mon, Mar 1, 2010 at 4:58 PM, Suvayu Ali<fatkasuvayu+linux@gmail.com>  wrote:
Hi,

On 01/03/10 10:50 AM, Thamer Mahmoud wrote:

Suvayu Ali<fatkasuvayu+linux@gmail.com>   writes:

However, this won't work when using emacsclient -t. So if you run server
or daemon mode, use this instead:

(defun my-color-customizations-for-nw (frame)
   "Runs after creating new frames"
   (select-frame frame)
   (when (not window-system)
     (set-face-foreground 'minibuffer-prompt "black" frame)))
(add-hook 'after-make-frame-functions 'my-color-customizations-for-nw)

I have a small problem. If I start a no-window emacs in regular mode (as in
no server) then this doesn't take effect for the first frame. However the
change is as expected for any subsequent frame I create.

Even putting something like,

(my-color-customizations-for-nw (selected-frame))

doesn't help. Trying the same thing with

(when (window-system)
...)

doesn't have the same problem with a x-window (GUI) emacs.

Does anyone have any idea about this? Thanks in advance for any thoughts.

I believe you would need to put

     (my-color-customizations-for-nw (selected-frame))

As I mentioned in my previous post, I have tried that. If I start the server either from the terminal or the gui, all my customisations work wonderfully. If I start regular emacs (no server) from the gui, it again works. But when I try to start regular emacs (no server) from the terminal, the first frame takes the default colours even though all the other ones have the appropriate customisations.

The following is the relevant code from my ~/.emacs:

(defun windowed-stuff(frame)
  (select-frame frame)
  (when (window-system)
    (set-face-foreground 'minibuffer-prompt "medium blue" frame)
(add-hook 'after-make-frame-functions 'windowed-stuff)
(windowed-stuff (selected-frame))

(defun no-window-stuff(frame)
  (select-frame frame)
  (when (not window-system)
    (set-face-foreground 'minibuffer-prompt "green" frame)))
(add-hook 'after-make-frame-functions 'no-window-stuff)
(no-window-stuff (selected-frame))

I think for some reason either `(selected-frame)' doesn't return a frame the first time when emacs is started from the terminal or the '(not window-system)' check fails. I have no clue why either of those could be possible. If I don't get this to work I can always try to pick some default colour which works for both colour schemes I guess. :-\ Would be difficult though.

Thanks everyone for all the suggestions so far. All of them were very helpful. :)

--
Suvayu

Open source is the future. It sets us free.




reply via email to

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