unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* The emacsclient socket vs. etc/emacs.bash
@ 2006-12-08 13:15 Romain Francoise
  2006-12-08 13:46 ` Stefan Monnier
  2006-12-09  1:26 ` Richard Stallman
  0 siblings, 2 replies; 26+ messages in thread
From: Romain Francoise @ 2006-12-08 13:15 UTC (permalink / raw)


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:

| function edit ()
| {
| [...]
|     # 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

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).

If I understand the recent changes to server.el correctly, Emacs
shouldn't delete the socket on exit, because it might be a socket
started by another Emacs instance and not the original socket.
In that case, isn't it possible to check for the liveness of the socket,
and delete it if it's dead?

(Or perhaps emacs.bash should just do emacsclient -a emacs ...)

Thanks,

-- 
Romain Francoise <romain@orebokech.com> | The sea! the sea! the open
it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the
                                        | ever free! --Bryan W. Procter

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: The emacsclient socket vs. etc/emacs.bash
@ 2006-12-15 13:54 LENNART BORGMAN
  2006-12-15 15:18 ` Kim F. Storm
  0 siblings, 1 reply; 26+ messages in thread
From: LENNART BORGMAN @ 2006-12-15 13:54 UTC (permalink / raw)
  Cc: Juanma Barranquero, romain, rms, Stefan Monnier, emacs-devel

From: storm@cua.dk (Kim F. Storm)
Date: Friday, December 15, 2006 2:37 pm
Subject: Re: The emacsclient socket vs. etc/emacs.bash

> "Juanma Barranquero" <lekktu@gmail.com> writes:
> 
> > On 12/9/06, Richard Stallman <rms@gnu.org> wrote:
> >
> >>     - time 0: Emacs 1 starts its server.
> >>     - time 1: Emacs 2 starts its server, overriding Emacs 1's 
> server.>>
> >> Isn't that already a problem?
> >> Shouldn't we prevent this from happening, somehow?
> >
> > I agree. I don't like Emacs 2 blindly overwritting Emacs 1's server
> > (or socket) file.
> 
> I hate that too.
> 
> I typically have a "master emacs" instance running all the time.
> Sometimes I start another instance (e.g. in a terminal window)
> just to make some small change to a config file - and blammo - 
> the server is no longer associated with the master emacs.
> 
> But is this the right time to change this (it's been like that for
> ages).


This is one of the situation where it might be good to not have anything about server start in the startup files. If emacsclient starts emacs automatically then you do not need that.

Starting another emacs is then safe at least from this point of view.

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

end of thread, other threads:[~2006-12-16 11:07 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-08 13:15 The emacsclient socket vs. etc/emacs.bash Romain Francoise
2006-12-08 13:46 ` Stefan Monnier
2006-12-08 14:06   ` Romain Francoise
2006-12-08 18:38     ` Stefan Monnier
2006-12-08 19:10       ` Juanma Barranquero
2006-12-08 23:33         ` Stefan Monnier
2006-12-08 23:47           ` Juanma Barranquero
2006-12-09  1:28             ` Stefan Monnier
2006-12-09 11:36           ` Romain Francoise
2006-12-09  1:26 ` Richard Stallman
2006-12-09  3:55   ` Stefan Monnier
2006-12-09 18:25     ` Richard Stallman
2006-12-15 12:45       ` Juanma Barranquero
2006-12-15 13:37         ` Kim F. Storm
2006-12-15 14:05           ` Juanma Barranquero
2006-12-15 23:40             ` Stefan Monnier
2006-12-15 23:47               ` Juanma Barranquero
2006-12-16  9:54                 ` Eli Zaretskii
2006-12-16 11:07                   ` Juanma Barranquero
2006-12-15 21:07           ` Andreas Schwab
  -- strict thread matches above, loose matches on Subject: below --
2006-12-15 13:54 LENNART BORGMAN
2006-12-15 15:18 ` Kim F. Storm
2006-12-15 15:24   ` Lennart Borgman
2006-12-15 15:38     ` Kim F. Storm
2006-12-15 15:48       ` Lennart Borgman
2006-12-15 23:21         ` Kim F. Storm

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).