all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: michael@mauger.com
To: emacs-devel@gnu.org
Subject: Detecting display/frame capability in an Emacs daemon
Date: Fri, 15 Feb 2013 17:33:17 -0500	[thread overview]
Message-ID: <1ev1uchryvm.fsf@LT-MMAUGER.office.techtarget.com> (raw)

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 



             reply	other threads:[~2013-02-15 22:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15 22:33 michael [this message]
2013-02-16  5:08 ` Detecting display/frame capability in an Emacs daemon Stefan Monnier
2013-02-16 14:07 ` Richard Stallman
2013-02-17  0:23   ` Michael Mauger
2013-02-17 23:24     ` Richard Stallman
2013-02-18  1:38       ` Stephen J. Turnbull
2013-02-18 15:33         ` Richard Stallman
2013-02-20  6:24           ` Stephen J. Turnbull
2013-02-20 21:36             ` Richard Stallman
2013-02-21 17:31               ` Stephen J. Turnbull

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=1ev1uchryvm.fsf@LT-MMAUGER.office.techtarget.com \
    --to=michael@mauger.com \
    --cc=emacs-devel@gnu.org \
    /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.