[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Setting org-todo-keywords through directory-local variables
From: |
Kévin Le Gouguec |
Subject: |
Re: Setting org-todo-keywords through directory-local variables |
Date: |
Wed, 24 Jun 2020 19:54:16 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Hello,
I would like to re-submit this idea, now that I am reasonably sure that
my implementation will not impact users who do not use the feature.
(I understand that Org 9.4 is on the way. I am not asking for this
feature to be included right now; I would like to get some feedback
first, then move on to documenting it.)
* Motivation
To recap: AFAIK it is not possible to define both org-todo-keywords and
org-todo-keyword-faces per-directory. The former can be set with
#+SETUPFILE, but the latter simply can't be set locally, unless I'm
mistaken.
I'd like to specify, for all Org files in a directory, which keywords to
use and how they must look. Setting both org-todo-* variables in
.dir-locals.el would be ideal IMO: the definitions for keywords and
their faces would be right next to each other.
This cannot work right now because (1) of a stray call to default-value
(2) Org computes the TODO machinery (regexps and font-lock) when setting
up the major mode, before directory-local variables are in effect.
* Prior art
AUCTeX[1] and markdown-mode[2] both solve this using
hack-local-variables-hook. This seems to be the expected way for modes
to (re)compute things that may be affected by file or directory-local
variables.
[1]
http://git.savannah.gnu.org/cgit/auctex.git/tree/font-latex.el?h=release_12_2#n1331
[2] https://github.com/jrblevin/markdown-mode/blob/v2.4/markdown-mode.el#L9403
The idea is to register a function that will check whether the user
overloaded variables we care about; if that's the case, then we
recompute what we need to.
* Patch
The attached patch:
- does not change org-mode's default setup logic,
- adds a function to hack-local-variables-hook that will look for
org-todo-* variables, and recompute org-set-regexps-and-options and
org-set-font-lock-defaults if needed,
- adds :safe predicates for these variables,
- adds unit tests.
0001-Allow-users-to-configure-TODO-keywords-from-dir-loca.patch
Description: Text Data
Am I on the right track with this patch, or are there problems I haven't
thought of?
Thank you for your time.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Setting org-todo-keywords through directory-local variables,
Kévin Le Gouguec <=