all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
To: Tim Visher <tim.visher@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: conditional font faces
Date: Tue, 02 Mar 2010 03:51:29 +0100	[thread overview]
Message-ID: <4B8C7D31.6010302@gmail.com> (raw)
In-Reply-To: <c115fd3c1003011725kecfe501s1af469165d7595d2@mail.gmail.com>

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	other threads:[~2010-03-02  2:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-28  0:55 conditional font faces Suvayu Ali
2010-02-28  2:00 ` Tim Visher
2010-02-28 22:10   ` Suvayu Ali
2010-03-01  2:28     ` Tim Visher
2010-03-01 13:17       ` Suvayu Ali
2010-03-01  9:50 ` Thamer Mahmoud
2010-03-01 13:21   ` Suvayu Ali
2010-03-01 21:58   ` Suvayu Ali
2010-03-02  1:25     ` Tim Visher
2010-03-02  2:51       ` Suvayu Ali [this message]
2010-03-04 16:57 ` zwz
2010-03-04 20:50   ` Suvayu Ali
2010-03-05 16:02     ` zwz
2010-03-05 16:37       ` Suvayu Ali
2010-03-05 17:03         ` zwz
2010-03-05 20:33           ` Suvayu Ali
     [not found] <mailman.2015.1267318522.14305.help-gnu-emacs@gnu.org>
2010-02-28  5:30 ` Stefan Monnier
2010-02-28 22:11   ` Suvayu Ali

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B8C7D31.6010302@gmail.com \
    --to=fatkasuvayu+linux@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tim.visher@gmail.com \
    /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 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.