From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Egli Christian (KIRO 41)" Subject: [Patch] Sort agenda items by todo-state Date: Wed, 21 Nov 2007 13:13:09 +0100 Message-ID: <52D89C75FEE9444E8D9C016E3730098306CE6B@chsa1036.share.beluni.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C82C37.E193928E" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IuoSI-0004Ef-O8 for emacs-orgmode@gnu.org; Wed, 21 Nov 2007 07:13:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IuoSI-0004EF-3X for emacs-orgmode@gnu.org; Wed, 21 Nov 2007 07:13:22 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IuoSH-0004E2-SD for emacs-orgmode@gnu.org; Wed, 21 Nov 2007 07:13:21 -0500 Received: from mail-gw13.credit-suisse.com ([198.240.213.22]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1IuoSH-0002Qu-8M for emacs-orgmode@gnu.org; Wed, 21 Nov 2007 07:13:21 -0500 Content-class: urn:content-classes:message 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: emacs-orgmode@gnu.org This is a multi-part message in MIME format. ------_=_NextPart_001_01C82C37.E193928E Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C82C37.E193928E" ------_=_NextPart_002_01C82C37.E193928E Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable * Introduction I live in my org agenda view and I schedule all my tasks to the day that I want to do them. I also would like to see my achievements so I keep the TODOs that are done in the agenda view. However I would like them to get out of the way so that I can better see the tasks that are still open. That is why for a long time I've been wanting to sort the agenda items by todo state. =20 * Patch I finally looked at the code and realized that this was not very hard to do. The following patch (against 5.13i) implements a new org-agenda-sorting-strategy that allows you to sort agenda items by todo-state. =20 * Notes The patch is basically a "works-for-me" implementation. It only sorts todo and scheduled items. It should probably do the same for deadlines. Maybe even for timestamps?=20 =20 The doc strings need to be updated. =20 Carsten at one time talked about implementing this feature by using priorities, i.e. factoring the todo-state into the priority (which uses the actual priority plus some calculation based on how many days the task is overdue). This patch takes a different route. =20 The sorting is done by comparing the todo-state of the items. It first orders them by done state, i.e. all done items come after (or before) the items that are not done. After that it compares the todo-states with a string compare. This should probably use some kind of ordering information from the relevant org-todo-keywords sequence. =20 * Conclusion So the basic question is: Should I clean up this patch to get it included? Is the proposed route (of not taking the priorities) ok? And finally: How do I sort taking the sequence order into consideration? =20 Christian <>=20 ------_=_NextPart_002_01C82C37.E193928E Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [Patch] Sort agenda items by todo-state

* Introduction
  I live in my org agenda view = and I schedule all my tasks to the
  day that I want to do them. I = also would like to see my
  achievements so I keep the = TODOs that are done in the agenda
  view. However I would like them = to get out of the way so that I
  can better see the tasks that = are still open. That is why for a
  long time I've been wanting to = sort the agenda items by todo
  state.
 
* Patch
  I finally looked at the code = and realized that this was not very
  hard to do. The following patch = (against 5.13i) implements a new
  org-agenda-sorting-strategy = that allows you to sort agenda items
  by todo-state.
 
* Notes
  The patch is basically a = "works-for-me" implementation. It only
  sorts todo and scheduled items. = It should probably do the same
  for deadlines. Maybe even for = timestamps?
 
  The doc strings need to be = updated.
 
  Carsten at one time talked = about implementing this feature by
  using priorities, i.e. = factoring the todo-state into the priority
  (which uses the actual priority = plus some calculation based on
  how many days the task is = overdue). This patch takes a different
  route.
 
  The sorting is done by = comparing the todo-state of the items. It
  first orders them by done = state, i.e. all done items come after
  (or before) the items that are = not done. After that it compares
  the todo-states with a string = compare. This should probably use
  some kind of ordering = information from the relevant
  org-todo-keywords = sequence.
 
* Conclusion
  So the basic question is: = Should I clean up this patch to get it
  included? Is the proposed route = (of not taking the priorities)
  ok? And finally: How do I sort = taking the sequence order into
  consideration?
   
Christian


= <<org.diff>>

------_=_NextPart_002_01C82C37.E193928E-- ------_=_NextPart_001_01C82C37.E193928E Content-Type: application/octet-stream; name="org.diff" Content-Transfer-Encoding: base64 Content-Description: org.diff Content-Disposition: attachment; filename="org.diff" ZGlmZiAtYyAvaG9tZS9lZ2xpL0Rlc2t0b3Avb3JnLmVsLm9yaWcgL2hvbWUvZWdsaS9EZXNrdG9w L29yZy5lbA0KKioqIC9ob21lL2VnbGkvRGVza3RvcC9vcmcuZWwub3JpZwkyMDA3LTExLTIxIDA3 OjU2OjExLjAwMDAwMDAwMCArMDEwMA0KLS0tIC9ob21lL2VnbGkvRGVza3RvcC9vcmcuZWwJMjAw Ny0xMS0yMSAwODowMDoyNS4wMDAwMDAwMDAgKzAxMDANCioqKioqKioqKioqKioqKg0KKioqIDI1 NDcsMjU1MyAqKioqDQogIAkgKGNvbnN0IHRpbWUtdXApIChjb25zdCB0aW1lLWRvd24pDQogIAkg KGNvbnN0IGNhdGVnb3J5LWtlZXApIChjb25zdCBjYXRlZ29yeS11cCkgKGNvbnN0IGNhdGVnb3J5 LWRvd24pDQogIAkgKGNvbnN0IHRhZy1kb3duKSAoY29uc3QgdGFnLXVwKQ0KISAJIChjb25zdCBw cmlvcml0eS11cCkgKGNvbnN0IHByaW9yaXR5LWRvd24pKSkpDQogIA0KICAgIChkZWZjdXN0b20g b3JnLWFnZW5kYS1zb3J0aW5nLXN0cmF0ZWd5DQogICAgICAnKChhZ2VuZGEgdGltZS11cCBjYXRl Z29yeS1rZWVwIHByaW9yaXR5LWRvd24pDQotLS0gMjU0NywyNTU0IC0tLS0NCiAgCSAoY29uc3Qg dGltZS11cCkgKGNvbnN0IHRpbWUtZG93bikNCiAgCSAoY29uc3QgY2F0ZWdvcnkta2VlcCkgKGNv bnN0IGNhdGVnb3J5L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dvcnktdXAgKzEgbmlsKSkNCiAgCSAodGFnLXVwIChvcmctY21wLXRhZyBh IGIpKQ0KISAJICh0YWctZG93biAoaWYgdGFnLXVwICgtIHRhZy11cCkgbmlsKSkpDQogICAgICAo Y2RyIChhc3NvYw0KICAJICAoZXZhbCAoY29ucyAnb3Igb3JnLWFnZW5kYS1zb3J0aW5nLXN0cmF0 ZWd5LXNlbGVjdGVkKSkNCiAgCSAgJygoLTEgLiB0KSAoMSAuIG5pbCkgKG5pbCAuIG5pbCkpKSkp KQ0KLS0tIDIwNjM1LDIwNjQzIC0tLS0NCiAgCSAoY2F0ZWdvcnktZG93biAoaWYgY2F0ZWdvcnkt dXAgKC0gY2F0ZWdvcnktdXApIG5pbCkpDQogIAkgKGNhdGVnb3J5LWtlZXAgKGlmIGNhdGVnb3J5 LXVwICsxIG5pbCkpDQogIAkgKHRhZy11cCAob3JnLWNtcC10YWcgYSBiKSkNCiEgCSAodGFnLWRv d24gKGlmIHRhZy11cCAoLSB0YWctdXApIG5pbCkpDQohIAkgKHRvZG8tc3RhdGUtdXAgKG9yZy1j bXAtdG9kby1zdGF0ZSBhIGIpKQ0KISAJICh0b2RvLXN0YXRlLWRvd24gKGlmIHRvZG8tc3RhdGUt dXAgKC0gdG9kby1zdGF0ZS11cCkgbmlsKSkpDQogICAgICAoY2RyIChhc3NvYw0KICAJICAoZXZh bCAoY29ucyAnb3Igb3JnLWFnZW5kYS1zb3J0aW5nLXN0cmF0ZWd5LXNlbGVjdGVkKSkNCiAgCSAg JygoLTEgLiB0KSAoMSAuIG5pbCkgKG5pbCAuIG5pbCkpKSkpKQ0KDQpEaWZmIGZpbmlzaGVkLiAg V2VkIE5vdiAyMSAwODowMDozNiAyMDA3DQo= ------_=_NextPart_001_01C82C37.E193928E Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 ------_=_NextPart_001_01C82C37.E193928E--