unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Detecting display/frame capability in an Emacs daemon
@ 2013-02-15 22:33 michael
  2013-02-16  5:08 ` Stefan Monnier
  2013-02-16 14:07 ` Richard Stallman
  0 siblings, 2 replies; 10+ messages in thread
From: michael @ 2013-02-15 22:33 UTC (permalink / raw)
  To: emacs-devel

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 



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-02-21 17:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-15 22:33 Detecting display/frame capability in an Emacs daemon michael
2013-02-16  5:08 ` 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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).