From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: Useful utility function: org-sort-multi Date: Mon, 31 Aug 2009 07:40:42 +0200 Message-ID: <0D40B28E-0CD1-4FD3-9EC9-74BDD14494AC@gmail.com> References: <4A988678.6020202@gmail.com> <87ab1hsnte.fsf@gmail.com> <4A9AE751.2080208@thompsonclan.org> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mi0j6-0000oC-Kh for emacs-orgmode@gnu.org; Mon, 31 Aug 2009 02:50:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mi0j3-0000lq-64 for emacs-orgmode@gnu.org; Mon, 31 Aug 2009 02:50:52 -0400 Received: from [199.232.76.173] (port=47371 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mi0j2-0000lj-LT for emacs-orgmode@gnu.org; Mon, 31 Aug 2009 02:50:48 -0400 Received: from mail-ew0-f211.google.com ([209.85.219.211]:47075) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mi0j1-0007Oz-VB for emacs-orgmode@gnu.org; Mon, 31 Aug 2009 02:50:48 -0400 Received: by mail-ew0-f211.google.com with SMTP id 7so3621242ewy.31 for ; Sun, 30 Aug 2009 23:50:47 -0700 (PDT) In-Reply-To: <4A9AE751.2080208@thompsonclan.org> 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: "Ryan C. Thompson" Cc: emacs-orgmode@gnu.org Hi Ryan, hi Benjamin Yes, I think I was mistaken, I firth though this would not work correctly with more that 2 criteria, but I think now that it does in fact work. While I think about the if and how to add this, you might just want to go ahead and add it to the org-hacks.org file on Worg..... - Carsten On Aug 30, 2009, at 10:55 PM, Ryan C. Thompson wrote: > Benjamin Andresen wrote: > >> if you have the following list >> * Test Sorting >> ** TODO Charlie >> ** WAITING Beta >> ** TODO Alpha >> ** STARTED Beta >> ** STARTED Charlie >> ** TODO Beta >> ** STARTED Alpha >> ** WAITING Charlie >> ** WAITING Alpha > >> calling org-multi-sort with ?o ?a will sort it like this >> * Test Sorting >> ** TODO Alpha >> ** TODO Beta >> ** TODO Charlie >> ** STARTED Alpha >> ** STARTED Beta >> ** STARTED Charlie >> ** WAITING Alpha >> ** WAITING Beta >> ** WAITING Charlie > >> but just ?a would completely ignore the TODO, STARTED, WAITING order. > >> Thanks Ryan, pretty useful. > > >> br, >> benny > > >> _______________________________________________ >> Emacs-orgmode mailing list >> Remember: use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > That's right, the function relies on the fact that org's sorting is > stable. So the results of earlier sorts are preserved as much as > possible in later sorts. Of course, this is really inefficient, but > oh well. > > As another test case, try using (org-sort-multi ?o ?p) on this: > * Multi-sort test > ** DONE [#B] > ** TODO [#C] > ** STARTED [#C] > ** STARTED [#A] > ** DONE [#C] > ** TODO [#B] > ** TODO [#A] > ** STARTED [#B] > ** DONE [#A] > > > Anyway, Carsten, if you think this would be useful, feel free to > include some variant of this in org-mode itself. You'd probably want > to implement it as a one-pass sort in which the set of sorting > criteria function as a series of fallbacks for tiebreakers, rather > than a series of sorts. > > Ryan > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode