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: Mon, 31 Oct 2022 03:08:36 +0000 Message-ID: <87y1swlmff.fsf@localhost> References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@gnus.org> <875yj5xzou.fsf@localhost> <87h6zni1uc.fsf@localhost> <87pmeaauib.fsf@localhost> <875yg2arjv.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13611"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , 57003@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 31 04:09:22 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 1opLAw-0003N0-A4 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Oct 2022 04:09:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opLAf-00047f-Tt; Sun, 30 Oct 2022 23:09:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opLAd-00047Q-7q for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 23:09:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1opLAc-0000zx-FA for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 23:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1opLAb-0000K9-W6 for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 23:09: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: Mon, 31 Oct 2022 03:09:01 +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.16671856881183 (code B ref 57003); Mon, 31 Oct 2022 03:09:01 +0000 Original-Received: (at 57003) by debbugs.gnu.org; 31 Oct 2022 03:08:08 +0000 Original-Received: from localhost ([127.0.0.1]:39307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opL9j-0000J1-NQ for submit@debbugs.gnu.org; Sun, 30 Oct 2022 23:08:08 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:43935) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opL9h-0000IV-DD for 57003@debbugs.gnu.org; Sun, 30 Oct 2022 23:08:06 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id C98FF240101 for <57003@debbugs.gnu.org>; Mon, 31 Oct 2022 04:07:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667185679; bh=SMtsjJt2LxvP+chTpjXmzc0fVPYQ5Ds5rypujca6o/M=; h=From:To:Cc:Subject:Date:From; b=qnCKqvH8oeHvRRnaUP39hi147Ppz08wv1Y0oc0CidT31OSHUHH4yWi7qY4tLxS5KS P/pLMjSfwtNGV2rhojZZh/s5q+59e4DwUr2sXbCz3nnCE8wHaawiMHr7OgFQ9RG5Tt OZpzoNGkMj68FD8HCL87U36uuRY4/Yh93AGaIbBVbGO207R2GLiK/JSxyDtsRU86bh QJGUXT8oBOPW3tND9/UXRc/1nK6W0poKSCG5VGxJZPD+A53EJa5Ss2Yc+XcU+kxxrn VMujuMfPGoOZUpr2M94NLljAiy+Rd8B1UL7LLDcx7jMvIrNT6UsFLqxo/rb6Xe7aE4 7O5d/gDROJoPg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N0yl16G5Rz6tpG; Mon, 31 Oct 2022 04:07:57 +0100 (CET) In-Reply-To: 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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246663 Archived-At: Stefan Monnier writes: >>> , and I think my recommendation was out >>> of date: the better answer is to use `after-change-major-mode-hook` the >>> `:after-hook` thingy of `define-derived-mode`. >> >> Will it run before or after org-mode-hook? > > It's run after setting file-local vars, which themselves are set after > running the mode hooks. This is unfortunate. org-mode-hook is "Mode hook for Org mode, run after the mode was turned on.". But we need to load file-local variables in order to turn on Org mode + respect file-local settings. So, neither hack-local-variables-hook nor :after-hook will solve the problem I suggested solving in this discussion. For Org mode, it is necessary to complete the setup before org-mode-hook is loaded (I am not talking about folding; there are more critical parts like parser setup). Otherwise, the existing third-party packages adding things to org-mode-hook will be broken. Outside Org mode peculiarities, the fact that hack-local-variables-hook is run after *-mode-hook also means that subtle bugs might be introduced into major modes that are utilizing hack-local-variables-hook for important setup. I conclude that my original idea herein about a new option to load local variables early may be even more important than I initially thought. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at