summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-05-31 00:31:40 +0000
committerRichard M. Stallman <rms@gnu.org>1997-05-31 00:31:40 +0000
commit099e11b7b21aad8dc894d9d49339e022ac4e1f61 (patch)
tree40dcf91209cdd1f1b0ffdd8734e0c80ed8dfb3fd /lisp
parent39702dcc1ced1b64c7f2cdea9b5aa851e28527bc (diff)
downloademacs-099e11b7b21aad8dc894d9d49339e022ac4e1f61.tar.gz
(server-kill-buffer): Prevent infinite recursion.
(server-kill-buffer-running): New variable.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/server.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/server.el b/lisp/server.el
index 3fb4b039e8f..49fd8172c40 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -385,11 +385,18 @@ or nil. KILLED is t if we killed the BUFFER (because it was a temp file)."
(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.