emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Feature Request: Assort a subtree randomly ?
@ 2011-01-17  1:51 Alan E. Davis
  2011-01-29 14:42 ` Matt Lundin
  0 siblings, 1 reply; 5+ messages in thread
From: Alan E. Davis @ 2011-01-17  1:51 UTC (permalink / raw)
  To: org-mode


[-- Attachment #1.1: Type: text/plain, Size: 894 bytes --]

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?

Of course, my need is today, to sort review materials for my students in
random order.

Alan Davis


 "Pollution is nothing but the resources we are not harvesting. We allow
them to disperse because we've been ignorant of their value."

           --- R. Buckminster Fuller

[-- Attachment #1.2: Type: text/html, Size: 1124 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Feature Request: Assort a subtree randomly ?
  2011-01-17  1:51 Feature Request: Assort a subtree randomly ? Alan E. Davis
@ 2011-01-29 14:42 ` Matt Lundin
  2011-01-30 11:37   ` Alan E. Davis
  2011-02-02 15:47   ` Bastien
  0 siblings, 2 replies; 5+ messages in thread
From: Matt Lundin @ 2011-01-29 14:42 UTC (permalink / raw)
  To: Alan E. Davis; +Cc: org-mode

"Alan E. Davis" <lngndvs@gmail.com> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Feature Request: Assort a subtree randomly ?
  2011-01-29 14:42 ` Matt Lundin
@ 2011-01-30 11:37   ` Alan E. Davis
  2011-02-02 15:47   ` Bastien
  1 sibling, 0 replies; 5+ messages in thread
From: Alan E. Davis @ 2011-01-30 11:37 UTC (permalink / raw)
  To: Matt Lundin; +Cc: org-mode


[-- Attachment #1.1: Type: text/plain, Size: 156 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 186 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: Feature Request: Assort a subtree randomly ?
  2011-01-29 14:42 ` Matt Lundin
  2011-01-30 11:37   ` Alan E. Davis
@ 2011-02-02 15:47   ` Bastien
  2011-02-02 17:55     ` Matt Lundin
  1 sibling, 1 reply; 5+ messages in thread
From: Bastien @ 2011-02-02 15:47 UTC (permalink / raw)
  To: Matt Lundin; +Cc: org-mode

Hi Alan,

Matt Lundin <mdl@imapmail.org> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: Feature Request: Assort a subtree randomly ?
  2011-02-02 15:47   ` Bastien
@ 2011-02-02 17:55     ` Matt Lundin
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Lundin @ 2011-02-02 17:55 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode

Bastien <bastien.guerry@wikimedia.fr> writes:

> Hi Alan,
>
> Matt Lundin <mdl@imapmail.org> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-02 17:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-17  1:51 Feature Request: Assort a subtree randomly ? Alan E. Davis
2011-01-29 14:42 ` Matt Lundin
2011-01-30 11:37   ` Alan E. Davis
2011-02-02 15:47   ` Bastien
2011-02-02 17:55     ` Matt Lundin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).