I want to create Org Mode agenda views or sparse trees with tag inheritance disabled so that tagged headlines are included but children are not. I do not want to turn off tag inheritance globally. I thought this could be accomplished by setting options for custom commands, as in the following example:
(setq org-agenda-custom-commands '(("y" tags "tag1|tag2" ((org-agenda-use-tag-inheritance nil)))))
However, the resulting agenda view includes all children of the tagged headlines. The desired result can be achieved by disabling tag inheritance globally,
(setq org-use-tag-inheritance nil), but I do not want to disable tag inheritance globally, only for the agenda custom command.
Alternatively I have tried to create the same filter using a sparse tree:
(setq org-agenda-custom-commands '(("Y" tags-tree "tag1|tag2" ((org-show-context-detail 'minimal)))))
But this returns a sparse tree including all children and ancestors of the tagged headlines. Again, if I disable tag inheritance globally I achieve the desired result. What am I am missing?