summaryrefslogtreecommitdiff
path: root/lisp/server.el
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
commitfb873cfcb6000d30bd90b5c40dc1118f4d00c3ba (patch)
treedb8ad6da8644aba9a9a0d40544c581d9de5d1133 /lisp/server.el
parent7b30f6cfdf7d9205012abd9c95f7314a68e505ad (diff)
downloademacs-fb873cfcb6000d30bd90b5c40dc1118f4d00c3ba.tar.gz
(server-kill-buffer): Prevent infinite recursion.
(server-kill-buffer-running): New variable.
Diffstat (limited to 'lisp/server.el')
-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.