Update: The same happens when I run org-agenda-filter and enter +work+home. The agenda is empty. Entering only work or home works, also excluding multiple tags with -work-calendar works fine.

My custom agenda setting "Work and Home" looks like this (org-agenda-category-filter-preset '("+work" "+home"))

But when I call this agenda, it is empty.

Having only one category works though:

(org-agenda-category-filter-preset '("+work"))


(org-agenda-category-filter-preset '("+home"))

Multiple exclusions work, too:

(org-agenda-category-filter-preset '("-home" "-calendar"))

What am I missing?

org-version: 9.3, emacs-version 27.1

  • Does this help? emacs.stackexchange.com/a/47437/21118
    – jjk
    Jul 31 at 10:45
  • @412p9wej If there is no solution to this in vanilla org-agenda, I will give org-super-agenda a try. Thanks for the suggestion! Jul 31 at 11:51
  • I'm not quite sure what you are looking for: my answer tries to explain why the chosen implementation will not work (and that's before you pointed out that neither org-agenda-filter nor org-agenda-category-filter-preset can hack the general searches I was talking about), but I also added a block agenda setting that might be what you are looking for. If it is not, maybe you can edit the question and specify more precisely what you want to do and why the block agenda does not meet your requirements.
    – NickD
    Aug 1 at 0:46
  • @NickD: Agenda blocks separate the category tasks, whereas just filtering the categories lets you integrate multiple categories in one agenda "time view". Aug 1 at 16:16

You are asking for entries that are tagged with both tags. Do you have any such entries? It seems more likely that the two categories are mutually exclusive. In that case, you get no results because there are no entries with both tags, and the implied operator is & (i.e. AND). The "Matching tags and properties" section of the manual (which you can get to with C-h i g (org)Matching tags and properties) says the following:

A search string can use Boolean operators ‘&’ for AND and ‘|’ for OR. ‘&’ binds more strongly than ‘|’. Parentheses are currently not implemented. Each element in the search is either a tag, a regular expression matching tags, or an expression like ‘PROPERTY OPERATOR VALUE’ with a comparison operator, accessing a property value. Each element may be preceded by ‘-’ to select against it, and ‘+’ is syntactic sugar for positive selection. The AND operator ‘&’ is optional when ‘+’ or ‘-’ is present. Here are some examples, using only tags.


Select headlines tagged ‘work’, but discard those also tagged ‘boss’.


Selects lines tagged ‘work’ or ‘laptop’.

So, if you want to find entries that have either tag, then the search should be +home|+work or home|work as in the second example above.

That works e.g with m (org-tags-list) from the agenda menu, but it doesn't work with the severely limited forms of search that are implemented by org-agenda-filter: this function applies each successive tag as a filter, so it implicitly does an AND. Similarly for org-agenda-category-preset-filter.

But the OP mentions a custom agenda setting, so I wonder if the question is an X-Y question: if so, it may be that the chosen implementation should be abandoned and a different implementation be substituted in its place.

One possibility is the super-agenda package as mentioned in the comments. But it may be that a custom block agenda would satisfy the OP's requirements, e.g.:

(setq org-agenda-custom-commands
      '(("H" "Home- and Work-related tasks"
         ((agenda "")
          (tags "home")
          (tags "work")))))

as discussed in the "Block agenda" section of the manual, which you can get to with C-h i g (org)Block agenda.

  • Hi NIck, this makes absolutely sense in theory. I do understand now why the multiple category exclusion does work. Unfortunately neither of the following things work in my settings: (org-agenda-category-filter-preset '("+home|+work")), (org-agenda-category-filter-preset '("+home"|"+work")) and also running org-agenda-filter and entering +home|+work or home|work does not show the desired agenda with both categories. Jul 31 at 22:21
  • Yes, sorry - neither of these methods can handle general searches: they seem to only handle single tags. org-agenda-filter adds a filter to select or exclude on each iteration, so it implicitly does an AND operation. OTOH, org-tags-view (m in the agenda menu) can handle the general form.
    – NickD
    Aug 1 at 0:05
  • I added a block agenda that might be what you are looking for.
    – NickD
    Aug 1 at 0:47
  • Good suggestions! I find peace, knowing, that it's not possible the straightforward way ;-) For now I work around with excluding everything but the categories I need. I may try block agendas and org-super-agenda for more sophisticated queries. Aug 1 at 16:13
  • Here's a question about OR in agenda searches that might be closer to what you are looking for: emacs.stackexchange.com/questions/35920/… - I haven't looked at it closely enough to make sure, but I figured I'd point it out.
    – NickD
    Aug 4 at 23:36

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.