From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: michael@mauger.com Newsgroups: gmane.emacs.devel Subject: Detecting display/frame capability in an Emacs daemon Date: Fri, 15 Feb 2013 17:33:17 -0500 Message-ID: <1ev1uchryvm.fsf@LT-MMAUGER.office.techtarget.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1360984703 16806 80.91.229.3 (16 Feb 2013 03:18:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 16 Feb 2013 03:18:23 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 16 04:18:46 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U6YIV-0001TQ-An for ged-emacs-devel@m.gmane.org; Sat, 16 Feb 2013 04:18:43 +0100 Original-Received: from localhost ([::1]:46840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6YIA-00074q-HN for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2013 22:18:22 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:41169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6Tqh-0005U6-K8 for emacs-devel@gnu.org; Fri, 15 Feb 2013 17:33:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6TqV-0000OD-IK for emacs-devel@gnu.org; Fri, 15 Feb 2013 17:33:42 -0500 Original-Received: from nm7.bullet.mail.bf1.yahoo.com ([98.139.212.166]:38458) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1U6TqV-0000NR-A8 for emacs-devel@gnu.org; Fri, 15 Feb 2013 17:33:31 -0500 Original-Received: from [98.139.212.149] by nm7.bullet.mail.bf1.yahoo.com with NNFMP; 15 Feb 2013 22:33:28 -0000 Original-Received: from [76.13.13.92] by tm6.bullet.mail.bf1.yahoo.com with NNFMP; 15 Feb 2013 22:33:28 -0000 Original-Received: from [127.0.0.1] by smtp109.prem.mail.ac4.yahoo.com with NNFMP; 15 Feb 2013 22:33:28 -0000 X-Yahoo-Newman-Id: 660234.9047.bm@smtp109.prem.mail.ac4.yahoo.com Original-Received: from LT-MMAUGER.office.techtarget.com (michael@98.216.52.54 with plain) by smtp109.prem.mail.ac4.yahoo.com with SMTP; 15 Feb 2013 14:33:28 -0800 PST X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 6aFN2kgVM1nQeasqjt5tQlUkV3JudlbySB2yWzns_Q2z6gf Ys6OKFz5ZgkQvHcyZXHdRfjbkGgFAen8Aqw52pwO1uRU3R0kqaiV_LI3Ls5U qWHnY47iLUk68Tgp.6CP5JuaTUDePiQUdXzEGrPsPU5dlA1Reilnm0klbRyP aoWwj5zIhA2iFlnFq8.yR4jFwVOhz4oob1yRN90jwanarITfTt4Be0VUVgh1 WC4x7fbuxYVcKtGR3SiZZe3FFCp__c1q6ZZK9e1KoFahwkoPcs1YKYexRVtQ OSPfz38PQ26ewDO.6J5ms4FR5F0wGegdUlYjN5mTdGBq0P3oQPvZGRw.nh5B e3PeoCqsgnOwbRZ.xTslUJ4Gr2W5XEOjzbLsKp6KiXu7WSM14VYsYdqAwOlM YDdhuGotIUIaucJO3EDy6UN6tjnJFNL65qGhBZsA3yALnqPftf3YR3UY- X-Yahoo-SMTP: i_bv0HaswBBqrACeSLu_1E5b X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 98.139.212.166 X-Mailman-Approved-At: Fri, 15 Feb 2013 22:18:20 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157065 Archived-At: I have a cloud based Emacs initialization file that I use on three machines: 2 GNU/Linux X based and 1 Cygwin (with w32 GUI). In the script I set the default font and the font for a couple of faces. Since not all of the machines have the same set of fonts, my initialization uses `x-list-fonts' to see if a particular font is available. If a font is not available it falls back on to the next font on my preferred list. For example, I prefer DejaVu Mono, but if it's not available I'll try Liberation Mono, and then Lucida Console. If I start Emacs with just "emacs" my frame pops up with the best preferred font. If, however, I start up with "emacs --daemon", no frame appears (as expected until I request one with "emacsclient"). Since no initial frame is displayed, the GUI has not been initialized and I get an error message in my *Messages* buffer when I try to inspect available fonts. That makes sense. My goal was to then find a hook to attach to that was after the GUI had been initialized so that I could probe the fonts. I tried 'after-make-frame-functions' and checking (display-graphic-p) before I look for fonts, and while I don't get an error indicating that the GUI is not yet initialized, the x-list-fonts function always returns nil and thus I get the default Emacs fonts rather than one I had chosen. Once the frame appears, I can run the same function and my fonts now appear. So, my question is: Is this a bug? Is there a prescribed way of doing this in an Emacs daemon? (Setting the font is not a problem, it's the checking for the existence of the font that causes trouble.) Is this a missing feature/enhancement? --Michael