Re: [Orgmode] Re: Feature Request: Assort a subtree randomly ?

2011-02-02 Thread Matt Lundin
Bastien  writes:

> Hi Alan,
>
> Matt Lundin  writes:
>
>> (defun my-org-random-sort ()
>>   (random 1000))
>>
>> Then on the appropriate subtree/table/list, type:
>>
>> C-c ^ f my-org-random-sort
>
> Actually I just found out that C-c ^ f random RET works fine too!

Thanks for the tip. Much more elegant.

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


Re: [Orgmode] Re: Feature Request: Assort a subtree randomly ?

2011-02-02 Thread Bastien
Hi Alan,

Matt Lundin  writes:

> (defun my-org-random-sort ()
>   (random 1000))
>
> Then on the appropriate subtree/table/list, type:
>
> C-c ^ f my-org-random-sort

Actually I just found out that C-c ^ f random RET works fine too!

-- 
 Bastien

___
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


[Orgmode] Re: Feature Request: Assort a subtree randomly ?

2011-01-30 Thread Alan E. Davis
That is excellent.  Not too late, at all.  This ability to sort by a
function is excellent: presumably one could use a soundex algorithm!

Thank you,

Alan
___
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


[Orgmode] Re: Feature Request: Assort a subtree randomly ?

2011-01-29 Thread Matt Lundin
"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