emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacsserver socket file not removed on exit


From: Stefan Monnier
Subject: Re: Emacsserver socket file not removed on exit
Date: Tue, 16 May 2006 02:54:16 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Would someone please study this and DTRT?

I've just installed the patch below which should fix it.

> The socket file of emacsserver is not removed when Emacs is exited.
> As far as I can tell, the only thing that causes the server to delete the
> file is (server-start t), which is called by emacsserver's unload hook.

Can you confirm that the patch below fixes it for you?


        Stefan


--- server.el   07 mai 2006 10:06:52 -0400      1.110
+++ server.el   16 mai 2006 02:49:31 -0400      
@@ -252,8 +252,6 @@
 
 Prefix arg means just kill any existing server communications subprocess."
   (interactive "P")
-  ;; Make sure there is a safe directory in which to place the socket.
-  (server-ensure-safe-dir server-socket-dir)
   ;; kill it dead!
   (if server-process
       (condition-case () (delete-process server-process) (error nil)))
@@ -265,7 +263,10 @@
   (while server-clients
     (let ((buffer (nth 1 (car server-clients))))
       (server-buffer-done buffer)))
+  ;; Now any previous server is properly stopped.
   (unless leave-dead
+    ;; Make sure there is a safe directory in which to place the socket.
+    (server-ensure-safe-dir server-socket-dir)
     (if server-process
        (server-log (message "Restarting server")))
     (letf (((default-file-modes) ?\700))
@@ -578,7 +579,7 @@
   (if (or arg
          (not server-process)
          (memq (process-status server-process) '(signal exit)))
-      (server-start nil)
+      (server-mode 1)
     (apply 'server-switch-buffer (server-done))))
 
 (defun server-switch-buffer (&optional next-buffer killed-one)
@@ -637,14 +638,15 @@
 (define-key ctl-x-map "#" 'server-edit)
 
 (defun server-unload-hook ()
-  (server-start t)
+  (server-mode -1)
   (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)
   (remove-hook 'kill-emacs-query-functions 'server-kill-emacs-query-function)
   (remove-hook 'kill-buffer-hook 'server-kill-buffer))
 
+(add-hook 'kill-emacs-hook (lambda () (server-mode -1))) ;Cleanup upon exit.
 (add-hook 'server-unload-hook 'server-unload-hook)
 
 (provide 'server)
 
-;;; arch-tag: 1f7ecb42-f00a-49f8-906d-61995d84c8d6
+;; arch-tag: 1f7ecb42-f00a-49f8-906d-61995d84c8d6
 ;;; server.el ends here




reply via email to

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