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: Mon, 01 Mar 2010 14:17:55 +0100 Message-ID: <4B8BBE83.80603@gmail.com> References: <4B89BF15.1070605@gmail.com> <4B8AE9D2.1070702@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 1267449473 9907 80.91.229.12 (1 Mar 2010 13:17:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Mar 2010 13:17:53 +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 Mon Mar 01 14:17:49 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 1Nm5VM-00007d-5u for geh-help-gnu-emacs@m.gmane.org; Mon, 01 Mar 2010 14:17:48 +0100 Original-Received: from localhost ([127.0.0.1]:52458 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nm5VK-0000nX-Nk for geh-help-gnu-emacs@m.gmane.org; Mon, 01 Mar 2010 08:17:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nm5Ut-0000mg-Ay for help-gnu-emacs@gnu.org; Mon, 01 Mar 2010 08:17:19 -0500 Original-Received: from [140.186.70.92] (port=35852 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nm5Ur-0000lS-Qn for help-gnu-emacs@gnu.org; Mon, 01 Mar 2010 08:17:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nm5Uq-0007Tk-0p for help-gnu-emacs@gnu.org; Mon, 01 Mar 2010 08:17:17 -0500 Original-Received: from mail-ew0-f222.google.com ([209.85.219.222]:39286) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nm5Up-0007TX-SY for help-gnu-emacs@gnu.org; Mon, 01 Mar 2010 08:17:15 -0500 Original-Received: by ewy22 with SMTP id 22so1662948ewy.26 for ; Mon, 01 Mar 2010 05:17:14 -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=Zpqv3Euplgk/cdP4fXzQr7NvK4vXrs7uVPM+mCH9nBA=; b=m2AZUNTPjYfsb3AY4vqxBnOh3zHLT+H2tUaM+069RCgWNaZpEihlx05crY+yuoyAp4 yB6GsVHXnfghkFgIGwgY7In1vV0mR5WyO+NN7eqG10c8G4wqNXMcLlkOgZ/Lsdf9KBdA 1u8dM28qXyp3VNhaPMBdhyCIEaeFGoGoeLh68= 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=qLAVJ+F4b3dIeDLdeY0qaFL2lz7csFSWmZr5rShd3xzmkcersdVXiTQFXsKv79KXBx 9YDDFI84E3EqXof08f0CUioEIHANkoPlwrCgI/gsd4ae4RIFJCI8bDbLJLOzyZp/5sGC CpLi5WWfpn8ji0gQ3QpnvCaGEUuIy9QlJxy5I= Original-Received: by 10.213.102.195 with SMTP id h3mr2969749ebo.81.1267449433516; Mon, 01 Mar 2010 05:17:13 -0800 (PST) Original-Received: from localhost.localdomain (pb-d-128-141-230-225.cern.ch [128.141.230.225]) by mx.google.com with ESMTPS id 14sm2285039ewy.2.2010.03.01.05.17.11 (version=SSLv3 cipher=RC4-MD5); Mon, 01 Mar 2010 05:17:12 -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:72265 Archived-At: On 01/03/10 03:28 AM, Tim Visher wrote: > On Sun, Feb 28, 2010 at 5:10 PM, Suvayu Ali wrote: >> On 28/02/10 03:00 AM, Tim Visher wrote: >>> >>> On Sat, Feb 27, 2010 at 7:55 PM, Suvayu Ali >>> wrote: >>>> >>>> I was trying to customise the font face to make everything more >>>> visible. Usually I use Emacs with a GUI but quite often I need to use >>>> no-window. The default face for the minibuffer-prompt is medium blue >>>> in no-window which makes it very difficult for me to see. I however >>>> like the defaults when using the GUI. >>>> >>>> Is there some way I could keep the defaults when using GUI and set it >>>> to something more readable when using no-window? >>> >>> I can't remember if it's built in or not but `C-h f emacs-type RET`. >> >> Its not. But I found the library: >> http://malsyned.net/repos/dotemacs/site-lisp/emacs-type.el >> >>> You can then key off of that like so: >>> >>> (defun emacs-is-windowed () >>> "Returns non-nil if Emacs is running in Windowed mode." >>> (string-match "window" (emacs-type))) >> >> It returns a symbol, so I had to modify it like this: >> >> (require 'emacs-type) >> (defun emacs-is-windowed () >> "Returns non-nil if Emacs is running in Windowed mode." >> (string-match "window" (symbol-name (emacs-type)))) >> >> (if (emacs-is-windowed) >> (progn (set-face-background 'default "black") >> (set-face-foreground 'default "white"))) > > That's interesting. The file I got from I not where returned strings. > If you don't mind doing the conversion then you're more than welcome > to but you could download the version I use from my [GitHub > page](http://github.com/timvisher/.emacs/blob/master/site-lisp/emacs-type.el) > if you so desired. Again, I had to override it like > [so](http://github.com/timvisher/.emacs/blob/master/lisp/platform-detection.el) > in order to correctly detect Macs. > >> Now should I be putting above block in a hook? Or is there a better way to >> implement this? If using a hook is the proper solution, which should I be >> using? Something like find-file-hook is definitely inappropriate as >> we can easily have buffers associated with no files (my lisp abilities >> are limited at best). :( > > If I were you I'd put it in my .emacs file. That way it gets > evaluated for everything in the life of that emacs process. This > works for me at least. Here's a [very simple example of how I use > it](http://github.com/timvisher/.emacs/blob/master/lisp/my-config.el#L33). > Thanks for all the help Tim, I ended up using it like this: > (require 'emacs-type) > (defun emacs-is-windowed () > "Returns non-nil if Emacs is running in Windowed mode." > ;; (string-match "window" (emacs-type))) > (string-match "window" (symbol-name (emacs-type)))) > (defun dark-looks() > (if (emacs-is-windowed) > (progn (set-face-background 'default "black") > (set-face-foreground 'default "white")))) > (add-hook 'before-make-frame-hook 'dark-looks) > (dark-looks) I don't use Macs, so I don't need to worry about that aspect. ;) -- Suvayu Open source is the future. It sets us free.