6

That is, how do I change this task list

* TODO A
* DONE B
* TODO C
* DONE D
* TODO E

into the following one?

* DONE B
* DONE D
* TODO A
* TODO C
* TODO E
  • Are you interested in just manual manipulation, instead of programmatic? orgmode.org/manual/Structure-editing.html If you are interested in programmatic, then your proposed finished product looks random (absent you providing more explanation as to how it is that you arrived at that particular order). – lawlist Jan 31 '16 at 1:08
  • I think you can do something similar with Org sorting functions, i.e. by calling C-c ^ on selected headings. – wvxvw Jan 31 '16 at 9:16
  • 1
    The following link contains an advanced programmatic sorting example: stackoverflow.com/a/22232709/2112489 – lawlist Jan 31 '16 at 10:18
  • @lawlist: Sorry the sorting order wasn't clear (I didn't realize it would look random): it's just a stable sort by todo state: DONE entries are moved to the beginning, and TODO ones to the end. – Clément Jan 31 '16 at 17:08
  • Ah . . . I see now -- thank you. I normally sort 4 times for the majority of entries (?a ?o ?p ?t) using org-sort-entries -- erikstokes has already cited the interactive command that uses org-sort-entries. It operates on regions or on everything under a main heading. It also takes an optional custom function for special sorts. – lawlist Jan 31 '16 at 18:03
12

Use org-sort to sort by todo state, or any thing else. By default it's bound to C-c ^; it will ask you what you want to sort by. Choose O to sort by todo state, reversed (o will put TODO at the top).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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