REF move default sort order fully into config

This commit is contained in:
Nathan Dwarshuis 2021-04-22 23:51:20 -04:00
parent b1d116a5bf
commit f0eab43067
2 changed files with 15 additions and 15 deletions

View File

@ -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)))))
(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)))))
((< pa pb) -1))))))
#+END_SRC
***** custom commands

View File

@ -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.