[gnu.emacs.bug] revert-buffer in server-edit mode

jik@ATHENA.MIT.EDU (Jonathan I. Kamens) (04/28/89)

GNU Emacs 18.50.1H of Tue Jun  7 1988 on minos (berkeley-unix)

If you are in server-edit mode in a buffer, and you use the
revert-buffer function to revert the current buffer, server-edit mode
is disabled in the buffer, hence preventing you from typing ctrl-x #
to exit from that buffer and cause the emacsclient to exit.

Jonathan Kamens			              USnail:
MIT Project Athena				410 Memorial Drive, No. 223F
jik@Athena.MIT.EDU				Cambridge, MA 02139-4318
Office: 617-253-4261			      Home: 617-225-8218
----- End of forwarded message

tale@pawl.rpi.edu (David C Lawrence) (04/29/89)

Shucks, dis is one o' dem dere "frequently heard bugs".  Maybe we'll
get lucky and have them change it in the distribution for Version 19.
In the meantime, you can avoid the problem by using these handy lisp
segments.

;; Enhancement to kill-all-local-variables, author Joe Wells
;; jbw%bucsf.bu.edu@bu-it.bu.edu (school year)
;; joew%uswest@boulder.colorado.edu (summer)

;; save the original subr function definition of kill-all-local-variables
(or (fboundp 'original-kill-all-local-variables)
    (fset 'original-kill-all-local-variables
	  (symbol-function 'kill-all-local-variables)))

(defun kill-all-local-variables ()
  "Eliminate all the buffer-local variable values of the current
buffer.  This buffer will then see the default values of all
variables.  NOTE: This function has been modified to ignore
buffer-local variables whose preserved property is non-nil."
  (let ((oldvars (buffer-local-variables)))
    (original-kill-all-local-variables)
    (while oldvars
      (let ((var (car (car oldvars))))
	(cond ((get var 'preserved)
	       (make-local-variable var)
	       (set var (cdr (car oldvars))))))
      (setq oldvars (cdr oldvars)))))

And when you fire up your server,
(put 'server-buffer-clients 'preserved t)

Not only will revert-buffer stick you normally, but invoking almost
any major mode will because they run (kill-all-local-variables).  Dems
de breaks.

Dave
--
      tale@rpitsmts.bitnet, tale%mts@itsgw.rpi.edu, tale@pawl.rpi.edu