>> Stefan Monnier <monnier@iro....>
>> on Wed, 13 Jun 2012 23:23:54 -0400 wrote:
>> I'm also using narrowing during indentation, but some modes (like js)
>> use (widen) in indent-line-function. It should be somewhat fixable by
> I don't think it's worthwhile trying to make a "multi-major-mode" that
> works with any major mode, no matter what wicked thing it does.
> So it's OK to impose a few conventions that the major mode needs
> to obey. The important and difficult part is to figure what those
> conventions need to be.
I also think that multi-major-mode is too much work into a wrong
direction. Major mode with chunk switching modes is a dead end
also. Modes are becoming heavier and more complex, and one can never
know reliably what is happening during the initialization. Besides that,
this approach is extremely expensive. Mumamo has almost 10000 lines and
it doesn't look like it's the end of it.
I bet a working *minor*-web-mode can be written in less than 100 lines
only by specifying chunk delimiters regexps and a mode detection
> 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.
In litprog-mode.el chunk delimiters already marked as comments to avoid
issues with parse-partial-sexp (they even have a separate mode). I guess
this works well enough for most of the cases. To achieve full generality
one would need to mark whole "irrelevant" chunks as comments. For
example in js-mode buffer all html, php etc chunks are comments. In
html-mode buffer js, php are comments, etc.
Dmitry suggested collecting test cases. That would be great for
comparing multi modes head to head. Where can I find really difficult