Writing shorter CALT, needs advice!

Hi, lets say in arabic i want to use CALT to replace alef-ar by alef-ar.001 only if lam-ar.init comes after it, but even if any glyph from the @tashkeel class (Diacritics) came between them…

The easy way is to write it in two lines:
sub alef-ar' lam-ar.init by alef-ar.001;
sub alef-ar' @tashkeel lam-ar.init by alef-ar.001;

But can i write it in just one line?
I tried:
sub alef-ar' [lam-ar.init [@tashkeel lam-ar.init]] by alef-ar.001;

but it would not compile :relieved: Is there a way for it to be in one line?

Any idea?

That is what the ‘lookupflag IgnoreMarks’ is for. Then you only need the first substitution line.

If you put stuff in square brackets [], it is a class, so it represents one glyph and the order does not matter. A contextual run over a different number of glyphs (in your case 1 vs. 2) must be two separate rules.

But in this particular case, the IgnoreMarks flag is a better idea, as Georg pointed out.

Thanks guys, so it seems like i always need to write these in two lines.

I would suggest just this:

lookupflag IgnoreMarks;
sub alef-ar' lam-ar.init by alef-ar.001;

And you don’t need to define the tashkeel class.