From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Feature Request: Assort a subtree randomly ? Date: Sat, 29 Jan 2011 09:42:05 -0500 Message-ID: <87lj23ai0y.fsf@fastmail.fm> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=47489 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjC08-0001cQ-Q7 for emacs-orgmode@gnu.org; Sat, 29 Jan 2011 09:42:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PjC07-0002xv-Dd for emacs-orgmode@gnu.org; Sat, 29 Jan 2011 09:42:08 -0500 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:55144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PjC07-0002xo-7d for emacs-orgmode@gnu.org; Sat, 29 Jan 2011 09:42:07 -0500 In-Reply-To: (Alan E. Davis's message of "Mon, 17 Jan 2011 11:51:52 +1000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Alan E. Davis" Cc: org-mode "Alan E. Davis" writes: > Let's say I have a subtree, of review materials, for example.=C2=A0 I wou= ld > like to randomize the order of the elements.=C2=A0 I would like to have t= he > option to randomize the subtree in some different ways: > > =C2=A0=C2=A0=C2=A0 1.=C2=A0 sort the members of one subtree that is a lis= t, randomly. > =C2=A0=C2=A0=C2=A0 2.=C2=A0 sort all the headlines, randomly. > =C2=A0=C2=A0=C2=A0 3.=C2=A0 sort the subtrees randomly, and the lists wit= hin each > sub-subtree also randomly, ad nauseum. > > I have written a sort routine in elisp.=C2=A0 It's been many long years a= go, > but I remember that the basis support for writing sorts is pretty > general. > > Suppose I had time to do this.=C2=A0 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