0

I can have a custom agenda view that shows all tasks without a date with a custom agenda view defined thus:

'(org-agenda-custom-commands
   (quote
    (("d" "Undated tasks" alltodo ""
      ((org-agenda-todo-ignore-with-date t))))))

I want to refine this further based on tags. So, say, I need to have a custom agenda view of tasks without date and with a tagA. Or I need to have another custom agenda view of tasks without date but without a tagB. Or I need to have yet another custom agenda view of tasks without date and with tagA but without tagB.

How do I achieve that?

1 Answer 1

1

This is what I've used in the past:

(setq org-agenda-custom-commands
      '(("d" "Undated tasks" tags-todo "tagA"
         ((org-agenda-skip-function '(org-agenda-skip-entry-if
                          'deadline 'scheduled 'timestamp))))))

I also got your example to work with a few tweaks:

(setq org-agenda-custom-commands
      '(("d" "Undated tasks" tags-todo "tagA"
         ((org-agenda-tags-todo-honor-ignore-options t)
          (org-agenda-todo-ignore-with-date t)))))

Edit. The above shows you all undated tasks tagged with tagA. It looks like you want all undated tasks as well as tagA (even if tagA has a date). In this case you need:

(defun skip-dated-tasks (&optional tag)
  (save-restriction
    (save-excursion
      (org-narrow-to-subtree)
      (if (or (null (org-get-scheduled-time (point)))
              (and tag (member tag (org-get-tags))))
          nil
        (or (outline-next-heading) (point-max))))))

(setq org-agenda-custom-commands
      '(("d" "Undated tasks" alltodo ""
         ((org-agenda-skip-function (lambda () (skip-dated-tasks "tagA")))))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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