Priority list for filetype resolution

Issue #1131 new
Antony Lee created an issue

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).

Comments (2)

  1. Antony Lee reporter

    Kindly raising this issue again (this time it's my matplotlibrc which gets misidentified as a Velocity file).
    Perhaps another reasonable (and simpler?) option is to read an environment variable, $PYGMENTIZEEXCLUDE, which holds a comma-separated list of names of lexers to exclude?

  2. Log in to comment