changeset 79243:cccc3ec23e08

(server-unload-function): Rename from `server-unload-hook' and adapt to new `unload-feature' functionality. Remove hook from `kill-buffer-hook' buffer-locally. (server-unload-hook): Remove. (server-unload-function): New var; replaces `server-unload-hook'.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 29 Oct 2007 00:42:24 +0000
parents 70c9d3c324c3
children ea4bb852e0eb
files lisp/server.el
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/server.el	Mon Oct 29 00:35:12 2007 +0000
+++ b/lisp/server.el	Mon Oct 29 00:42:24 2007 +0000
@@ -764,14 +764,18 @@
 
 (define-key ctl-x-map "#" 'server-edit)
 
-(defun server-unload-hook ()
+(defun server-unload-function ()
+  "Unload the server library."
   (server-mode -1)
-  (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)
-  (remove-hook 'kill-emacs-query-functions 'server-kill-emacs-query-function)
-  (remove-hook 'kill-buffer-hook 'server-kill-buffer))
+  (save-current-buffer
+   (dolist (buffer (buffer-list))
+     (set-buffer buffer)
+     (remove-hook 'kill-buffer-hook 'server-kill-buffer t)))
+  ;; continue standard unloading
+  nil)
 
 (add-hook 'kill-emacs-hook (lambda () (server-mode -1))) ;Cleanup upon exit.
-(add-hook 'server-unload-hook 'server-unload-hook)
+(defvar server-unload-function 'server-unload-function)
 
 (provide 'server)