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: Sun, 07 Aug 2022 21:23:01 +0800 Message-ID: <874jyo6vd6.fsf@localhost> References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@gnus.org> <875yj5xzou.fsf@localhost> <875yj443zy.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="7504"; 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 Sun Aug 07 15:23:10 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 1oKgFK-0001kk-0m for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Aug 2022 15:23:10 +0200 Original-Received: from localhost ([::1]:33018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKgFI-0008N8-63 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Aug 2022 09:23:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKgFC-0008Mk-87 for bug-gnu-emacs@gnu.org; Sun, 07 Aug 2022 09:23:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKgFB-0007E4-VM for bug-gnu-emacs@gnu.org; Sun, 07 Aug 2022 09:23:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKgFB-0001f1-NI for bug-gnu-emacs@gnu.org; Sun, 07 Aug 2022 09:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Aug 2022 13:23: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.16598785276306 (code B ref 57003); Sun, 07 Aug 2022 13:23:01 +0000 Original-Received: (at 57003) by debbugs.gnu.org; 7 Aug 2022 13:22:07 +0000 Original-Received: from localhost ([127.0.0.1]:36228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKgEI-0001de-Mw for submit@debbugs.gnu.org; Sun, 07 Aug 2022 09:22:06 -0400 Original-Received: from mail-pg1-f177.google.com ([209.85.215.177]:41830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKgEF-0001d9-UP for 57003@debbugs.gnu.org; Sun, 07 Aug 2022 09:22:05 -0400 Original-Received: by mail-pg1-f177.google.com with SMTP id 13so6409704pgc.8 for <57003@debbugs.gnu.org>; Sun, 07 Aug 2022 06:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=DtG1GDog5Lb8hZPwi5+JdV+Y52cTNCyPCGe4eTwFR7E=; b=Pre4Rl2Dc6IjpkRLWDoTB5pGcpqmBwHZnh8HKDwzfMzz6uPm7gQrcczJnzIN5m2l4P mCCS8s18jpFlglLBIPhrtZ0/v+g6n/WPXbieqYADg5nXnx+QA83VMN+8QafVgIpIBJF7 NlOOPEPnq1jQNZn2Dl6w9ZE2IZts1/z/fgdQP8P9A518yExmwU5VL1UAspaAfLSfu8w2 qJyEAkg4JJW5X2lAW9eUo2BLqLZRCakxO2bv4B8KoAlJYkSLzXy4EUv7PWSrsfX1QHeP V2OoNPDD5kFnQJuAVSP1JHahS00U3G3oydcWRu6xdafvpmKVVioZBbH5gaqLIBB7jZTA nwww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=DtG1GDog5Lb8hZPwi5+JdV+Y52cTNCyPCGe4eTwFR7E=; b=LXHrmcdkSfJSc63g5mBBV7louhb/eRNlBqbupZg3uSsX1EZmpyNprSqkrH93lydyWy Uc6YUX+ip9waJ677AmFmJ0Y9LN1Fiq6nO4GvPyvCsZFwk5lyKGvzv0B8S3fWgbjxdhiG MaAoI+VaOpdv4IhLiHSe13zZ69eL26A8XcmbeCxWLacFyLDWtZPlEsRJQZlkLErXXpHO 9K4rsxLX902yKErT/s/Q9ctD/rOULWlRhDxpDLe7JoEbLGvXAJvFHThaONAIxdzscFjd 7bIPINzPBSQ0fRltgtG6grxPxbcehRsx4oUGz/8ah3wd0pZnLL3tfv3FZS6xgqWoOOfj gdKQ== X-Gm-Message-State: ACgBeo0EGewFwKZYMP+QGOxRe2O0X4xL3PfXLO6Lz15kuR3T4LGhHbA+ 9hiSUJH6//+D9pNONiwOLLI= X-Google-Smtp-Source: AA6agR77ZGbyWTIrf1IVxGudSuAk+AAO3g4Wrnlk7eKjrG+jUsP/AnrGMcVfTV+ly13s2kCT6/mBBw== X-Received: by 2002:a63:4182:0:b0:41c:b808:21d2 with SMTP id o124-20020a634182000000b0041cb80821d2mr12584953pga.156.1659878517994; Sun, 07 Aug 2022 06:21:57 -0700 (PDT) Original-Received: from localhost ([2409:8a70:2b5:4040:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id i25-20020aa796f9000000b0052d50e14f1dsm6600174pfq.78.2022.08.07.06.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Aug 2022 06:21:57 -0700 (PDT) In-Reply-To: <875yj443zy.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:239059 Archived-At: Lars Ingebrigtsen writes: > I see. In that case, it does seem attractive to allow file-local > variables to set the variables before running the mode. However, as > Visuwesh points out, a major mode clears buffer-local variables, so just > setting them before running the mode won't do anything. Indeed. I imagine something like :before-hook in `define-derived-mode' that will run just before the mode body. Or maybe more direct :hack-local-variables-when defining when to run `hack-local-variables' in contrast to currently hard-coded call in `run-mode-hooks'. This is not equivalent to calling `hack-local-variables' in :before-hook because `run-mode-hooks' would call `hack-local-variables' second time in such a case. Or maybe something more user-facing like major-mode-before-init-hook that will be executed before the major mode body form in `define-derived-mode'. > So I think the interface here is just a bit confused and confusing. It > would make more sense to allow users to do these things via mode > hooks/interface functions instead of variables. Agree. However, the file-local variables specifically are not equivalent to the mode hooks. File/directory-local variables can be set on per-file/per-project basis, which is much more convenient compared to explicitly defining a global hook. Best, Ihor