[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The emacsclient socket vs. etc/emacs.bash

From: Stefan Monnier
Subject: Re: The emacsclient socket vs. etc/emacs.bash
Date: Fri, 08 Dec 2006 08:46:48 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

> I received a bug report stating that newer CVS versions of Emacs no
> longer delete their server socket on exit, which causes problems for
> users of the `edit' function provided by etc/emacs.bash:

It's not new in CVS.  Emacs-21.4 doesn't delete his socket either.

> |     # Do not just test if these files are sockets.  On some systems
> |     # ordinary files or fifos are used instead.  Just see if they exist.
> |     if [ -e "${HOME}/.emacs_server" -o -e "/tmp/emacs${UID}/server" ]; then
> |        emacsclient "$@"
> |        return $?
> |     else
> |        echo "edit: starting emacs in background..." 1>&2
> |     fi

Yes, the comment seems partly wrong (I don't think these have ever been
simple files) and if pipes have been used, it must have been before my time,
so this other part of the comment is out of date.  The ~/.emacs_server file
is also an outdated reference, since Emacs doesn't use this one any more.

> This function checks for the existence of the socket to decide whether
> to call emacsclient or start a new Emacs instance.  Since the socket
> remains behind after Emacs exits, it decides to call emacsclient, which
> fails (since the latter cannot start a new Emacs itself, yet).

Indeed, it needs to try and connect before deciding what to do.
That's exactly what would happen if the script relied on the
alternate-editor argument to emacsclient, instead of reinventing the wheel
(tho I guess this probably predates emacsclient's alternate-editor
argument, so it didn't reinvent this wheel).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]