Overriding default lexer in highlight extension
Jordi Gutiérrez Hermoso
jordigh at octave.org
Wed Sep 26 08:06:52 CDT 2012
On 25 September 2012 20:41, Augie Fackler <raf at durin42.com> wrote:
> 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.
My argument against that is that it's not up to an individual hg user
or installation to know how to lex files in a repository. The
repository itself should carry this information around as part of its
> > 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?
Ah, sure, that makes more sense. I see that's how hgeol works, so at
least I would be consistent with another UI, albeit an unloved one.
- Jordi G. H.
More information about the Mercurial-devel