Is there a way to bulk-reverse the order of headings in Emacs org-mode? I'd like to change this kind of list (but much bigger, not just two or three items, thus "bulk"):
* personal computer
* Windows
* Mac
* Linux
* StackExchange
* stackoverflow
* countries
* people
to this:
* people
* countries
* StackExchange
* stackoverflow
* personal computer
* Windows
* Mac
* Linux
Select the whole buffer and use M-x org-sort-entries RET F point RET
org-sort-entries
sorts all items at a certain level in the tree. 'F' tells it that you want to sort in reverse order according to a function that you specify. Using the function point
gives each entry a value corresponding to buffer position on which to sort.
To do the same thing from elisp, the equivalent function call is (org-sort-entries nil ?F 'point)
C-c ^
to invoke org-sort
, which will Call org-sort-entries
, org-table-sort-lines
or org-sort-list
accordingly.
Then you can either:
>
RET<
RETI don't know the org-sort-entries' api changed or what, when I followed @clatter's answer, it asked me for a compactor. So here is an answer basing on his.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With