Following David Kastrup's suggestion, I wrote some hopefully simple examples for \pushToTag and \appendToTag.
I paid the maximum attention to make this code simple and clear but I'm sure it contains millions of errors etc. etc.
It's just a starting point. I hope it can be useful.
Nota bene: I didn't yet add any examples that take advantage of David new possibilities:
\pushToTag #'here ~ \music
I will do it as soon as this feature will be included in a new lilypond version.
To test the code, just copy and paste the code inside Frescobaldi or use the attached file.
P.S. I would have liked to add a screenshot of the generated output immediately after each piece of code.
This would make this much more interesting, easy to follow and discuss. But I remember that on this mailing list pictures have to be attached and not put inside the mail.
Let me know if the "mailing list good practices" have changed.
%%%%%%%%%%%%%%%%%%%%%%%
\markup {"Simple \appendToTag with {}"}
\version "2.23.2"
music = {c'1 \tag #'here {} c''1}
{\music}
{\appendToTag #'here g'1 \music}
{\pushToTag #'here g'1 \music}
{\appendToTag #'here {e'4 f' g' a'} \music}
{\pushToTag #'here {e'4 f' g' a'} \music}
\markup {"Nested \appendToTag with {}"}
\version "2.23.2"
music = {c'1 \tag #'here {} c''1}
{\music}
{\appendToTag #'here d'4 \appendToTag #'here e'4 \appendToTag #'here f'4 \appendToTag #'here g' \music}
{\pushToTag #'here d'4 \pushToTag #'here e'4 \pushToTag #'here f'4 \pushToTag #'here g' \music}
\markup {"\appendToTag with {} and multiple different tag"}
\version "2.23.2"
music = {c'4 d' e' f' \tag #'firstLocation {}
g' a' b' c'' \tag #'secondLocation {} }
{\music}
{\appendToTag #'secondLocation {d''2 e''} \appendToTag #'firstLocation {g'4 f' g' f'} \music}
\markup {"\appendToTag with {} and multiple equal tag"}
\version "2.23.2"
music = {c'4 d' e' f' \tag #'firstLocation {}
g' a' b' c'' \tag #'firstLocation {}
b' a' g' f' \tag #'firstLocation {} }
{\music}
{\appendToTag #'firstLocation {g'2 r} \music}
% I don't see any good reason to use the following.
% It mix different things making everything a bit more complex
% to understand withouth any advantage (imho).
% That's why I'm not sure it makes sense to show it.
\markup {"\appendToTag with {some music}"}
\version "2.23.2"
music = {c'1 \tag #'here {d'2 e'} c''1}
{\music}
{\pushToTag #'here {f'4 g' a' b'} \music}
{\appendToTag #'here {f'4 g' a' b'} \music}
\markup {"\appendToTag with <>"}
\version "2.23.2"
music = {c'1 \tag #'here <> c''1}
{\music}
{\appendToTag #'here e'1 \music}
{\pushToTag #'here e'1 \music}
\markup {"nested \appendToTag with <>"}
\version "2.23.2"
music = {c'1 \tag #'here <> c''1}
{\music}
{\appendToTag #'here e'1 \appendToTag #'here g'1 \appendToTag #'here b'1 \music}
{\pushToTag #'here e'1 \pushToTag #'here g'1 \pushToTag #'here b'1 \music}
% {\appendToTag #'here <e' g' b'>1 \music} % Doesn't work. Adding a chord to a chord is not defined/allowed
% {\appendToTag #'here {e'1 g'1 b'1} \music} % Doesn't work. Adding a compound music _expression_ to a chord not defined/allowed
\markup {"\appendToTag with <c' e'>"}
\version "2.23.2"
music = {c'1 \tag #'here <c' e'>1 c''1}
{\music}
{\appendToTag #'here g'1 \appendToTag #'here b'1 \music}
% {\appendToTag #'here g'4 \music} % Doesn't work. Adding a 4 duration note to a 1 duration chord is not defined/allowed
\markup {"\appendToTag with 'multiple' <>"}
\version "2.23.2"
music = {\tag #'here <c' e' g'>4 \tag #'here <c' e'> \tag #'here <c'> \tag #'here <>}
{\music}
{\appendToTag #'here b'4 \appendToTag #'here d''4 \music}