From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Multiple major modes Date: Thu, 05 Jul 2007 16:34:37 -0400 Message-ID: References: <466E7A93.3050705@gmail.com> <466E81AA.3030202@gnu.org> <466E9822.2050508@gmail.com> <466EAB9D.9020408@gnu.org> <466EEA71.2070700@gmail.com> <200706122014.l5CKEKV1021902@projectile.siege-engine.com> <200706190209.l5J29Csr010302@projectile.siege-engine.com> <200706251404.l5PE4dgc011720@projectile.siege-engine.com> <200707050229.l652T4LR023273@projectile.siege-engine.com> Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1183667858 3439 80.91.229.12 (5 Jul 2007 20:37:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 5 Jul 2007 20:37:38 +0000 (UTC) Cc: emacs-devel@gnu.org, lennart.borgman@gmail.com, sdl.web@gmail.com, monnier@iro.umontreal.ca, jasonr@gnu.org To: "Eric M. Ludlam" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 05 22:37:35 2007 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I6Y4w-000249-81 for ged-emacs-devel@m.gmane.org; Thu, 05 Jul 2007 22:37:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I6Y4v-0003tQ-O4 for ged-emacs-devel@m.gmane.org; Thu, 05 Jul 2007 16:37:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I6Y2B-0001ho-G3 for emacs-devel@gnu.org; Thu, 05 Jul 2007 16:34:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I6Y2A-0001gq-Sr for emacs-devel@gnu.org; Thu, 05 Jul 2007 16:34:38 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I6Y2A-0001gd-CZ for emacs-devel@gnu.org; Thu, 05 Jul 2007 16:34:38 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I6Y29-0004p4-Vo for emacs-devel@gnu.org; Thu, 05 Jul 2007 16:34:38 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1I6Y29-00062C-Iq; Thu, 05 Jul 2007 16:34:37 -0400 In-reply-to: <200707050229.l652T4LR023273@projectile.siege-engine.com> (eric@siege-engine.com) X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:74361 Archived-At: Sorry for being vague. There would be "buffer-local variables", and "mode-local variables". I think you really mean two classes of bindings, right? ;; programmatic (setq-mode-local 'c-mode my-var t) then all buffers in c-mode would get the new value of my-var. Ok. What happens if you do (setq my-var 69) in a buffer in C mode? Does it change the value to 69 for all C mode buffers? If a multi-major-mode tool knows a particular major-mode doesn't use buffer-local variables, then it would not need to run the major-mode function (which could call `kill-all-local-variables') for every section switch and lots of work needed to save and restore buffer-local values that may or may not be mode-specific would be saved. That's true, if we only consider local variables. But major modes set other things too: local keymap, syntax table, abbrev table. We would need a new way to handle them too, right? Here is another idea: `run-mode-hooks' could record all local bindings made by a certain major mode, as mode-local bindings. This way, nearly all major modes would "just work" with the new mechanism; we would not have to change their code. Of course, `delay-mode-hooks' would need to cooperate.