From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#57003: 28.1.90; Can local variables be loaded before loading major mode? Date: Sun, 07 Aug 2022 02:34:01 +1200 Message-ID: <8c71d52ddab506ff2e040b94db856ff8@webmail.orcon.net.nz> References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@gnus.org> <875yj5xzou.fsf@localhost> <87h72pwjys.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12684"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Orcon Webmail Cc: Lars Ingebrigtsen , 57003@debbugs.gnu.org, Ihor Radchenko To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 06 16:35:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oKKtY-00035G-4s for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Aug 2022 16:35:16 +0200 Original-Received: from localhost ([::1]:40998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKKtW-00048g-I4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Aug 2022 10:35:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKKtK-00048U-Gi for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 10:35:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45457) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKKtK-0001H3-7k for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 10:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKKtK-0004Gt-4h for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 10:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Aug 2022 14:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57003 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 57003-submit@debbugs.gnu.org id=B57003.165979644816350 (code B ref 57003); Sat, 06 Aug 2022 14:35:02 +0000 Original-Received: (at 57003) by debbugs.gnu.org; 6 Aug 2022 14:34:08 +0000 Original-Received: from localhost ([127.0.0.1]:35206 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKKsR-0004Fe-Px for submit@debbugs.gnu.org; Sat, 06 Aug 2022 10:34:08 -0400 Original-Received: from smtp-2.orcon.net.nz ([60.234.4.43]:48915) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKKsQ-0004FW-FS for 57003@debbugs.gnu.org; Sat, 06 Aug 2022 10:34:07 -0400 Original-Received: from [10.253.37.70] (port=46417 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1oKKsL-0006xX-6X; Sun, 07 Aug 2022 02:34:01 +1200 Original-Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Sun, 07 Aug 2022 02:34:01 +1200 In-Reply-To: <87h72pwjys.fsf@gmail.com> X-Sender: psainty@orcon.net.nz X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:238991 Archived-At: On 2022-08-07 02:00, Visuwesh wrote: > Correct me if I'm wrong, this is about the major-mode definition > clearing the buffer's local variables before turning on the major-mode, > right? To elaborate, every major mode calls `kill-all-local-variables', and this is pretty much the first thing that happens (although `change-major-mode-hook' runs before the local variables are actually clobbered). https://stackoverflow.com/a/19295380/324105 (specifically the "Derived modes, and mode hooks" section) might be a useful write-up if you want to get your head around the sequence of events. Note that variables which are marked as permanent-local will retain their values. Refer to: M-x elisp-index-search RET kill-all-local-variables -Phil