I wrote a new .lang file for syntax highlighting a language I use frequently. It works fine, except that it doesn't glob onto the files automatically. Is there a utility I need to run to update a gtksourceview database?
Here's the relevant portion of the code.
<language id="pari" _name="Pari/GP" version="2.0" _section="Scientific">
<metadata>
<property name="mimetypes">text/x-pari-gp</property>
<property name="globs">*.gp</property>
<property name="line-comment-start">\\</property>
<property name="block-comment-start">/*</property>
<property name="block-comment-end">*/</property>
</metadata>
---------- Post updated at 09:34 PM ---------- Previous update was at 04:23 AM ----------
The good news is that I've discovered the /usr/share/mime/packages directory and the associated command update-mime-database:
sudo gedit /usr/share/mime/packages/freedesktop.org.xml
sudo update-mime-database /usr/share/mime
I've tried inserting code into freedesktop.org.xml as well as writing my own pari.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="text/x-pari-gp">
<comment>Pari/GP script!</comment>
<comment xml:lang="en_GB">Pari/GP script</comment>
<comment xml:lang="fr">script Pari/GP</comment>
<generic-icon name="text-x-script"/>
<glob pattern="*.gp" weight="100"/><!-- Must beat out PGP/MIME-encrypted message header -->
<glob pattern="*.GP"/>
<glob pattern="*.pari"/>
</mime-type>
</mime-info>
But even with the frightfully controlling weight of 100, I can't get gnomevfs-info to acknowledge the correct MIME-type for the file. Admittedly, the manual talks about the weight attribute but nothing seems to use it, so maybe that's not implemented. I tried adding in a too-strong magic section that would make some text documents identify as this type:
<magic priority="100"><!-- Must beat out PGP/MIME-encrypted message header -->
<match value="default" type="string" offset="1:256"/>
<match value="forprime" type="string" offset="1:256"/>
<match value="my" type="string" offset="1:256"/>
<match value="binomial" type="string" offset="1:256"/>
</magic>
but to no avail.
The funny part is that when I tested a file with the (otherwise unused) mock extension *.pari, gnomevfs-info and gedit play along nicely. So I know it's not just malformed xml syntax or a bad location or something like that.