5

I have a few tasks in my agenda that I'd like to complete every day, e.g. SCHEDULED: <2016-04-04 Mon 16:30 +1d>.

Obviously I like to see them in the daily agenda, and that works fine. Here's what I'm using:

(setq org-agenda-custom-commands
      `(
        ;; ...
        ("d" "Daily Action List"
             ((agenda ""
                      ((org-agenda-ndays 1)
                       (org-agenda-sorting-strategy
                        (quote ((agenda time-up priority-down tag-up))))
                       (org-deadline-warning-days 0)))))))

(defun orfu-agenda-day ()
  (interactive)
  (org-agenda nil "d"))

However, when I switch to the weekly view (with w), the daily tasks obscure the whole thing, since each of them is now repeated 7 times.

How could I hide all tasks that have +1d in them from the weekly view? If it helps, I could tag the headings they are in with e.g. :daily: and then the problem would simplify to hiding a single tag from the weekly agenda.

1 Answer 1

5

Conveniently, org-mode has a function to get just the repeat out of an entry's timestamp: org-get-repeat. We just have to put that in a function appropriate for org-agenda-skip-function, that is, it should test if (org-get-repeat) is equal to "+1d" for each headline. IF it is, return the next headline, otherwise return nil to not skip.

(defun skip-daily-tasks () 
  (let ((next-headline (save-excursion (or (outline-next-heading) (point-max))))
        (headline (or (and (org-at-heading-p) (point))
                      (save-excursion (org-back-to-heading)))))
    (if (string= (org-get-repeat) "+1d")
        next-headline
      nil)))

(add-to-list 'org-agenda-custom-commands
             '("w" "Weekly"
               agenda ""
               ((org-agenda-span 'week)
                (org-agenda-skip-function 'skip-daily-tasks))
               ))
1
  • Thanks. It doesn't work with the default d/w switch yet, maybe I'll figure it out later.
    – abo-abo
    Apr 6, 2016 at 14:28

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.