There has been a few issues about how to detect whether
.m files are C# or MATLAB (e.g.
#696, #1079), but detection is still not perfect (in particular, I would suggest hardcoding rules to distinguish one language from the other, e.g. by the fact that C# uses
// for comments whereas MATLAB uses
% (right now, the MATLAB lexer implements
analyse_text to look for lines starting with
%, but not the C# lexer; however perhaps it should go further and penalize lines starting with the "wrong" comment character?).
But instead of relying on heuristics, I would like to suggest to just provide a global priority list (something like
.pygmentizerc) to say, e.g.,
.m always maps to MATLAB (I believe the user base of the two languages are different enough that for a single user, one of the choices is always right).