From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Feature request: permanent-local values in hooks buffer local values Date: Wed, 05 Dec 2007 08:21:42 +0100 Message-ID: <47565186.8080909@gmail.com> References: <475439BD.7070000@gmail.com> <475598CF.4050200@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1197217044 7969 80.91.229.12 (9 Dec 2007 16:17:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Dec 2007 16:17:24 +0000 (UTC) Cc: emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 05 08:24:52 2007 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 1Izock-0005ta-N4 for ged-emacs-devel@m.gmane.org; Wed, 05 Dec 2007 08:24:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IzocU-000651-0d for ged-emacs-devel@m.gmane.org; Wed, 05 Dec 2007 02:24:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IzoZt-0003PX-Sa for emacs-devel@gnu.org; Wed, 05 Dec 2007 02:21:53 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IzoZs-0003Nz-D5 for emacs-devel@gnu.org; Wed, 05 Dec 2007 02:21:53 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IzoZs-0003Nt-6C for emacs-devel@gnu.org; Wed, 05 Dec 2007 02:21:52 -0500 Original-Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IzoZn-0007PN-Lq; Wed, 05 Dec 2007 02:21:48 -0500 Original-Received: from c83-254-148-228.bredband.comhem.se ([83.254.148.228]:63459 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1IzoZk-0002I3-5z; Wed, 05 Dec 2007 08:21:45 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: X-Antivirus: avast! (VPS 071205-0, 2007-12-05), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.148.228 X-Scan-Result: No virus found in message 1IzoZk-0002I3-5z. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1IzoZk-0002I3-5z d64507258de6661270985341ae68594b X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) 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:84923 Richard Stallman wrote: > > Isn't change-major-mode-hook sufficient to take care of this need? > > Perhaps you meant after-change-major-mode-hook? > > Isn't this about cleaning up something after you exit a major mode? > `change-major-mode-hook' is the feature for that. In a way, yes. But remember the goal. It is to let a minor mode that is turned on in the buffer survive changing major mode. There are two kind of things to survive: 1) buffer local variable values, which are survived by using (put 'VARIABLE 'permanent-local t) 2) buffer local entries in hooks. Those are what I am asking about here. We have now mentioned three ways of achieving 2: a) my original proposition in this thread b) my (mis)interpretetion of your previous answer, where I suggested using a global entry in after-change-major-mode-hook c) your suggestion to use change-major-mode-hook. Using change-major-mode-hook would require something like this AFAICS: - The minor mode that want to survive puts a function in the buffer local value of change-major-mode-hook. - This function when called puts another function in the global value of after-change-major-mode-hook. This function should then restore the buffer local entries for the minor mode in the hooks. After this the function removes itself from the global value of after-change-major-mode-hook. Is this the solution you would like?