From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ryan Thompson Subject: Re: org-sort-multi?? Date: Fri, 29 Jan 2010 08:51:50 -0800 Message-ID: <2a4ba2fd1001290851q4b3a01d7sb6f9e0f00d67ae94@mail.gmail.com> References: <20100128224908.D33F8320056@mail.dagertech.net> <3E25C708-CE63-40EB-B6F3-EFE9C62033A4@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0710588928==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nau4w-0007dY-EH for emacs-orgmode@gnu.org; Fri, 29 Jan 2010 11:52:18 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Nau4r-0007dE-Ov for emacs-orgmode@gnu.org; Fri, 29 Jan 2010 11:52:17 -0500 Received: from [199.232.76.173] (port=46262 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nau4r-0007dB-9Z for emacs-orgmode@gnu.org; Fri, 29 Jan 2010 11:52:13 -0500 Received: from mail-iw0-f188.google.com ([209.85.223.188]:62144) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nau4q-0002tM-Bs for emacs-orgmode@gnu.org; Fri, 29 Jan 2010 11:52:12 -0500 Received: by iwn26 with SMTP id 26so2704383iwn.14 for ; Fri, 29 Jan 2010 08:52:10 -0800 (PST) In-Reply-To: <3E25C708-CE63-40EB-B6F3-EFE9C62033A4@gmail.com> 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: Carsten Dominik Cc: Org-Mode List , "David A. Gershman" --===============0710588928== Content-Type: multipart/alternative; boundary=0016e64079aedffa96047e507492 --0016e64079aedffa96047e507492 Content-Type: text/plain; charset=ISO-8859-1 Hi. Anyone can freely use any code I post here for any purpose, unless I specifically say otherwise for a particular piece of code (I can't think of any reason why would do this, though). I've included the code for org-sort-multi below. Carsten is correct, it is not an interactive function. In fact, it isn't really meant to be used directly at all in its current form. I use it for defining specific custom sort functions, of which I have also given an example below. (defun org-sort-multi (&rest sort-types) "Sort successively by a list of criteria. For example, sort first by TODO status, then by priority, then by date, then alphabetically, case-sensitive. Each criterion is either a character or a cons pair (BOOL . CHAR), where BOOL is whether or not to sort case-sensitively, and CHAR is one of the characters defined in ``org-sort-entries-or-items''. So, the example above could be accomplished with: (org-sort-multi ?o ?p ?t (t . ?a))" (mapc #'(lambda (sort-type) (org-sort-entries-or-items (car-safe sort-type) (or (cdr-safe sort-type) sort-type))) (reverse sort-types))) (defun org-sort-custom () "Sort children of node by todo status and by priority, so the * TODO [#A] items go to the top. Then fold it the way I like it." (interactive) (org-sort-multi ?o ?p ?T) (dotimes (x 2) (org-cycle))) On Fri, Jan 29, 2010 at 1:23 AM, Carsten Dominik wrote: > Hi David, > > org-sort-multi is a utility function written by Ryan Thompson. > So far it has not made it into Org-mode. I seem to > remember that I did not have a convenient interactive > interface for it, but I am not sure if I remember correctly. > > Another issue is that I am not sure if Ryan has signed the > papers with the FSF, which would be required for this > non-trivial change to Org. > > Why don't you take Ryan's function and play with it, check > if it works for you, and if yes, try to convince me > to add it to Org-mode..? > > Ryan, would you be willing to sign the papers with the FSF? > Did I ask you that before? > > - Carsten > > > > On Jan 28, 2010, at 11:49 PM, David A. Gershman wrote: > > >> Hello Again, >> >> I'm looking to sort my outline (headlines, top level) by multi criteria >> (2 really). I see online references to 'org-sort-multi' as recently as >> August 2009. But my emacs can't find it. >> >> Help? >> >> ---------------------------------------- >> David A. Gershman >> gershman@dagertech.net >> http://dagertech.net/gershman/ >> "It's all about the path!" --d. gershman >> >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Please use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >> > > - Carsten > > > > --0016e64079aedffa96047e507492 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi.

Anyone can freely use any code I post here for any purpose, unle= ss I specifically say otherwise for a particular piece of code (I can't= think of any reason why=A0 would do this, though).

I've include= d the code for org-sort-multi below. Carsten is correct, it is not an inter= active function. In fact, it isn't really meant to be used directly at = all in its current form. I use it for defining specific custom sort functio= ns, of which I have also given an example below.

(defun org-sort-multi (&rest sort-types)
=A0 "Sort successi= vely by a list of criteria.
For example, sort first by TODO status, then= by priority, then by date, then alphabetically, case-sensitive.
Each cr= iterion is either a character or a cons pair (BOOL . CHAR), where BOOL is w= hether or not to sort case-sensitively, and CHAR is one of the characters d= efined in ``org-sort-entries-or-items''.
So, the example above could be accomplished with:
=A0(org-sort-multi ?o = ?p ?t (t . ?a))"
=A0 (mapc #'(lambda (sort-type)
=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 (org-sort-entries-or-items
=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 (car-safe sort-type)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 (or (cdr-safe sort-type) sort-type)))
=A0=A0=A0=A0=A0=A0=A0 (reverse sort-types)))

(defun org-sort-custom = ()
=A0 "Sort children of node by todo status and by priority, so th= e * TODO [#A] items go to the top. Then fold it the way I like it."=A0 (interactive)
=A0 (org-sort-multi ?o ?p ?T)
=A0 (dotimes (x 2) (org-cycle)))

On Fri, Jan 29, 2010 at 1:23 AM, Carsten Domin= ik <carst= en.dominik@gmail.com> wrote:
Hi David,

org-sort-multi is a utility function written by Ryan Thompson.
So far it has not made it into Org-mode. =A0I seem to
remember that I did not have a convenient interactive
interface for it, but I am not sure if I remember correctly.

Another issue is that I am not sure if Ryan has signed the
papers with the FSF, which would be required for this
non-trivial change to Org.

Why don't you take Ryan's function and play with it, check
if it works for you, and if yes, try to convince me
to add it to Org-mode..?

Ryan, would you be willing to sign the papers with the FSF?
Did I ask you that before?

- Carsten



On Jan 28, 2010, at 11:49 PM, David A. Gershman wrote:


Hello Again,

I'm looking to sort my outline (headlines, top level) by multi criteria=
(2 really). =A0I see online references to 'org-sort-multi' as recen= tly as
August 2009. =A0But my emacs can't find it.

Help?

----------------------------------------
David A. Gershman
gershman@dagert= ech.net
http://dagerte= ch.net/gershman/
"It's all about the path!" --d. gershman


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gn= u.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten




--0016e64079aedffa96047e507492-- --===============0710588928== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0710588928==--