From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mEvnGxOMXmNOawAAbAwnHQ (envelope-from ) for ; Sun, 30 Oct 2022 15:37:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id KLLYGhOMXmMgzAAAG6o9tA (envelope-from ) for ; Sun, 30 Oct 2022 15:37:07 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D071EE4F for ; Sun, 30 Oct 2022 15:37:06 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1op9Pv-0000FB-2z; Sun, 30 Oct 2022 10:36:03 -0400 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 1op9Pr-0000Em-Sv for emacs-orgmode@gnu.org; Sun, 30 Oct 2022 10:35:59 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1op9Pn-0000SR-QU; Sun, 30 Oct 2022 10:35:58 -0400 Received: by mail-wr1-x42a.google.com with SMTP id bs21so12680654wrb.4; Sun, 30 Oct 2022 07:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zMkXGwGVXtGEJVHfJ0fHwx6NJAh5mLSVc1kDuIa5U+s=; b=S+cBAQPsNetBTQ5rB/Bpv05ebm34/0g6rcKyKWQme7VtjxZ9Rs21xlLAe+8V/4VC0q csWs1R//RSC7QE/A5nW4vaxBJGMMAg2ZOG1GcfD5/m307ck/qBH0OQKxygaYx1VF5dUw Fk+jSejI1VordQzmw2AxyrlwwAeOhMSbBT3MlVwp3jTZGbg9UCJ0slYQyheuiG2MDA9S fhaC3dduQGa3s+MSEW4ulSJof95/l/Ba4V0jKfORAIphO+frFeaQowF+rFgjQaEDSaeZ FViG0NaejVgMe5XVvS50jzZvxEXEx5NR5TauHT/EoFuUZG327AUeeJxqyceuWiO6yaCM digA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=zMkXGwGVXtGEJVHfJ0fHwx6NJAh5mLSVc1kDuIa5U+s=; b=ko1DIZSxdDx3Hep41hSAqnhtJRJcaMUz4uWasL9m8TGTiQLW/EU9JCvvU/rMLOh/Gp aGEwZo9S8j/Y68X2yOljfNMM+K9IHv9i57z2AkWi5Pd7tyWEEr3ZKNNzB60j/hqcyKEB Dlg81csBZD4SvjfM6DivqONxAccRjT/MqosxUpbBHJAobAZwqm98xUU4ybRzV/YH/1GB vlkCXhAhM23kWOKabisOp/gPVvn4oVYvQcfzj4a1tkispxlOsJCrxR/VsI2IHIkehKlK U4vgbDqPMsBtjc8RM1tjWySfnX9YuzcHr0zwj5uVCKvrSEE2/z2srKlFDZjhOcv5VeBv vlVg== X-Gm-Message-State: ACrzQf3wZtzSUmwigFe1sWer6NlADToG4Wy7ZTZBZQYrCZ/DIqdkdm9b /zWizYUUohb7sp/Ymw/VTIyY5814tnw= X-Google-Smtp-Source: AMsMyM6DhC6Z/VRz0k5CIfOnokdAYhhS1nBmsRVvl5qK0pkchwTEvRBzc1Ejzznb6LgDiyKMRMgJKw== X-Received: by 2002:a5d:5081:0:b0:236:75cc:be26 with SMTP id a1-20020a5d5081000000b0023675ccbe26mr5296075wrt.379.1667140553515; Sun, 30 Oct 2022 07:35:53 -0700 (PDT) Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id k6-20020a05600c1c8600b003b4e009deb2sm5067224wms.41.2022.10.30.07.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 07:35:52 -0700 (PDT) From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= To: Ihor Radchenko Cc: Bastien , emacs-orgmode@gnu.org Subject: Re: Setting org-todo-keywords through directory-local variables In-Reply-To: <87leoyatwu.fsf@localhost> (Ihor Radchenko's message of "Sun, 30 Oct 2022 03:10:09 +0000") References: <87mu62gvjk.fsf@gmail.com> <87eercsx1b.fsf@gmail.com> <87lflkdmxx.fsf@nicolasgoaziou.fr> <87eeraaju7.fsf@gmail.com> <87a70stkmv.fsf@gmail.com> <87v9gsdyhk.fsf@gnu.org> <87leoyatwu.fsf@localhost> Date: Sun, 30 Oct 2022 15:35:51 +0100 Message-ID: <875yg1craw.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=kevin.legouguec@gmail.com; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Emacs-orgmode" Errors-To: emacs-orgmode-bounces+larch=yhetil.org+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1667140626; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=zMkXGwGVXtGEJVHfJ0fHwx6NJAh5mLSVc1kDuIa5U+s=; b=VdLu7dcFnblOtmw89RueBdLnMQxnDHjzKB31EwfYJB8s4aV/e88NuuuxaT7Xzo4ODJXg7V JYj8RWu8uXVWUvxIL1Q8Baj9qRT+n1iIS3cYMFo35hoVom5yOLEpPDIM1sw2b4zSCoPoLX kgUqEuuI83/GySWAAG6sdFfwpKmfYNIkaYuUrBmhrZbnGkopOkpFPiWomCcSmllsJ75IuN PzE1wgLPylHky3Eh6wx2VajtFKk3gwx753cPc9R4haF0Ry92V5Y9D2hCVdHGZBN6XG1oVY +G9gq5CJ/Q8JaMYJd30w4t4rIR2juFoJWIuqVhnnKml/Trg2uaSUnFrd75F7LA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667140626; a=rsa-sha256; cv=none; b=FksqjQeMUJ17rUnDfHpgHgUeysbKs80yJaHiLIVJvIydmikmbydkI4TGkO3FDVlS2cdPoE adAMpCZFIviMCrEcG+YrIxtjUDPXIE6tUkwG84K2XDrtvLnXLirxm6831nutBljh7H1lpK sa5fGsfpG/jpvJ/X2FEccwAcO7lCS46Besmnj8bbL6P5ibhHyTTIQn3pzvdHRdx8eo0maI nJelU+85/n038jKvlYvJuvdG/l7AQyaffsTFQ3Bsj37x6BX58ZxGyFN7ffj+03Xghqs8Em ynW88KELMeerHVibLnVwE6/M1D/672j/KV72yQPxW/gRtLm4iBR/sE9ahoEpew== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=S+cBAQPs; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -8.75 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=S+cBAQPs; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D071EE4F X-Spam-Score: -8.75 X-Migadu-Scanner: scn0.migadu.com X-TUID: 1rJ/wN/odNda Ihor Radchenko writes: > [sending to Org ML in-reply to the relevant thread] [Thanks!] > K=C3=A9vin Le Gouguec writes: > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D57003 > 28.1.90; Can local variables be loaded before loading major mode? > >> =E2=80=A6 reminded me of a patch I submitted to the Org ML=E2=80=A6 some= time ago =F0=9F=98=A3 >> (sorry for not following up) to set TODO keywords via .dir-locals.el: >> >> https://list.orgmode.org/87a70stkmv.fsf@gmail.com/ > > Your patch is not listed on https://updates.orgmode.org/ > It is also not in my records (I am only following patches closely since > the beginning of this year). > So, it slipped through the cracks. (Right, that's entirely on me, I posted it knowing that an Org release was pending and figuring I'd come back later=E2=80=A6 well, better late th= an never) >> * could do so piecemeal, adding support for variables one at a time as >> people chime in the ML to express a need. > >> E.g. my patch only added support for org-todo-keywords and >> org-todo-keyword-faces, but it laid the foundation for adding support >> for other variables later. > > I'd prefer to solve it once and for all. I tried early loading of > file-local variables in the past, but had to revert the commit because > of major issues. See > https://list.orgmode.org/87r11wkmew.fsf@ucl.ac.uk/T/#mab6359ed2107d5515c6= bb6b266551f0c5049ceca > > Maybe the hook approach can work better. But I'd prefer to discuss all > the possible caveats first. My reasoning for keeping the current initialization code untouched and _re_computing stuff in hack-local-variables-hook hinged on=E2=80=A6 * refactoring being fraught; since Org already has a "blessed" way to do more or less what file/dir-locals do (SETUPFILEs), I figured it wasn't worth rocking everyone's boat for the benefit of the few, * the prior art in other markup modes (markdown-handle-local-variables, font-latex-after-hacking-local-variables). >> Also to try to reduce the risk of breakage, it went for "compute Org >> settings normally; then selectively recompute some if relevant variables >> are found in dir/file-locals". That way "regular" Org users who rely >> rather on SETUPFILEs wouldn't be impacted, only "early adopters" of >> dir/file-locals might shoot themselves in the foot. > > I am not sure what is the problem with SETUPFILE. > We can simply load it in the hook.=20 I wasn't suggesting there's a problem with SETUPFILEs; my point was that I considered two categories of users: * those who are happy with SETUPFILEs: my implementation goal was to "guarantee" that my patch would have zero impact on them, * those who want to play with dir/file-locals (=F0=9F=91=8B): conversely, I= wanted to make sure that only them would get to "pick up the pieces" when something would inevitably break. This patch might have been my first foray into Org's init code, so it felt too risky to go with any approach other than "keep the implementation for the established features _exactly_ _as_ _now_; stuff all the experimental stuff in hack-local-variables-hook". > Though the priority of SETUPFILE vs. > local variables should be discussed. Probably, local variables should > take precedence to keep things consistent with the rest of Emacs. No strong opinions there. I'm not even sure how my patch handled that? =F0=9F=A4=94 > +(defun org--process-local-variables () > + "Refresh settings affected by file-local or directory-local variables." > + (when > + (let ((local-vars (mapcar #'car file-local-variables-alist))) > + (or (memq 'org-todo-keywords local-vars) > + (memq 'org-todo-keyword-faces local-vars))) > + (org-set-regexps-and-options) > + (org-set-font-lock-defaults))) IIUC the logic goes org-set-regexps-and-options =E2=87=92 org-collect-keywo= rds =E2=87=92 org--collect-keywords-1, and that's where SETUPFILE is processed? So currently the SETUPFILE would have priority =F0=9F=99=83 (unless I'm misrea= ding the code)