I have noticed that when I look at the TODO list, I usually only get things done from the top half of the portion since I read from top to bottom, and by the time I get to half way to the bottom, I find a TODO that could be done. So I was wondering, is there a way to mix up the TODO list so that the ordering is randomized?
As mentioned org-sort
let's you specify a function to sort by:
If the SORTING-TYPE is ?f or ?F, then GETKEY-FUNC specifies a function to be called with point at the beginning of the record. It must return either a string or a number that should serve as the sorting key for that record.
As it happens random
is a function that returns a random number. So M-x org-sort f random
will randomize the sort order in the org file.
However instead of changing the file you could use org-agenda
to view the todos in a randomized order. By setting org-agenda-cmp-user-defined
you can customize the sort order. This function will take two arguments (the agenda entries to compare) and should return -1,1 or 0 depending on which of the entries is "smaller". Here is such a function:
(defun org-random-cmp (a b)
"Return -1,0 or 1 randomly"
(- (mod (random) 3) 1))
And here is an agenda view that shows all TODO items in a random order:
(add-to-list 'org-agenda-custom-commands
'("r" "All todo items in a random order"
alltodo ""
((org-agenda-cmp-user-defined #'org-random-cmp))))
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