]> git.eshelyaron.com Git - emacs.git/commitdiff
(server-save-buffers-kill-terminal): Check the `proc' is indeed a process.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 23 Dec 2007 22:46:07 +0000 (22:46 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 23 Dec 2007 22:46:07 +0000 (22:46 +0000)
lisp/ChangeLog
lisp/server.el

index 76dfeb27f0512a7995672769018a389acfd3281e..f02cfe5d894678ca6cfc4ed2996c76d3796ffd47 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * server.el (server-save-buffers-kill-terminal): Check the `proc' is
+       indeed a process.
+
 2007-12-23  Richard Stallman  <rms@gnu.org>
 
        * simple.el (region-active-p): New function.
index 4d21959774a6e1dd444376e51cff4f6715555bdd..dc534adc0f9aae57a42694588add91043bfa3bfa 100644 (file)
@@ -1260,21 +1260,25 @@ done that."
 
 ;;;###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)