8

I am using org-mode to organize my life. I got used to planning with DEADLINE. Additionally, I am using Effort property to predict how much effort that I have to show to finish all tasks.

org-agenda-columns C-c C-x C-c provide good interface to estimate effort in agenda. org-agenda shows today tasks, but it also shows future and overdue tasks at the same view like below in the picture. So, it makes really hard to understand how many hours that I have to spend today because it sums automatically all efforts.

agenda-column-view

I prepared small customized view to show just today tasks as I wanted, but these tasks are filtered with kind of regexp, so that reason, it's not possible to see next or previous days by using org-agenda-earlier and org-agenda-later

TLDR;

Is there any option to show only today's(not overdue and future) tasks in org-agenda?

Things that can help

Example input:

* Main
** Today 1st task
   DEADLINE: <2017-01-25 Wed>
   :PROPERTIES:
   :EFFORT:   01:00
   :END:
**  Today 2nd task
   DEADLINE: <2017-01-25 Wed>
   :PROPERTIES:
   :EFFORT:   00:30
   :END:
** Yesterday Overdue
   DEADLINE: <2017-01-24 Tue>
   :PROPERTIES:
   :EFFORT:   02:00
   :END:
** Future task
   DEADLINE: <2017-01-30 Mon>
   :PROPERTIES:
   :EFFORT:   00:30
   :END:

My non-interactive filter that shows todays tasks

(setq org-agenda-custom-commands
      '(("d" "daily"
         tags "DEADLINE>=\"<today>\"&DEADLINE<=\"<now>\""
         ((org-agenda-sorting-strategy '(todo-state-down)))
         (org-agenda-overriding-header "TODAY tasks"))))

Example Interactive agenda-view that shows just A priority

(add-to-list 'org-agenda-custom-commands
            '("f" agenda ""
              ((org-agenda-skip-function
                (lambda nil
                  (org-agenda-skip-entry-if (quote notregexp) "\\=.*\\[#A\\]")))
               (org-agenda-ndays 0)
               (org-agenda-overriding-header "Today's Priority #A tasks: "))))
3
  • 1
    There are probably a few ways to do this, but I like to set the org-agenda-span to 'day and I set the org-agenda-start-day to a specific date. See the doc-strings for each variable to see the available customizations. I use org-agenda-list to create this particular type of agenda buffer. As you probably know, there are three common functions -- the former mentioned, and org-tags-view and org-search-view.
    – lawlist
    Commented Jan 25, 2017 at 3:28
  • 1
    See also the variable org-deadline-warning-days. If you are doing anything with scheduled entries, you may also be interested in the variable org-scheduled-past-days.
    – lawlist
    Commented Jan 25, 2017 at 3:51
  • I know org-deadline-warning-days. It can be solution to not showing future tasks but still there is not any solution in my mind about overdue tasks. Commented Jan 25, 2017 at 7:05

2 Answers 2

8

COMPATIBLE WITH ORG-MODE 9.0.3

The function org-agenda-skip-deadline-if-not-today is designed to be used in conjunction with the org-agenda-skip-function and an agenda entry in the org-agenda-custom-commands that contains proposed entries such as:

(add-to-list 'org-agenda-custom-commands
             '("b" agenda "Today's Deadlines"
               ((org-agenda-span 'day)
                (org-agenda-skip-function '(org-agenda-skip-deadline-if-not-today))
                (org-agenda-entry-types '(:deadline))
                (org-agenda-overriding-header "Today's Deadlines "))))
(defun org-agenda-skip-deadline-if-not-today ()
"If this function returns nil, the current match should not be skipped.
Otherwise, the function must return a position from where the search
should be continued."
  (ignore-errors
    (let ((subtree-end (save-excursion (org-end-of-subtree t)))
          (deadline-day
            (time-to-days
              (org-time-string-to-time
                (org-entry-get nil "DEADLINE"))))
          (now (time-to-days (current-time))))
       (and deadline-day
            (not (= deadline-day now))
            subtree-end))))

COMPATIBLE WITH ORG-MODE 8.2.10

Emacs version 25.1 ships with org-mode version 8.2.10. Within said release, there is an undocumented dynamically scoped variable called org-agenda-only-exact-dates, which can be used to accomplish the goal of the original poster. Within the org-agenda-custom-commands, set (org-agenda-only-exact-dates t).

org-agenda-only-exact-dates is used by org-agenda-get-deadlines, which is one of the functions responsible for the behavior the original poster wishes to customize. It is also used by org-agenda-get-scheduled. The function org-timeline is what sets this dynamically scoped variable to t. This answer (above) takes advantage of said variable.

CAVEAT: Many people are using the latest release of org-mode which does not ship with Emacs -- e.g., org-mode version 9.0.4. I grepped 9.0.3 and did not see org-agenda-only-exact-dates used within either org-agenda-get-deadlines or org-agenda-get-scheduled. I'm not sure why the org-mode team removed that variable or whether something else replaced its functionality in the latest release. To the extent that another forum participant would like to research the code of 9.0.4 and post an alternative answer that works with the latest release, please feel free to do so.

6
  • Thanks again for interesting. I have just seen that commit also I'll analyze later it. I am using 9.0.4 so as you say as you remark (org-agenda-only-exact-dates t) doesn't work with org-agenda-custom-commands Commented Jan 25, 2017 at 10:00
  • @itirazimvar -- when you have time, please test the alternative solution that utilizes org-agenda-skip-deadline-if-not-today and let me know if that works with org-mode version 9.0.4. I don't have that version installed on my computer, but I would imagine that it will work just fine.
    – lawlist
    Commented Jan 27, 2017 at 16:01
  • Thanks for your help. Now It works with your skip method as I want. Few days ago I reverted org-mode to 9.0.3. Promise while I am free I'll test and write there how 9.0.4 will react. Even I don't have doubt :) Regards. Commented Jan 28, 2017 at 13:39
  • Now I realized that there is mistake because of current-time variable. The problem is about to see yesterday and tomorrow task when I press f and b. So If you know how to get preferred day of agenda please change if not I can try. Regards. Commented Jan 28, 2017 at 14:06
  • I see the issue with moving forwards and backwards in time. I would suggest launching a new question that references this thread.
    – lawlist
    Commented Jan 28, 2017 at 16:53
4

I am answering my question that I asked long time ago.

A new package which name orq-ql is also lead us to desired situation.

Additionally provides many like filtering, ordering etc on-the-fly.

You can use code block at below, also interactive M-x org-ql-view allow us some default filtering methods.

(org-ql-view "Today")
1
  • Thank you for sharing, is org-ql-view "view" only? or is it editable view?
    – eugene
    Commented Sep 10, 2023 at 10:06

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.