emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gnuserv


From: Juanma Barranquero
Subject: Re: Gnuserv
Date: Mon, 29 Oct 2001 16:54:50 +0100

In both versions of gnuserv.el, the function `server-kill-buffer'
replaces `kill-buffer', but it does not preserve correctly the
semantics of that function. In particular, if the buffer is actually
killed, the while loop responsible for notifying clients makes the
function return nil instead of t.

I've also merged the docstring of both functions; otherwise loading
gnuserv.el makes the user lose documentation :)



                                                           /L/e/k/t/u


2001-10-29  Juanma Barranquero  <address@hidden>

        * gnuserv.el (server-kill-buffer): Preserve return value of the
          call to `kill-buffer' (through `server-real-kill-buffer').
          Update docstring to be more informative.



--- gnuserv.el.orig     Mon Oct 29 16:36:04 2001
+++ gnuserv.el  Mon Oct 29 16:33:36 2001
@@ -346,7 +335,17 @@
        buf))))
 
 (defun server-kill-buffer (buffer)
-  "Kill the BUFFER.  The argument may be a buffer object or buffer name.
+  "Kill the buffer BUFFER.
+The argument may be a buffer or may be the name of a buffer.
+An argument of nil means kill the current buffer.
+
+Value is t if the buffer is actually killed, nil if user says no.
+
+The value of `kill-buffer-hook' (which may be local to that buffer),
+if not void, is a list of functions to be called, with no arguments,
+before the buffer is actually killed.  The buffer to be killed is current
+when the hook functions are called.
+
 NOTE: This function has been enhanced to allow for remote editing
 in the following way:
 
@@ -358,19 +357,17 @@
   (if (buffer-name buffer)
       (save-excursion
        (set-buffer buffer)
-       (let ((old-clients server-clients))
-         (server-real-kill-buffer buffer) ;try to kill it
-         (if (buffer-name buffer)      ;succeeded in killing?
-             nil                       ;nope
-           (while old-clients
-             (let ((client (car old-clients)))
-               (delq buffer client)
-               (if (cdr client)        ;pending buffers?
-                   nil                 ;yep
-                 (server-write-to-client (car client) nil) ;nope, tell client
-                 (setq server-clients (delq client server-clients))))
-             (setq old-clients (cdr old-clients))))))))
-
+        (and (server-real-kill-buffer buffer)    ;try to kill it
+             (let ((old-clients server-clients)) ;succeed, tell the clients
+               (while old-clients
+                 (let ((client (car old-clients)))
+                   (delq buffer client)
+                   (if (cdr client)                           ;pending buffers?
+                       nil                                    ;yep
+                     (server-write-to-client (car client) nil);nope, tell 
client
+                     (setq server-clients (delq client server-clients))))
+                 (setq old-clients (cdr old-clients)))
+               t)))))
 
 (defun server-kill-all-local-variables ()
   "Eliminate all the buffer-local variable values of the current buffer.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]