]> code.delx.au - gnu-emacs/blobdiff - lisp/server.el
Customize.
[gnu-emacs] / lisp / server.el
index f4d3b7cb2decca3b315722e45a81e2c1a92dee0b..dcd025b3d03c5c56a23c9580e498e4ba8ada7e1d 100644 (file)
@@ -147,20 +147,26 @@ Prefix arg means just kill any existing server communications subprocess."
       (progn
        (set-process-sentinel server-process nil)
        (condition-case () (delete-process server-process) (error nil))))
-  (condition-case () (delete-file "~/.emacs_server") (error nil))
+  ;; Delete the socket files made by previous server invocations.
   (let* ((sysname (system-name))
         (dot-index (string-match "\\." sysname)))
+    (condition-case ()
+       (delete-file (format "~/.emacs-server-%s" sysname))
+      (error nil))
     (condition-case ()
        (delete-file (format "/tmp/esrv%d-%s" (user-uid) sysname))
       (error nil))
     ;; In case the server file name was made with a domainless hostname,
     ;; try deleting that name too.
     (if dot-index
-       (condition-case ()
-           (delete-file (format "/tmp/esrv%d-%s" (user-uid)
-                                (substring sysname 0 dot-index)))
-         (error nil))))
-  ;; If we already had a server, clear out associated status.
+       (let ((shortname (substring sysname 0 dot-index)))
+         (condition-case ()
+             (delete-file (format "~/.emacs-server-%s" shortname))
+           (error nil))
+         (condition-case ()
+             (delete-file (format "/tmp/esrv%d-%s" (user-uid) shortname))
+           (error nil)))))
+  ;; If this Emacs already had a server, clear out associated status.
   (while server-clients
     (let ((buffer (nth 1 (car server-clients))))
       (server-buffer-done buffer)))
@@ -199,7 +205,8 @@ Prefix arg means just kill any existing server communications subprocess."
              (setq request (substring request (match-end 0)))
              (while (string-match "[^ ]+ " request)
                (let ((arg
-                      (substring request (match-beginning 0) (1- (match-end 0)))))
+                      (substring request (match-beginning 0) (1- (match-end 0))))
+                     (pos 0))
                  (setq request (substring request (match-end 0)))
                  (if (string-match "\\`-nowait" arg)
                      (setq nowait t)
@@ -209,7 +216,6 @@ Prefix arg means just kill any existing server communications subprocess."
                      ;; ARG is a file name.
                      ;; Collapse multiple slashes to single slashes.
                      (setq arg (command-line-normalize-file-name arg))
-                     (setq pos 0)
                      ;; Undo the quoting that emacsclient does
                      ;; for certain special characters.
                      (while (string-match "&." arg pos)
@@ -347,6 +353,7 @@ or nil.  KILLED is t if we killed the BUFFER (because it was a temp file)."
                    (buffer-backed-up nil))
                (save-buffer))
            (if (and (buffer-modified-p)
+                    buffer-file-name
                     (y-or-n-p (concat "Save file " buffer-file-name "? ")))
                (save-buffer buffer)))
          (server-buffer-done buffer)))))