More specifically, I want to use a different keyword order than the order used for toggling between todo states.
I know I can use org-sort-entries nil ?O (or ?o) to sort by todo keyword, and this gets me nearly what I want. However, I'd like to use a different keyword ordering. The order of keywords I've defined in org-todo-keywords is the order I want to use for toggling between keyword states; but it's not the order I want to use for sorting my tasks. If I fix this by changing org-todo-keywords, then the state toggle (Shift + arrow keys) won't work the way I want. Is it possible to use a different keyword order for sorting vs state toggling?
I suspect there is a way to do it using org-sort-entries' GETKEY-FUNC and COMPARE-FUNC parameters, though I don't know elisp well enough to write it off the top of my head. Is there any simpler way - is it possible with just ?o somehow?
As a bonus, if there are headings in the list with NO todo keyword at all, I'd like to be able to specify where in the sort order they go. For instance, I might want my order to be (no-keyword), "STARTED", "TODO", "DONE" so that I end up with sorted rows like this:
* Project A
** Reference for this project: projectA-url.com
** STARTED Write the docs
** STARTED Build the second bit
** TODO Build the third bit
** DONE Set up the infrastructure
** DONE Build the first bit