emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] sort TODO entries more usefully
Date: Sun, 25 May 2014 08:32:09 +0200	[thread overview]
Message-ID: <87mwe65pxy.fsf@bzg.ath.cx> (raw)
In-Reply-To: <8738fyctic.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 25 May 2014 13:33:15 +0800")

[-- Attachment #1: Type: text/plain, Size: 894 bytes --]

Hi Eric,

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> For some reason I've been sorting lots of TODOs recently, and found the
> default behavior of org-sort-entries a little odd. It sorts according to
> the order found in org-todo-keywords-1, which apparently just comes from
> the order the keywords were scanned during setup. I don't think that's
> all that useful, so the attached patch sorts first by
> org-not-done-keywords vs org-done-keywords, then alphabetically.
> Headings with no keywords sort "big".

I don't think the alphabetical order is very useful here, and putting
headlines without TODO keywords first when sorting by TODO order is
counter-intuitive at least.

Let me suggest the attached patch instead: it puts TODO entries, then
entries without a TODO keyword, then DONE entries.

Would it be an improvement?

For specific needs, there is always C-c ^ f

Thanks,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-todo-sort-done-at-the-end.patch --]
[-- Type: text/x-diff, Size: 592 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index dc223b4..f2963b2 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8904,8 +8904,9 @@ When sorting is done, call `org-after-sorting-entries-or-items-hook'."
 	     (or (org-entry-get nil property) ""))
 	    ((= dcst ?o)
 	     (if (looking-at org-complex-heading-regexp)
-		 (- 9999 (length (member (match-string 2)
-					 org-todo-keywords-1)))))
+		 (let* ((m (match-string 2))
+			(s (if (member m org-done-keywords) '- '+)))
+		   (- 99 (funcall s (length (member m org-todo-keywords-1)))))))
 	    ((= dcst ?f)
 	     (if getkey-func
 		 (progn

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

  reply	other threads:[~2014-05-25  6:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-25  5:33 [PATCH] sort TODO entries more usefully Eric Abrahamsen
2014-05-25  6:32 ` Bastien [this message]
2014-05-25 11:51   ` Eric Abrahamsen
2014-05-26  5:10     ` Bastien

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=87mwe65pxy.fsf@bzg.ath.cx \
    --to=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /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).