⌂ tag manipulating functions and additional filter by tag functions
If you're using tags frequently, you may find the available functions quite limited.
Here is a collection of additional functions to modify the tags, and to filter by the tags.
tag manipulating:
- \removeAllTags music
returns a copy of the music, where all tags are erased. Thus they will not harm when tags
are created in a higher level and the music is then filtered by \keepWithTag.
- \copyTag from-tag-symbol to-tag-symbol music
returns a copy of the music, where all elements tagged with 'from-tag-symbol' also got
a tag 'to-tag-symbol'.
- \renameTag from-tag-symbol to-tag-symbol music
returns a copy of the music, where the tag names 'from-tag-symbol' are altered into
'to-tag-symbol'.
- \removeTag tag-symbol music
returns a copy of the music, where only the tags 'tag-symbol' are erased, the music is kept.
- \removeTags tag-symbol-list music
similar to '\removeTag', but takes a list to rub out multiple tags from the music.
filtering by tags:
- \keepWithTags tag-symbol-list music
filters the music and keeps all tagged objects, who's tags are listed in the 'tag-symbol-list'.
This 'keep with tag x or y or ...' is such a fundamental idea, it seems to be developed multiple times,
and I heard it will be superseeded by the standard LILYPOND command \keepWithTag in near future.
- \keepOrRemoveWithTag tag-symbol list-of-the-relevant-tag-symbols music
keeps all elements tagged by 'tag-symbol', but it only removes tagged elements out of the 'list-of-the-relevant-tag-symbols'.
Thus, this list is an limitation which tags to check. This list my include the 'tag-symbol' which to keep.
- \taggedRep start-tag-symbol end-tag-symbol rep-count-integer music
is allmost an "\repeat unfold" command. In the first repetition the elements tagged with 'start-tag-symbol' will be kept
while the ones with 'end-tag-symbol' will be removed. In the last repetition it's inverted and only the 'end-tag-symbol' tagged
elements will be kept while those with 'start-tag-symbol' will be removed. In all repetitions between both tagged elements
will be removed.
combined funtions:
- \cleansedKeepOrRemoveWithTag tag-symbol list-of-the-relevant-tag-symbols music
Additional to \keepOrRemoveWithTag all the tags listed in 'list-of-the-relevant-tag-symbols' will be removed from the result
to reduce the chance of side effects when the music is filtered again.
- \cleansedTaggedRep start-tag-symbol end-tag-symbol rep-count-integer music
Additional to \taggedRep the two tags 'start-tag-symbol' and 'end-tag-symbol' will be removed from the result
to reduce the chance of side effects when the music is filtered again.
- \keepPart music, \keepScore music and \keepMidi music
These are predefined \cleansedKeepOrRemoveWithTag commands. The list of the relevant tag symbols is stored in
the Parameter PSM = #'(Part Score Midi); their name shows which tag they keep.