0

The standard workflow for switching heading states in Org (TODO/DONE) is to leaf through them with C-c C-t, or to assign letters to them and switch directly to the wanted state. These seem to be exclusive, since they are invoked with the same hotkey. On top of that, if I add extra states, then either the sequence becomes rather long or I need to exclude some of them from the sequence and type them manually.

I'd like instead to have both the ‘standard’ sequence toggled with C-c C-t, and the option to switch to any particular state with a hotkey of my choosing (specifically, I'd likely make a menu of them and bind that somewhere under SPC in Doom). To this end, I'd need a function that switches to any state without going through the other ones—is there a standard function for this in Org? So far, I haven't seen one in the docs or third-party articles. Maybe Doom already has something like this, that I missed?

I could go through the code and try to kludge me up some custom function borrowing pieces from the original source—however Org's code is already rather hands-on and low-level, and I'd prefer to use whatever APIs it does provide, and stay away from the internals, lest I run into conflicts later after changes in Org.

3
  • Not quite sure what you need, you can swith any state with (org-todo "WAITNING") Mar 9, 2022 at 2:29
  • 1
    See Fast access to TODO states in the manual.
    – NickD
    Mar 9, 2022 at 2:35
  • @TianshuWang Seems to be exactly what I want. The function's name is not too intuitive—in the tradition of Elisp, frankly: I did look for something like org-set-state or anything related to states, but found nothing. However I probably should have found org-todo being called in the source. Anyway, if you add that as an answer, I'll accept it.
    – aaa
    Mar 9, 2022 at 4:48

1 Answer 1

1

As mentioned in comment, you can use (org-todo "WAITING") to switch to the specified state:

(org-todo &optional ARG)

When called through ELisp, arg is also interpreted in the following way:
none        -> empty state
""            -> switch to empty state
done        -> switch to DONE
nextset     -> switch to the next set of keywords
previousset -> switch to the previous set of keywords
"WAITING"     -> switch to the specified keyword, but only if it
                 really is a member of org-todo-keywords.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.