diacritics: intelligent attachment?

Is there a trick to place combining marks intelligently, without defining each of thousands of possibilities, regardless of the diacritic order?

E.g.
dia.png
Left: a.alt/brevecomb/dotbelowcomb/commaaboverightcomb/horncomb/macronbelowcomb/acutecomb/lightcentralizationstrokebelowcomb/retroflexhookbelowcomb
Right: a.alt/lightcentralizationstrokebelowcomb/brevecomb/acutecomb/dotbelowcomb/macronbelowcomb/horncomb/retroflexhookbelowcomb /commaaboverightcomb

Diacritic placement order in the first instance is chaotic, and in the second instance grouped according to anchors. Is there a way to achieve the same result for the first example? I.e. for the font to know to skip commaaboverightcomb/horncomb and attach macronbelowcomb to dotbelowcomb, and to skip dotbelowcomb/commaaboverightcomb/horncomb/macronbelowcomb and attach acutecomb to brevecomb?

Thank you for your help :slight_smile:

How about changing glyph order? Sth like ab → ba, but using classes?