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). 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 #+BEGIN_SRC emacs-lisp
(setq org-agenda-cmp-user-defined (let* ((sort-order (list org-x-kw-next
'(lambda (a b) org-x-kw-wait
(let ((pa (- (length (member org-x-kw-hold
(get-text-property 1 'todo-state a) org-x-kw-todo))
org-x-agenda-todo-sort-order)))) (get-rank `(lambda (it)
(pb (- (length (member (-> (get-text-property 1 'todo-state it)
(get-text-property 1 'todo-state b) (member ',sort-order)
org-x-agenda-todo-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) (cond ((or (null pa) (null pb)) nil)
((> pa pb) +1) ((> pa pb) +1)
((< pa pb) -1))))) ((< pa pb) -1))))))
#+END_SRC #+END_SRC
***** custom commands ***** custom commands

View File

@ -226,10 +226,6 @@
(list org-x-kw-wait org-x-kw-next) (list org-x-kw-wait org-x-kw-next)
"Projects cannot have these todostates.") "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 (defconst org-x-project-skip-todostates
(list org-x-kw-hold org-x-kw-canc) (list org-x-kw-hold org-x-kw-canc)
"These keywords override all contents within their subtrees. "These keywords override all contents within their subtrees.