From f0eab43067cf4a82a32b75d4641fcc1c83d1a2ce Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Thu, 22 Apr 2021 23:51:20 -0400 Subject: [PATCH] REF move default sort order fully into config --- etc/conf.org | 26 +++++++++++++++----------- local/lib/org-x/org-x.el | 4 ---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/etc/conf.org b/etc/conf.org index fad547b..d9257e0 100644 --- a/etc/conf.org +++ b/etc/conf.org @@ -2539,17 +2539,21 @@ This gives more flexibility in ignoring items with timestamps By default I want block agendas to sort based on the todo keyword (with NEXT being up top as these have priority). #+BEGIN_SRC emacs-lisp -(setq org-agenda-cmp-user-defined - '(lambda (a b) - (let ((pa (- (length (member - (get-text-property 1 'todo-state a) - org-x-agenda-todo-sort-order)))) - (pb (- (length (member - (get-text-property 1 'todo-state b) - org-x-agenda-todo-sort-order))))) - (cond ((or (null pa) (null pb)) nil) - ((> pa pb) +1) - ((< pa pb) -1))))) +(let* ((sort-order (list org-x-kw-next + org-x-kw-wait + org-x-kw-hold + org-x-kw-todo)) + (get-rank `(lambda (it) + (-> (get-text-property 1 'todo-state it) + (member ',sort-order) + (length) + (-))))) + (setq org-agenda-cmp-user-defined `(lambda (a b) + (let ((pa (funcall ,get-rank a)) + (pb (funcall ,get-rank b))) + (cond ((or (null pa) (null pb)) nil) + ((> pa pb) +1) + ((< pa pb) -1)))))) #+END_SRC ***** custom commands diff --git a/local/lib/org-x/org-x.el b/local/lib/org-x/org-x.el index c5f203d..715217c 100644 --- a/local/lib/org-x/org-x.el +++ b/local/lib/org-x/org-x.el @@ -226,10 +226,6 @@ (list org-x-kw-wait org-x-kw-next) "Projects cannot have these todostates.") -(defconst org-x-agenda-todo-sort-order - (list org-x-kw-next org-x-kw-wait org-x-kw-hold org-x-kw-todo) - "Defines the order in which todo keywords should be sorted.") - (defconst org-x-project-skip-todostates (list org-x-kw-hold org-x-kw-canc) "These keywords override all contents within their subtrees.