Overriding default lexer in highlight extension

Jordi Gutiérrez Hermoso jordigh at octave.org
Tue Sep 25 16:07:05 CDT 2012


I would like to be able to somehow override the default lexer that
Pygments chooses for the highlight extension. Witness how it gets it
wrong here and here:

    Perl? http://hg.savannah.gnu.org/hgweb/octave/file/tip/etc/HACKING
    Matlab? http://hg.savannah.gnu.org/hgweb/octave/file/tip/scripts/polynomial/roots.m

My idea is that a repo should somehow be able to specify what files
shoud be lexed how, but I cannot think of the correct way to do this.
My initial thought is that there should be a .hghighlight file at the
top-level tracked by hg where it would have something like

    syntax: glob

    octave = *.m
    text = etc/HACKING
    text = README

i.e. these are additive, you can specify more than one glob or regex
per possible lexer.

If I could get some idea of what the correct UI for this is, it would
be much easier for me to patch the highlight extension.

TIA,
- Jordi G. H.


More information about the Mercurial-devel mailing list