Skip to content

Custom TODO keywords per file #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aareman opened this issue Dec 14, 2021 · 8 comments
Open

Custom TODO keywords per file #185

aareman opened this issue Dec 14, 2021 · 8 comments
Labels
core-feature Feature is in orgmode core

Comments

@aareman
Copy link
Contributor

aareman commented Dec 14, 2021

Does this feature exist in Emacs orgmode core?

Yes

Orgmode link

https://orgmode.org/manual/Per_002dfile-keywords.html

Feature value

Could be used for a jira.org file that would behave one way, while a hiring.org file would have a different workflow

jira.org: TODO PROGRESS QA | DONE
hiring.org LEAD INTERVIEW OFFER-PENDING | ACCEPTED REJECTED

Additional context

Note, it allows multiple workflows per file. (see the example in the ormode link) so "bug" could have one set of todo statuses and "features" could have another

@aareman aareman added the core-feature Feature is in orgmode core label Dec 14, 2021
@aareman
Copy link
Contributor Author

aareman commented Dec 14, 2021

BTW, this plugin is really helpful to me. Thank you for all the hard work. Just keeps getting better and better 🚀

@jgollenz
Copy link
Contributor

jgollenz commented Jan 2, 2022

@aareman do you know how custom TODO keywords behave when displaying the list of all TODO entries? Are they present or do they get ignored? Same question goes for the agende when you schedule a custom TODO

@aareman
Copy link
Contributor Author

aareman commented Jan 3, 2022

I believe it goes based on where the TODO is defined. so if its in a file with custom keywords, then it will use its custom words when switching types. and those types will show in the agenda as well.

As per my example above if a todo was in hiring.org and had a status of LEAD then in the agenda it would say LEAD. If in the agenda i went and toggled the state it would show me the choices from the file hiring.org.

That's what i surmise from the examples i've seen, but I do not know what the internal org spec is on this is.

An additional feature, is the ability to have multiple sets of keywords per file, and then each todo can only use one of the "status flows" (that probably means you can't have overlapping statuses in each flow)

@jgollenz
Copy link
Contributor

jgollenz commented Jan 3, 2022

Exactly, it's individual sets of TODO-cycles and each heading can be part of one, while a file can have multiple sets.

that probably means you can't have overlapping statuses in each flow

The examples on the org homepage would agree with that, if the presence of a single set will override the default set of [TODO, DONE].

As for the agenda, it must then be known for each TODO item whether it belongs to a custom set or not.

@jgollenz
Copy link
Contributor

@aareman fyi I started working on this but haven't had time for some weeks now and don't expect to be able to seriously work on it for the next three months or so 😩 Happy to share my progress, if anybody wants to grab this

@lyz-code
Copy link

@jgollenz probably the code is deprecated now, but could you share your work in progress?

@seflue
Copy link
Contributor

seflue commented Mar 20, 2025

@kristijanhusak I was just looking into this.

For someone motivated to implement this, would you like to discuss some entry points?

Let me just brainstorm what we have and what we need. We have:

  1. Global Configuration: In config/defaults.lua, default TODO keywords are defined as:

    org_todo_keywords = { 'TODO', '|', 'DONE' }
  2. Todo Keyword Parsing: In objects/todo_keywords/init.lua, the TodoKeywords class handles parsing keywords into TODO and DONE states (separated by |).

  3. Headline Integration: In files/headline.lua, methods like get_todo(), set_todo(), is_todo() interact with TODO keywords.

  4. Config Access: In config/init.lua, Config:get_todo_keywords() provides access to the global keywords.

We need:

  1. Parse #+todo: directives in OrgFile
  2. Modify Config to use file-specific keywords when available
    • this could include taking an optional file parameter in Config:get_todo_keywords
  3. Modify the callers of Config:get_todo_keywords to pass the file where appropriate
    • Headline:get_todo - pass self.file to config:get_todo_keywords
    • TodoState:new - needs to take an optional file parameter and forward it to config:get_todo_keywords
    • OrgMappings:_todo_change_state - pass headline.file to TodoState:new

Would this fit your vision?

Another addition would be to support multiple sets of TODO-keywords. But this is an enhancement I see in another ticket.

@seflue
Copy link
Contributor

seflue commented Apr 3, 2025

@kristijanhusak I created an PR and would be happy about feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-feature Feature is in orgmode core
Projects
None yet
Development

No branches or pull requests

4 participants