Subject: Re: bug#12647: 24.2.50; emacs --daemon broken in tty

From: Glenn Morris <[email-masked]>
Date: Tue, 16 Oct 2012 03:00:21 -0400

Toby Cubitt wrote:

> "emacsclient -c" throws an error if "emacs --daemon" is started outside
> of X windows, . This is on a recent bzr checkout (from today).
>
> Steps to reproduce:
>
> 1. switch to a linux virtual tty
>
> 2. emacs -Q --daemon
>
> 3. switch to X windows
>
> 4. emacsclient -c aborts with the following error:
>
>    Waiting for Emacs...
>    *ERROR*: Wrong type argument: stringp, nil

This is due to the various changes related to display handling in
r110444 (cygw32). The specific error is from x-initialize-window-system,
which cannot find a display (don't ask me why getenv DISPLAY doesn't
work here). In the past, frame.el set x-display-name, but it does not do
that any more. Presumably it was doing it for a reason.

The following example frame.el change makes it work again, but someone
should check this area.

--- lisp/frame.el   2012-09-17 12:07:36 +0000
+++ lisp/frame.el   2012-10-16 06:54:40 +0000
@@ -655,6 +655,7 @@
       (error "Don't know how to create a frame on window system %s" w))
 
     (unless (get w 'window-system-initialized)
+      (or x-display-name (setq x-display-name display))
       (funcall (cdr (assq w window-system-initialization-alist)))
       (put w 'window-system-initialized t))