Subject: Re: bug#12780: Starting emacs as a daemon, and requesting a client with -n

From: Jan Djärv <[email-masked]>
Date: Fri, 2 Nov 2012 19:32:47 +0100

Hello.

2 nov 2012 kl. 16:46 skrev Glenn Morris <[email-masked]>:

> 
> Forwarding a reply I received off list (please reply-to-all).
> 
> Justin Wood wrote (on Fri, 2 Nov 2012 at 10:49 -0400):
> 
>> Unfortunately, using "emacs -Q --daemon" still does not work
>> correctly with "emacsclient -c -n".
> 
> Can anyone else with a Mac reproduce this?

Yes.  Basically server.el does not handle the non-display situation of Nextstep.  When emacsclient connects it sends back window system unsupported, and then emacsclient tries to create a tty frame (which end up being a GUI frame).  A side effect is that emacsclient gives two "Waiting for Emacs..." messages.

But with -n, there is just window system unsupported, no attempt to create a tty frame.

The patch below fixes this, but the code is probably in the wrong place.

	Jan D.

=== modified file 'lisp/server.el'
--- lisp/server.el	2012-10-07 22:31:58 +0000
+++ lisp/server.el	2012-11-02 18:27:36 +0000
@@ -841,7 +841,9 @@
 
     (unless (assq w window-system-initialization-alist)
       (setq w nil))
-
+    (if (and (not w) (eq (window-system) 'ns))
+	(progn (setq w 'ns)
+	       (setq display nil)))
     (cond (w
            ;; Flag frame as client-created, but use a dummy client.
            ;; This will prevent the frame from being deleted when

	Jan D.