"Alan E. Davis" writes:
> Let's say I have a subtree, of review materials, for example. I would
> like to randomize the order of the elements. I would like to have the
> option to randomize the subtree in some different ways:
>
> 1. sort the members of one subtree that is a list, randomly.
> 2. sort all the headlines, randomly.
> 3. sort the subtrees randomly, and the lists within each
> sub-subtree also randomly, ad nauseum.
>
> I have written a sort routine in elisp. It's been many long years ago,
> but I remember that the basis support for writing sorts is pretty
> general.
>
> Suppose I had time to do this. What would I need to look at?
>
You can use the custom function in the sort command to supply org-sort
with a random number. When calling org-sort, note the function option
presented:
,[ C-c ^ (org-sort)
| Sort %s: [a]lpha [n]umeric [p]riority p[r]operty todo[o]rder [f]unc
| [t]ime [s]cheduled [d]eadline [c]reated
| A/N/T/S/D/C/P/O/F means reversed:
`
You could thus write a quick function, using whatever amount of
randomness you want:
--8<---cut here---start->8---
(defun my-org-random-sort ()
(random 1000))
--8<---cut here---end--->8---
Then on the appropriate subtree/table/list, type:
C-c ^ f my-org-random-sort
> Of course, my need is today, to sort review materials for my students
> in random order.
Sorry this response comes a little to late. :)
Best,
Matt
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode