Subject: Re: bug#1058: 23.0.60; emacs --daemon should not return until socket is ready

From: Dan Nicolaescu <[email-masked]>
Date: Wed, 1 Oct 2008 09:51:10 -0700 (PDT)

SRS0+wOMF+22+gmail.com=[email-masked] writes:

  > From this transcript, you can see that after starting 'emacs
  > --daemon', it takes five seconds before the socket is actually
  > available for emacsclient to talk to it.
  > 
  >     $ emacs --daemon; while ! ls /tmp/emacs1187/; do sleep 1; done

Just curious, what do you get if you do:

emacs -Q --daemon; while ! ls /tmp/emacs1187/; do sleep 1; done

  >     emacs: no process killed
  >     ls: cannot access /tmp/emacs1187/: No such file or directory
  >     ls: cannot access /tmp/emacs1187/: No such file or directory
  >     ls: cannot access /tmp/emacs1187/: No such file or directory
  >     ls: cannot access /tmp/emacs1187/: No such file or directory
  >     server
  > 
  > This is evil; it means that making $ALTERNATE_EDITOR a script that
  > just does
  > 
  >     emacs --daemon && emacsclient
  > 
  > results in a loop, because the socket isn't ready when emacsclient
  > starts -- so emacsclient runs the above script again.  For --daemon to
  > be useful to me, it really must not exit until the socket is ready.

Unfortunately ATM I don't see an easy way to do that.  Ideas/patches are
certainly welcome.