1

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?

1 Answer 1

0

The docstring of org-agenda-use-tag-inheritance says that:

In tags/tags-todo/tags-tree agenda views, tag inheritance is controlled by org-use-tag-inheritance.

Both of these work as expected even when org-use-tag-inheritance is non-nil globally:

(setq org-agenda-custom-commands
      '(("y" tags "tag1|tag2"
         ((org-use-tag-inheritance nil)))))

(setq org-agenda-custom-commands
      '(("Y" tags-tree "tag1|tag2"
         ((org-use-tag-inheritance nil)))))
2
  • I see you're setting this in code above, but do you have recommendations for how to use the Customize UI for Org Agenda Custom Commands? I am trying to use a local setting > "any variable" > and then org-use-tag-inheritance as nil, but I don't see the changes taking effect. Jun 14, 2023 at 16:55
  • Disregard, forgot to quote the value. For others, this works if you set this variable within the Customize UI with a "any variable" local setting as 'org-use-tag-inheritance set to nil Jun 14, 2023 at 18:16

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.