The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
.
google unix.com



UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Vim highlighting annoyance vimhelp High Level Programming 1 04-04-2009 06:48 AM
Syntax Highlighting in JavaScript 0.6 (Default branch) iBot Software Releases - RSS News 0 12-16-2008 07:00 AM
awk updating one file with another, comparing, updating mecano Shell Programming and Scripting 11 09-14-2008 06:50 AM
Syntax Highlighting in JavaScript 0.5 (Default branch) iBot Software Releases - RSS News 0 08-19-2008 04:40 AM
Emacs color syntax highlighting viejid UNIX for Dummies Questions & Answers 0 06-15-2007 02:50 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-17-2009
CRGreathouse CRGreathouse is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 104
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.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:29 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0