diff lisp/server.el @ 91302:56a72e2bd635

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-306
author Miles Bader <miles@gnu.org>
date Sat, 29 Dec 2007 02:39:17 +0000
parents 2fcaae6177a5 cd847b2ba99f
children 606f2d163a64
line wrap: on
line diff
--- a/lisp/server.el	Fri Dec 28 02:13:20 2007 +0000
+++ b/lisp/server.el	Sat Dec 29 02:39:17 2007 +0000
@@ -1260,21 +1260,25 @@
 
 ;;;###autoload
 (defun server-save-buffers-kill-terminal (proc &optional arg)
+  ;; Called from save-buffers-kill-terminal in files.el.
   "Offer to save each buffer, then kill PROC.
 
 With prefix arg, silently save all file-visiting buffers, then kill.
 
 If emacsclient was started with a list of filenames to edit, then
 only these files will be asked to be saved."
-  (let ((buffers (process-get proc 'buffers)))
-    ;; If client is bufferless, emulate a normal Emacs session
-    ;; exit and offer to save all buffers.  Otherwise, offer to
-    ;; save only the buffers belonging to the client.
-    (save-some-buffers arg
-		       (if buffers
-			   (lambda () (memq (current-buffer) buffers))
-			 t))
-    (server-delete-client proc)))
+  ;; save-buffers-kill-terminal occasionally calls us with proc set
+  ;; to `nowait' (comes from the value of the `client' frame parameter).
+  (when (processp proc)
+    (let ((buffers (process-get proc 'buffers)))
+      ;; If client is bufferless, emulate a normal Emacs session
+      ;; exit and offer to save all buffers.  Otherwise, offer to
+      ;; save only the buffers belonging to the client.
+      (save-some-buffers arg
+                         (if buffers
+                             (lambda () (memq (current-buffer) buffers))
+                           t))
+      (server-delete-client proc))))
 
 (define-key ctl-x-map "#" 'server-edit)