Visit Our UNIX and Linux User Community


gedit/gtksourceview: Updating types for syntax highlighting?

 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications gedit/gtksourceview: Updating types for syntax highlighting?
# 1  
Old 09-17-2009
gedit/gtksourceview: Updating types for syntax highlighting?

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.
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:
Code:
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:
Code:
<?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:
Code:
    <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.

Previous Thread | Next Thread
Test Your Knowledge in Computers #367
Difficulty: Medium
The Single UNIX Specification specifies vi, so every conforming UNIX system must have it.
True or False?

7 More Discussions You Might Find Interesting

1. What is on Your Mind?

New Code Tags (Syntax Highlighting)

Hey, Just added a new UserCP option so you can change the code tags to look like the code tags in this example (turn this on and off): Note: I set the default to "SyntaxHighlighting" for debugging purposes. We can change the default back to the original code tags later. ... (36 Replies)
Discussion started by: Neo
36 Replies

2. UNIX for Dummies Questions & Answers

Reapplying syntax highlighting in vim

I had a bash script (ma_report.sh) that I was editing when my VPN connection died. So, when I reconnected, I recovered my changes and reopened the file. Everything looks fine except that there is no longer any syntax highlighting. Using ':syntax on' does not work. Other bash scripts in vim do... (1 Reply)
Discussion started by: treesloth
1 Replies

3. AIX

[Vim] Question about syntax highlighting

Hi all, my sysadmin installed Vim packages (vim-enhanced-6.3-1 & vim-common-6.3-1) on an Aix system (7.1.0.0). I log in using Putty (vs 0.54) and got an annoying underline issue. All strings and var names are underlined as you can see on the attached file Is it possible to get rid of that... (4 Replies)
Discussion started by: Fundix
4 Replies

4. UNIX for Dummies Questions & Answers

gedit newline weirdness

I have this file cd /media/AUDIO/WAVE/9780743561181 ~/Desktop/mp3-to-m4b 9780743561181-UNLEASHING THE IDEA VIRUS "UNLEASHING THE IDEA VIRUS" "GODIN, SETH" 2006 n cd /media/AUDIO/WAVE/9780743561204 ~/Desktop/mp3-to-m4b 9780743561204-STALIN'S GHOST "STALIN'S GHOST" "SMITH, MARTIN" 2007 n cd... (1 Reply)
Discussion started by: glev2005
1 Replies

5. Red Hat

Unable to activate Gedit plugin

Hi everyone I downloaded the multi-edit plugin for Gedit from this link: Multi-edit | Jon Walsh I copied all the files in ~/.gnome2/gedit/plugins/ as described in the website but I can't activate the plugin. I can see it but I can't activate it in Gedit preferences. Does anyone come... (0 Replies)
Discussion started by: goude
0 Replies

6. Shell Programming and Scripting

awk updating one file with another, comparing, updating

Hello, I read and search through this wonderful forum and tried different approaches but it seems I lack some knowledge and neurones ^^ Here is what I'm trying to achieve : file1: test filea 3495; test fileb 4578; test filec 7689; test filey 9978; test filez 12300; file2: test filea... (11 Replies)
Discussion started by: mecano
11 Replies

7. UNIX for Dummies Questions & Answers

Emacs color syntax highlighting

So... i cant get it to work. I had already posted this but it got deleted. Details: Im running SSH shell on Windows XP, connecting to a server whose term is vt100 (someone asked me that last time) Im trying to get the syntax highlighting in cc mode to work in color, but its black and... (0 Replies)
Discussion started by: viejid
0 Replies

Featured Tech Videos