Overriding default lexer in highlight extension

Augie Fackler raf at durin42.com
Tue Sep 25 19:41:34 CDT 2012

On Sep 25, 2012, at 4:07 PM, Jordi Gutiérrez Hermoso wrote:

> 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

I guess I'd be more inclined to configure this using .hg/hgrc, at least to start.

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

Hm. I don't know that the existing config parser would make that easy. Flip it around, and it should work?

> 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.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

More information about the Mercurial-devel mailing list