> 1) js-mode uses (widen) at the beginning of js-indent-line, and then calls
Depending on how multi-major-mode works, widen is not necessarily
a problem. Clearly, it would need to hook into syntax-ppss.
> 2) sgml-indent-line calls sgml-parse-tag-backward, which does
> (re-search-backward "[<>]"), finds "<" and performs simple regexp check.
> Thus, <% if a < 3 %> breaks indentation on following lines, until first
> closing tag.
I think we can treat this as a bug in sgml-indent-line, which should try
and use syntax-ppss or something like that instead of regexps.
>> Of course, tweaking some parts of the C mode might help. E.g. we could
>> maybe extend syntax-tables slightly so that chunk boundaries are marked
>> with a special syntax-table value which then makes forward-comment skip
>> over "other language" chunks, so that any indentation code which
>> consistently ignores comments would then work in multi-major-mode.
> Did you mean to write "C code" in the first sentence?
Yes, indeed, sorry.
> As far as I can see, enhanced (forward-comment) won't help much with
It would, if you combine it with parse-sexp-ignore-comments.
> And crossing two boundaries won't necessarily mean that we're in a chunk
> in the same mode (or we're limited to supporting only two modes in the
> same buffer), so that means syntax-table values can't be trivial.
> Cons cell (mode-above . mode-below), and related code will need
> to consider movement direction?
Something like (mode-above . mode-below) is what I had in mind, yes.