emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Useful utility function: org-sort-multi


From: Ryan C. Thompson
Subject: [Orgmode] Re: Useful utility function: org-sort-multi
Date: Sun, 30 Aug 2009 13:55:45 -0700
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

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.
address@hidden
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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]