changeset 17712:41a4624c1e79

(server-buffer-done): New arg FOR-KILLING. (server-kill-buffer): New fn, to inform clients when buffer is killed.
author Richard M. Stallman <rms@gnu.org>
date Sat, 10 May 1997 00:37:24 +0000
parents 3484851d83b9
children be8005fce86f
files lisp/server.el
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/server.el	Sat May 10 00:33:28 1997 +0000
+++ b/lisp/server.el	Sat May 10 00:37:24 1997 +0000
@@ -280,7 +280,7 @@
       (set-buffer obuf))
     (nconc client client-record)))
 
-(defun server-buffer-done (buffer)
+(defun server-buffer-done (buffer &optional for-killing)
   "Mark BUFFER as \"done\" for its client(s).
 This buries the buffer, then returns a list of the form (NEXT-BUFFER KILLED).
 NEXT-BUFFER is another server buffer, as a suggestion for what to select next,
@@ -322,10 +322,11 @@
 	    (set-buffer buffer)
 	    (setq server-buffer-clients nil)
 	    (run-hooks 'server-done-hook))
-	  (if (server-temp-file-p buffer)
-	      (progn (kill-buffer buffer)
-		     (setq killed t))
-	    (bury-buffer buffer))))
+	  (if for-killing
+	      (if (server-temp-file-p buffer)
+		  (progn (kill-buffer buffer)
+			 (setq killed t))
+		(bury-buffer buffer)))))
     (list next-buffer killed)))
 
 (defun server-temp-file-p (buffer)
@@ -382,6 +383,11 @@
 	(yes-or-no-p "Server buffers still have clients; exit anyway? "))))
 
 (add-hook 'kill-emacs-query-functions 'server-kill-emacs-query-function)
+
+;; When a buffer is killed, inform the clients.
+(add-hook 'kill-buffer-hook 'server-kill-buffer)
+(defun server-kill-buffer ()
+  (server-buffer-done (current-buffer) t))
 
 (defun server-edit (&optional arg)
   "Switch to next server editing buffer; say \"Done\" for current buffer.