Search code examples
org-mode

How to make agenda view show tasks deadlined tomorrow or another number of days ahead?


I want to make my org agenda view to show separate blocks for tasks deadlined for today, for tomorrow, and for a sertain number of days ahead. I have tried the following code:

(setq org-agenda-custom-commands '(
("d" "deadlined tasks"(      
    (tags-todo "+TODO={NEXT}+DEADLINE>=\"<Today>\" "  (
        (org-agenda-sorting-strategy '(scheduled-down))
        (org-agenda-overriding-header "Deadline today")
        ))
    (tags-todo "+TODO={NEXT}+DEADLINE>=\"<Today>\"+1 "  (
        (org-agenda-sorting-strategy '(scheduled-down))
        (org-agenda-overriding-header "Deadline tomorrow")
        ))
    (tags-todo "+TODO={NEXT}+DEADLINE>=\"<Today>\"+2 "  (
        (org-agenda-sorting-strategy '(scheduled-down))
        (org-agenda-overriding-header "Deadline in two days")
        ))

))

What is wrong in my code? How can I filter out tasks deadlined for n number of days ahead?


Solution

  • You can try org-super-agenda.

    With org-super-agenda, you just need to set:

    (let ((org-super-agenda-groups
           '(;; Each group has an implicit boolean OR operator between its selectors.
             (:name "Deadline Future"
                    :deadline future)))))
    

    For more usages of org-super-ageda, you can check the examples.

    :deadline

    Group items that have a deadline. Argument can be t (to match items with any deadline), nil (to match items that have no deadline), past (to match items with a deadline in the past), today (to match items whose deadline is today), or future (to match items with a deadline in the future). Argument may also be given like before DATE or after DATE where DATE is a date string that org-time-string-to-absolute can process.