From: Matt Lundin <mdl@imapmail.org>
To: "Alan E. Davis" <lngndvs@gmail.com>
Cc: org-mode <emacs-orgmode@gnu.org>
Subject: Re: Feature Request: Assort a subtree randomly ?
Date: Sat, 29 Jan 2011 09:42:05 -0500 [thread overview]
Message-ID: <87lj23ai0y.fsf@fastmail.fm> (raw)
In-Reply-To: <AANLkTimRRrQNCGwaHon=k18GCZWFniDoTvDJtXWCcX0b@mail.gmail.com> (Alan E. Davis's message of "Mon, 17 Jan 2011 11:51:52 +1000")
"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
next prev parent reply other threads:[~2011-01-29 14:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-17 1:51 Feature Request: Assort a subtree randomly ? Alan E. Davis
2011-01-29 14:42 ` Matt Lundin [this message]
2011-01-30 11:37 ` Alan E. Davis
2011-02-02 15:47 ` Bastien
2011-02-02 17:55 ` Matt Lundin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lj23ai0y.fsf@fastmail.fm \
--to=mdl@imapmail.org \
--cc=emacs-orgmode@gnu.org \
--cc=lngndvs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).