From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Suvayu Ali Newsgroups: gmane.emacs.help Subject: Re: conditional font faces Date: Tue, 02 Mar 2010 03:51:29 +0100 Message-ID: <4B8C7D31.6010302@gmail.com> References: <4B89BF15.1070605@gmail.com> <874ol0l6aj.fsf@zemblan.newkuwait.org> <4B8C387E.7070205@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1267498350 22263 80.91.229.12 (2 Mar 2010 02:52:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 2 Mar 2010 02:52:30 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Tim Visher Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 02 03:52:26 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NmIDh-0003e5-FF for geh-help-gnu-emacs@m.gmane.org; Tue, 02 Mar 2010 03:52:25 +0100 Original-Received: from localhost ([127.0.0.1]:57480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmIDg-0001Cw-To for geh-help-gnu-emacs@m.gmane.org; Mon, 01 Mar 2010 21:52:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmIC7-0000Vb-Bb for help-gnu-emacs@gnu.org; Mon, 01 Mar 2010 21:50:47 -0500 Original-Received: from [140.186.70.92] (port=59675 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmIC6-0000Ty-9U for help-gnu-emacs@gnu.org; Mon, 01 Mar 2010 21:50:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NmIC5-0005d7-9I for help-gnu-emacs@gnu.org; Mon, 01 Mar 2010 21:50:46 -0500 Original-Received: from mail-bw0-f219.google.com ([209.85.218.219]:51349) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NmIC5-0005cv-4L for help-gnu-emacs@gnu.org; Mon, 01 Mar 2010 21:50:45 -0500 Original-Received: by bwz19 with SMTP id 19so2453374bwz.26 for ; Mon, 01 Mar 2010 18:50:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=T/e+n0dmMvrBXtkg6luoq4H4C7KO2xhXZuSb6a8UJLA=; b=S3wXugcD6SSuiTQ92ALzLLUyrGt4igOa097PEqzMgq5YtL3ledDByTz2Gu4q10Diwe 6yV8pdcOFXJmfynWkZCSMQLA219dN4tqeh1KJWRYYr6ooqfGg/oaC3EOuro1JX1t8KHV sW7rJcJKpq79C/vOipk8XW0y5388qkXJp91Kc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=ge7ZJKJc2Ed//XohSLHHpuLnq++0xR9u/8uZGvYiNnkAgIg461sEd70A/bHY9DJzT5 y4ZThzAC1/WKb8wFNeqa/0zKAcl9FIiXWiMP1Qmm/wwui7UJ0EbAfBtVOthWB4OJvrxw tQkK0DDu/DkkdQLzt0XtYv1de2NIY7E1k9iHA= Original-Received: by 10.204.8.5 with SMTP id f5mr3820197bkf.59.1267498243490; Mon, 01 Mar 2010 18:50:43 -0800 (PST) Original-Received: from localhost.localdomain (pb-d-128-141-230-147.cern.ch [128.141.230.147]) by mx.google.com with ESMTPS id e18sm1939847bkd.14.2010.03.01.18.50.41 (version=SSLv3 cipher=RC4-MD5); Mon, 01 Mar 2010 18:50:42 -0800 (PST) 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 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72286 Archived-At: On 02/03/10 02:25 AM, Tim Visher wrote: > On Mon, Mar 1, 2010 at 4:58 PM, Suvayu Ali wrote: >> Hi, >> >> On 01/03/10 10:50 AM, Thamer Mahmoud wrote: >>> >>> Suvayu Ali 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.