Hi, Here is an example Org file:
------------ #+TAGS: [ tag1 : tag2 ] [ tag2 : tag3 ] [ tag3 : tag4 ] * Tag1 :tag1: * Tag2 :tag2: * Tag3 :tag3: * Tag4 :tag4: ------------ Searching headlines by tags works well unless you combine a group tag together with some of its ancestor tags in the query. 1) GOOD - Searching for "tag1" marks all four headlines. 2) GOOD - Searching for "tag3" marks headlines "Tag3" and "Tag4". 3) BAD - Searching for "tag1+tag3" marks just headline "Tag3" providing an incomplete result. Expected result: headlines "Tag3" and "Tag4" are marked. With more complex tag set it may happen quite easily that such a search is done. The bug seems to be in org-tags-expand. (org-tags-expand "tag1") #("{\\<\\(?:tag[1-4]\\)\\>}" 0 20 (grouptag t)) (org-tags-expand "tag3") #("{\\<\\(?:tag[34]\\)\\>}" 0 19 (grouptag t)) (org-tags-expand "tag1+tag3") #("{\\<\\(?:tag[1-4]\\)\\>}+tag3" 0 20 (grouptag t)) In the third invocation "tag3" was left unexpanded. Best regards, Martin Emacs : GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26) of 2018-02-09 Package: Org mode version 9.1.7 (9.1.7-12-g74f6ed-elpaplus @ /home/martin/.emacs.d/elpa/org-plus-contrib-20180305/)