From: "Ryan C. Thompson" <rct@thompsonclan.org>
Cc: org-mode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: Useful utility function: org-sort-multi
Date: Sun, 30 Aug 2009 13:55:45 -0700 [thread overview]
Message-ID: <4A9AE751.2080208@thompsonclan.org> (raw)
In-Reply-To: <87ab1hsnte.fsf@gmail.com>
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
next prev parent reply other threads:[~2009-08-30 21:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-29 1:38 Useful utility function: org-sort-multi Ryan C. Thompson
2009-08-30 8:09 ` Carsten Dominik
2009-08-30 8:33 ` Benjamin Andresen
2009-08-30 20:55 ` Ryan C. Thompson [this message]
2009-08-31 5:40 ` Carsten Dominik
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=4A9AE751.2080208@thompsonclan.org \
--to=rct@thompsonclan.org \
--cc=emacs-orgmode@gnu.org \
/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).