emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: emacsclient horribly broken


From: Stefan Monnier
Subject: Re: emacsclient horribly broken
Date: Thu, 02 Nov 2006 14:06:06 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Like I said, I'm not surprised by the error as such - it indeed makes
> sense that two emacs instances cannot both use the same socket file.
> All I'm saying is that this is the first time I get the error (I fairly
> frequently open extra emacsen, and my GNOME panel launcher uses -f
> server-start). I'm not sure what emacs did before; I assume it either
> figured "server already running, no problem", or just created
> a new socket.

IIRC, the behavior used to be to silently remove the previous socket and
then create a new one on top.

I believe the patch below restores that behavior.

> But if emacsclient then tried in sequence
> - the serverfile specified on the command line
> - or, if local sockets are supported, the first such connected socket (if any)
> - or, if the default server file exists, the tcp socket it references
> then both goals would be met - local sockets get precedence, and my TCP
> setup is transparently handled as well. In addition, for remote TCP
> connections, emacsclient could emit a warning "connecting to emacs running
> on <machine> (port <port>), possibly requiring an extra keystroke
> to confirm.

I agree it makes more sense.  I guess you could tweak it such that
specifying --socket-name prevents fallnig back on a TCP socket.


        Stefan


--- server.el   02 Nov 2006 14:00:25 -0500      1.117
+++ server.el   02 Nov 2006 14:03:12 -0500      
@@ -112,6 +112,7 @@
   :version "22.1")
 (put 'server-auth-dir 'risky-local-variable t)
 
+;; FIXME: This should not be a global var, but stored in the process's plist.
 (defvar server-auth-key nil
   "The current server authentication key.")
 (put 'server-auth-key 'risky-local-variable t)
@@ -311,7 +312,7 @@
     (ignore-errors
       ;; Delete the socket or authentication files made by previous
       ;; server invocations.
-      (if (eq (process-contact server-process :family) 'local)
+      (if (not server-use-tcp)
           (delete-file (expand-file-name server-name server-socket-dir))
         (setq server-auth-key nil)
         (delete-file (expand-file-name server-name server-auth-dir)))))




reply via email to

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