changeset 18049:f1fa9625e2b9

(server-kill-buffer): Prevent infinite recursion. (server-kill-buffer-running): New variable.
author Richard M. Stallman <rms@gnu.org>
date Sat, 31 May 1997 00:31:40 +0000
parents 737274a0801e
children 506b35a4537e
files lisp/server.el
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/server.el	Sat May 31 00:29:11 1997 +0000
+++ b/lisp/server.el	Sat May 31 00:31:40 1997 +0000
@@ -385,11 +385,18 @@
 
 (add-hook 'kill-emacs-query-functions 'server-kill-emacs-query-function)
 
+(defvar server-kill-buffer-running nil
+  "Non-nil while `server-kill-buffer' is running.")
+
 ;; When a buffer is killed, inform the clients.
 (add-hook 'kill-buffer-hook 'server-kill-buffer)
 (defun server-kill-buffer ()
-  (when server-process
-    (server-buffer-done (current-buffer) t)))
+  ;; Prevent infinite recursion if user has made server-done-hook
+  ;; call kill-buffer.
+  (or server-kill-buffer-running
+      (let ((server-kill-buffer-running t))
+	(when server-process
+	  (server-buffer-done (current-buffer) t)))))
 
 (defun server-edit (&optional arg)
   "Switch to next server editing buffer; say \"Done\" for current buffer.