4

I have an org-mode file separated into multiple categories. I know I can create an agenda command that will show only items from one given category, like so:

("a" "Category A items" agenda ""
      ((org-agenda-category-filter-preset
        (quote
         ("+a")))))

and then only items from category A will show up in the custom agenda view.

How can I configure a custom view so it will show items from two specified categories (e.g. "A" and "B")?

4
+50

You can do complex matching like this easily using org-super-agenda. Install the package with M-x packages-install org-super-agenda then load it using

(use-package org-super-agenda
  :config
  (org-super-agenda-mode t))

Then set the agenda groups to show things in CATEGORY A, things in CATEGORY B and finally discard anything else:

(add-to-list 'org-agenda-custom-commands
             '("a" "Category A or B" agenda ""
              ((org-super-agenda-groups
                '((:category ("A"))
                  (:category ("B"))
                  (:discard (:anything))
                  ))
                )))
  • 1
    org-super-agenda ended up solving my problem. I used a (:category "A" :category "B") merge tasks from both categories into a single agenda – Kuba Orlik Feb 1 at 10:42
0

You can add multiple filters to a single agenda item by making the type a list of matches.

("c" "Category A and B items" ((agenda "" (org-agenda-category-filter-preset
                                       (quote
                                        ("+a"))))
                           (agenda "" (org-agenda-category-filter-preset
                                       (quote
                                        ("+b"))))))

Look in the org manual for more details.

  • This creates a multi-block view. I should have mentioned it in the question, but I'm looking for a solution to merge the two categories into one agenda – Kuba Orlik Feb 1 at 10:33

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.