4

I want to use org-agenda to show todo's with scheduled date or deadline date within at certain time interval. For instance, I want to show todo's with deadline between today and one week ahead (today +7d). I have tried to do this by the following code:

 (setq org-agenda-custom-commands '(
   ("d" "daily "(
     (tags-todo "+DEADLINE>=\"<today>\" +DEADLINE<=\"<today + 7d>\" (
        (org-agenda-sorting-strategy '(todo-state-down))
        ))
  ))))

But the code does not give what I want, instead my agenda show all todo's with deadline in the future, not only those with deadline between today and one week forward. How can I make org-agenda only show todo's for a certain time interval? Thanks for any answer :)

8
  • I suggest you have a look at column-view to see if one of the settings will give you the information you seek: orgmode.org/manual/Column-view.html#Column-view It is basically an overlay grid with additional details that can be customized -- it is displayed on top of the *Org-Agenda* buffer without modifying what's underneath. I've only played a bit with that option, so I'm not sure as to its full potential.
    – lawlist
    Commented May 4, 2016 at 1:56
  • I am not sure I understand how the column-view will answer my question. I use column-view when I want to see explicitly property data for todo
    – myotis
    Commented May 4, 2016 at 20:11
  • I may have misunderstood the question -- I thought you were seeking a certain visual appearance of a search result. Based on your comment and after reading the question again, it appears you are seeking a particular search result without the need for any special/different visual appearance. I apologize for the erroneous comment above. You may try using org-agenda-list instead of org-tags-view -- the former is specifically designed for a span of time from 1 day to infinity depending upon the need.
    – lawlist
    Commented May 4, 2016 at 20:17
  • Thanks :) you are right, I seek a particular filter result. Now I see all my todo's in the future, but I do not want to see all of them, just the ones for the next n days.
    – myotis
    Commented May 4, 2016 at 20:20
  • When using org-agenda-list instead of org-tags-view, variables such as org-agenda-start-day and org-agenda-span can control the time frame for which deadlines or scheduled tasks are displayed. A regexp restriction can be added to the search criteria to focus in on certain tags. I haven't played around with org-agenda-filter-by-tag, but that also looks interesting. orgmode.org/manual/Filtering_002flimiting-agenda-items.html Here is the link to the regexp skip/include stuff: orgmode.org/manual/Special-agenda-views.html
    – lawlist
    Commented May 4, 2016 at 20:26

1 Answer 1

4
+50

I don't think that <today + 7d> is a valid time specification — you meant to say <+7d>. Additionally, there's no need to use an embedded list for just one condition. Finally, you're missing a pair of parantheses around the settings.

The following should do what you want:

(setq org-agenda-custom-commands
  '(("d" "daily"
     tags-todo "DEADLINE>=\"<today>\"&DEADLINE<=\"<+7d>\""
     ((org-agenda-sorting-strategy '(todo-state-down))))))
8
  • Thanks, but it does not work. None of my todo's with deadline within the next 7 d show up when using your code.
    – myotis
    Commented May 4, 2016 at 22:18
  • Yes, your code works. It did work when I added the extra pair of parentheses. Why are they needed?
    – myotis
    Commented May 4, 2016 at 22:23
  • My fault, I did not add the parentheses you mentioned :) Now it works! Thanks. Why are the extra pair of parentheses needed?
    – myotis
    Commented May 4, 2016 at 22:24
  • Settings have the same syntax as a let binding: ((opt1 val1) (opt2 val2)...). See the docstring for org-agenda-custom-commands.
    – jch
    Commented May 4, 2016 at 22:25
  • My original code was for block agenda. That is maybe the reason for lacking pair of parenthses. How can your code be changed to a block agenda, for instance having one line for today + 7d and another line for +7d to +14d?
    – myotis
    Commented May 4, 2016 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.