From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Visher Newsgroups: gmane.emacs.help Subject: Re: conditional font faces Date: Sun, 28 Feb 2010 21:28:34 -0500 Message-ID: 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 X-Trace: dough.gmane.org 1267410572 2656 80.91.229.12 (1 Mar 2010 02:29:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Mar 2010 02:29:32 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Suvayu Ali Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 01 03:29:25 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 1NlvNr-0006Kz-MF for geh-help-gnu-emacs@m.gmane.org; Mon, 01 Mar 2010 03:29:24 +0100 Original-Received: from localhost ([127.0.0.1]:44958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NlvNq-0004s0-Fb for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Feb 2010 21:29:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NlvNT-0004rT-8o for help-gnu-emacs@gnu.org; Sun, 28 Feb 2010 21:28:59 -0500 Original-Received: from [140.186.70.92] (port=58443 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NlvNS-0004qU-8Q for help-gnu-emacs@gnu.org; Sun, 28 Feb 2010 21:28:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NlvNR-000194-0q for help-gnu-emacs@gnu.org; Sun, 28 Feb 2010 21:28:58 -0500 Original-Received: from mail-gx0-f221.google.com ([209.85.217.221]:37560) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NlvNQ-00018x-UT for help-gnu-emacs@gnu.org; Sun, 28 Feb 2010 21:28:56 -0500 Original-Received: by gxk21 with SMTP id 21so1084146gxk.12 for ; Sun, 28 Feb 2010 18:28:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=JlaZ7ReDElU+zH3xkUuuoTwt1CmZxQ8Ua8PoSCBk3Fk=; b=UaZuxIZwlj1dcgSpHfAvDhNuZrkDV9xzJIBJJ8dw6tKhUwylmyBEh97nnbkdW0aato daSXQZvDSxvVd77Z2Q6/SruqjqU6EQkTnVbeGdrc8J8BjgSUYsM3jYnElTifbWMkeF94 j9Ph7MZETULDM5a9a9+ellZPOpqAoHACPtTqY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=osaMIZeFNTIdbVSv8ZaTVK82w7tmM3iAOkahQ7lfxn+K//f39SDeBShBLaa+Yi5s1b VxWmi4WS8bGkND9yBX1To4jkf9x0lhmgDVugQJlAm6IF93EOmTH1/mkUytGCN+m2XXQj ht3/G3MBd4Bo8X0qIPrXCUuRAuUQ16br5nNZ8= Original-Received: by 10.101.160.22 with SMTP id m22mr4992151ano.183.1267410534287; Sun, 28 Feb 2010 18:28:54 -0800 (PST) In-Reply-To: <4B8AE9D2.1070702@gmail.com> 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:72259 Archived-At: 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). -- In Christ, Timmy V. http://burningones.com/ http://five.sentenc.es/ - Spend less time on e-mail