From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#57003: 28.1.90; Can local variables be loaded before loading major mode? Date: Sat, 13 Aug 2022 17:02:56 +0800 Message-ID: <877d3c7by7.fsf@localhost> References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@gnus.org> <875yj5xzou.fsf@localhost> <875yj443zy.fsf@gnus.org> <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@gnus.org> <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@gnus.org> <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@gnus.org> <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@gnus.org> <871qtp64eq.fsf@localhost> <878rntskld.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22799"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57003@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 13 11:03:26 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 1oMn3G-0005jT-0N for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Aug 2022 11:03:26 +0200 Original-Received: from localhost ([::1]:44504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMn3E-000232-RO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Aug 2022 05:03:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMn2s-00022s-Rp for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 05:03:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41684) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMn2s-0006aP-JV for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 05:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oMn2s-0001hV-En for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 05:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Aug 2022 09:03: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.16603813246468 (code B ref 57003); Sat, 13 Aug 2022 09:03:02 +0000 Original-Received: (at 57003) by debbugs.gnu.org; 13 Aug 2022 09:02:04 +0000 Original-Received: from localhost ([127.0.0.1]:59665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMn1w-0001gG-9N for submit@debbugs.gnu.org; Sat, 13 Aug 2022 05:02:04 -0400 Original-Received: from mail-pg1-f174.google.com ([209.85.215.174]:39752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMn1t-0001fj-My for 57003@debbugs.gnu.org; Sat, 13 Aug 2022 05:02:03 -0400 Original-Received: by mail-pg1-f174.google.com with SMTP id q16so2643762pgq.6 for <57003@debbugs.gnu.org>; Sat, 13 Aug 2022 02:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc; bh=TqgWVexzelbDBHTwY87hXZUZn3EMzgxjOhMeOG0ld4E=; b=Zvo0QuWty6f4V3mZFU6Ff1eGf2YE/P+x+WMIozLryAK5+qlsTbRcMv7tiD/Dx0B+k9 Z93Aa5MRhNjuymzlPqnJ5yywWRkWcFpDYdlerSVNxRitXNDnbbJ5cR6NnrzvZSTZZoYs cU5eLa9457LhKc3kAs6mY9pQcAF9saJLmgbN5VFqflLy498Fs4M8OuoHsqWTUZNwNStd u5vcozruAAU3kVm1npaKXH9xsDyPzX+WHzR/4cxKWtZ65N2dSZ35u5aAcfGtayQxYU0k F/DZEg/Pf4GiVgpK5kSlDuDI1+xcaBOXd/6gb/B637x9+65Q1S+OSQEmR+MnUDubIyXb GhHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=TqgWVexzelbDBHTwY87hXZUZn3EMzgxjOhMeOG0ld4E=; b=kZWGXx1zXMdNUBscZugr/OjceXmgDM+vWkOSESkDJlBLjRWvBo2lzP9GQXg5v+pXjE j2plyq0roEoSd00R1wVmbi8Xofqm/AAbSlJgdj+O8tALV89dHA/9ujzd3fpWaSQK6SKj 3UEAUcOtEuPSU4SbzcfbBQJyLjzpfZ1h9ULv8MjqaGHM5ykhVqp7sMReov1yVCGRQ6jw Y7oAQgp+QMQdOkXzFILPl5Y2tzN2LekySut6HlQ4XeZT2VU//d3VzmYJCPgD0J7Uj2Jk PnGl9FF0rV8z1CBmeQrAkndkt0AOCxNBwap2P2u+s75M+XdfTpYB6srpCy+seaPCJKZ3 ky7A== X-Gm-Message-State: ACgBeo3xZ+w2EZ1KD2ZgS5l7UzY9jWsj6veot+SoKKhV8hzTlObiRFNg 6Y/isdpyVaRxKO8IOGkPMynwF5sz9g/r4Q== X-Google-Smtp-Source: AA6agR4EM3l5Uo6RNnRIelr2YjyTbBSfjmUY8Ql/BFHr7Yqc5c8M6TJvhOW25TncPq/tY2M4bBnXhQ== X-Received: by 2002:a63:6d2:0:b0:41c:18f2:8ec5 with SMTP id 201-20020a6306d2000000b0041c18f28ec5mr6298548pgg.197.1660381315846; Sat, 13 Aug 2022 02:01:55 -0700 (PDT) Original-Received: from localhost ([2409:8a70:2bf:80b0:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id w9-20020a627b09000000b0052ddccd7b64sm3002427pfc.205.2022.08.13.02.01.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 02:01:54 -0700 (PDT) In-Reply-To: <878rntskld.fsf@gnus.org> 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:239500 Archived-At: Lars Ingebrigtsen writes: >> Why not instead add something that is run _after_ >> kill-all-local-variables? Then, there will be no need to fiddle with >> 'permanently-local (which might have undesired side effects). > > That'd work for things that use `define-derived-mode', but not all modes > are defined that way and call `kill-all-local-variables' "manually". I found such a case in ses.el. However, I am not sure if much can be done mode-specifically in such scenario. Major modes using a custom function may set the value of `major-mode' anywhere down to right before `run-mode-hooks' call. The only universal option then is indeed your suggestion about permanent local variables. They were overridden by hack-local-variables in the past anyway. What can be probably done is a call to `hack-local-variables' inside `kill-all-local-variables', but setting only the variables marked 'permanent-local. The later call to `hack-local-variables' inside `run-mode-hooks' may then only go through the remaining variables. WDYT? -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92