Hi, this is my first post here. Sorry for my bad english.
I am the author of https://gitlab.com/lilypond/lilypond/-/merge_requests/2839 and while thinking about tags I had the idea to add just another command named \untag that could be used to remove tags but keep their content. People often are confused, that the \keepWithTag filter leaves the content with its tag. See the following simplified example of https://lists.gnu.org/archive/html/bug-lilypond/2025-12/msg00025.html music = { \tag #'foo c \tag #'bar d } fooMusic = \keepWithTag #'foo \music barMusic = \keepWithTag #'bar \music test = { \tag #'one \fooMusic \tag #'two \barMusic } \score { \keepWithTag #'one \test } This removes alle music, because fooMusic is the same as { \tag #'foo c } and the \keepWithTag #'one removes that. It can be surprising, that \keepWithTag leaves the tag #'foo. What we obviously want is to use the \keepWithTag #'foo to filter the \music and to use \keepWithTag #'one to filter \test, but without filtering the nested \music again. At the moment there are two possible ways to solve the problem. We can specify all the tags we want to keep as a list: \score { \keepWithTag #'(one foo) \test } This is bad, because this means you can't do independent tag filtering with \keepWithTag and have to make all filtering at one place. Another way is to use \tagGroup to create different tag groups for #'(one two) and #'(foo bar). This way you can do independent filtering, but the \tagGroup command works globaly and is difficult to use, if you have multiple bookparts with multiple lilypond files, that have independent tag schemes. I want to introduce another idea that came to my mind. We could have an \untag command that just removes the tags, but keep the content. In our example we could write fooMusic = \untag \keepWithTag #'foo \music barMusic = \untag \keepWithTag #'bar \music fooMusic is now the same as { c } and the tag used for filtering is gone. If we do \score { \keepWithTag #'one \test } it works as expected and leaves the { c }. It could also be useful to give specific tags to \untag so \untag #'foo \music would just be the same as { c \tag #'bar d } If we give no tag or tag list we remove just every tag, but if we specify tags, we just remove these tags. A similar logic could be applied to markup tags. I would add also an \untag markup command that works similar. Does this make sense to you? I can create a merge request and implement it, if you think this is a good idea. Thanks Christoph
