Xref: utzoo gnu.emacs:341 comp.emacs:5097 Path: utzoo!attcan!uunet!bu-cs!bucsb!jbw From: jbw@bucsb.UUCP (Joe Wells) Newsgroups: gnu.emacs,comp.emacs Subject: Re: Bug (?) in emacs server Summary: inews garbage Message-ID: <2319@bucsb.UUCP> Date: 18 Jan 89 22:16:15 GMT References: <10864@umn-cs.CS.UMN.EDU> Reply-To: jbw@bucsf.bu.edu (Joe Wells) Followup-To: gnu.emacs Organization: Boston Univ Comp. Sci. Lines: 70 In article <10864@umn-cs.CS.UMN.EDU> randy@umn-cs (Randy Orrison) writes: >I'm using GNU emacs in server mode under X windows. The problem that >I've found is that when I use emacsclient, and change the mode of the >buffer (say, from Fundamental to Text for editing mail), emacs forgets >that that buffer was a server buffer, and so C-x # does nothing, and >the only way I've found to let the client continue on is to exit >emacs. Shouldn't the server attribute (is it a minor mode?) be kept >when the major mode of a buffer changes? > >(Is this fixed in 18.52?) No, this isn't fixed in any version. This is a consequence of the fact that almost every major mode calls the function kill-all-local-variables to clear out mode specific settings. This also destroys any other local variables. Here is a fix: (require 'kill-fix) ; this file follows (put 'server-buffer-clients 'preserved t) The file kill-fix.el is at the end of this message. -- Joe Wells INTERNET: jbw%bucsf.bu.edu@bu-it.bu.edu UUCP: ...!harvard!bu-cs!bucsf!jbw IP: [128.197.2.9] ---------------------------------------------------------------------- ;; Enhancement to kill-all-local-variables ;; Copyright (C) 1988 Free Software Foundation, Inc. ;; This file is not officially part of GNU Emacs, but is being donated ;; to the Free Software Foundation. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY. No author or distributor ;; accepts responsibility to anyone for the consequences of using it ;; or for whether it serves any particular purpose or works at all, ;; unless he says so in writing. Refer to the GNU Emacs General Public ;; License for full details. ;; Everyone is granted permission to copy, modify and redistribute ;; GNU Emacs, but only under the conditions described in the ;; GNU Emacs General Public License. A copy of this license is ;; supposed to have been given to you along with GNU Emacs so you ;; can know your rights and responsibilities. It should be in a ;; file named COPYING. Among other things, the copyright notice ;; and this notice must be preserved on all copies. ;; 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))))) (provide 'kill-fix)