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:52:33 +0800 Message-ID: <871qts6tzy.fsf@localhost> References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@gnus.org> <875yj5xzou.fsf@localhost> <875yj443zy.fsf@gnus.org> <874jyo6vd6.fsf@localhost> <87k07k18ro.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="23387"; 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:52: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 1oKghZ-0005u6-Bl for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Aug 2022 15:52:21 +0200 Original-Received: from localhost ([::1]:49244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKghX-0004DZ-Ix for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Aug 2022 09:52:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKghP-0004C4-3q for bug-gnu-emacs@gnu.org; Sun, 07 Aug 2022 09:52:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKghG-0003UC-Bk for bug-gnu-emacs@gnu.org; Sun, 07 Aug 2022 09:52:10 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKghG-0002Nt-61 for bug-gnu-emacs@gnu.org; Sun, 07 Aug 2022 09:52: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: Sun, 07 Aug 2022 13:52: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.16598802999136 (code B ref 57003); Sun, 07 Aug 2022 13:52:02 +0000 Original-Received: (at 57003) by debbugs.gnu.org; 7 Aug 2022 13:51:39 +0000 Original-Received: from localhost ([127.0.0.1]:36245 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKggt-0002NI-6s for submit@debbugs.gnu.org; Sun, 07 Aug 2022 09:51:39 -0400 Original-Received: from mail-pj1-f51.google.com ([209.85.216.51]:38517) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKggp-0002N2-UG for 57003@debbugs.gnu.org; Sun, 07 Aug 2022 09:51:37 -0400 Original-Received: by mail-pj1-f51.google.com with SMTP id q9-20020a17090a2dc900b001f58bcaca95so5437848pjm.3 for <57003@debbugs.gnu.org>; Sun, 07 Aug 2022 06:51:35 -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=E7nD50AoF63xeQz8j4TOYvtXuqhXWnxWDQ9jhFTE7M8=; b=q5eb2WbJe9X1Vbpu9azJfTVQ0UJ++oKOM+7K8z55FOAo7JT/tgqLD5as+VI7v04voh yS+3jlncDVm2ADtU2Pkr3ceJecFsx6qD98usfSJzd+C19cdJ1/6SAlV0EnPwCxcL4ujS JVcZHJWUc0ZUWs2I/0JfbEnEO+0tVM3U8YrSChv7zMpLwXopqcpWWLGPHIBpyAEmdgIT q681CkBaF8HLoCfPy/JcB07U5qBJagsEL6b7/4FcXTgnCqVcsweH2c2omfKWc1B9MqlN DpLMHgluF3zhdYH4XfQFlbWwy20394s9vRoGkNuCz4hadA1DDhehYP8ux/vHJ4aE5zaN f8XQ== 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=E7nD50AoF63xeQz8j4TOYvtXuqhXWnxWDQ9jhFTE7M8=; b=FXdY0IBLWWRrK/e70j7/mR9PniqXVJQgwwi+iPIj+lDs3mD/gUGWTsCGVm+2mk94FQ IzDdPZAZu8HBrYYPNIO42eM0Syky20PV7OzaOXGn70vJI5lV9UVaTf2Un1e0i18Sgyor c7Ri/mbV8R9Nfl2URYihKn/bihVrlmEE6djqgLcU20Hf0N56CpvBnBmdVpYXT+5BfMJt bRit257IOxGw3v8hSjQ3R4HY9S8Rov2IKoHqSLqZgwiRBxgR+jybqYJHG5RomfvF8nTt xQom9+oeC1uy/6clW7prraFnxlSn8NtYWHBPkcIJRRgnbq8Czj/1wN2pLj4xC6Uw0EPG Ayug== X-Gm-Message-State: ACgBeo3wClFXfAFdrPmJY48vYJFsG7j5rB47liOgNhsVsNBhari5WYsr 2D8I/ZzC58A7wYK+x4UNohdtQJmIewI= X-Google-Smtp-Source: AA6agR5dHICr8p/xsmHi9svnH/3CCGHQGC+nA0bHQ5D27GCdSvmTIF7ODsPYPxOGICWgcYW3qk0FEw== X-Received: by 2002:a17:903:247:b0:16c:5017:9ad4 with SMTP id j7-20020a170903024700b0016c50179ad4mr15204014plh.115.1659880290013; Sun, 07 Aug 2022 06:51:30 -0700 (PDT) Original-Received: from localhost ([2409:8a70:2b5:4040:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id i23-20020a056a00225700b0052ddccd7b64sm5153721pfu.205.2022.08.07.06.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Aug 2022 06:51:29 -0700 (PDT) In-Reply-To: <87k07k18ro.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:239061 Archived-At: Lars Ingebrigtsen writes: > Ihor Radchenko writes: > >> 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. > > I think you can say something like > > (eval . (org-startup-folded-mode)) > > to your .dir-locals (etc) to achieve this. (And then you have to add > that to `safe-local-eval-forms' to avoid getting prompted, but Org could > do that in general. And, of course, add this functionality as a minor > mode instead of just a variable.) I do not think that it is a good idea. 1. Having a need to do the eval is not expected by users. 2. Allowing eval is not safe compared to setting variables. Your suggestion about `safe-local-eval-forms' will not work well because even in your example it is not just about running (org-startup-folded-mode); org-startup-folded has 7 allowed values - marking each (org-startup-folded-mode value) form as safe sounds awkward. 3. org-startup-folded is just an example. We have numerous variables like this. I can recall at least several dozens without looking into source code. Creating a minor mode for each and every single possible variable like this is not maintainable. We will certainly forget creating dedicated modes when adding similar variables in future. 4. We have a somewhat similar approach in org-link settings - each link type is activated by evaluating a sexp. The result is slow Org startup time. If we implement per-file settings like you suggested, each setting will require partial re-evaluation of (org-mode). A handful of settings like you suggested will easily degrade Org startup time by an order of magnitude. Best, Ihor