Bug 3971

Summary: Add mime-type for Octave files.
Product: shared-mime-info Reporter: Paolo Maggi <paolo>
Component: freedesktop.org.xmlAssignee: Jonathan Blandford <jrb>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: x86 (IA32)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch that was commited.

Description Paolo Maggi 2005-08-04 03:34:34 UTC
GNU Octave (www.octace.org) is a high-level language, primarily intended for
numerical computations that is mostly compatible with Matlab.

While fixing bug http://bugzilla.gnome.org/show_bug.cgi?id=170604 I have seen
there is no registered mime-type for Octave.

AFAIK, the Octave/Matlab files use the .m extension.
The same extension is also used for the Objective-C file (text/x-objcsrc).

So, we have two programming languages that uses the same extension and I don't
think it is possible to guess the mime-type from the content (in an easy way).

Any idea on how to solve this problem and add a mime-type for Octave/Matlab to
the mime-type DB?
Comment 1 Paolo Maggi 2005-12-31 04:45:29 UTC
From http://bugzilla.gnome.org/show_bug.cgi?id=170604:

"You can get on text/x-octave mime-type specification at
http://hauberg.org/octave.xml. I guess this fixes the
bug at freedesktop.org, but I don't have the time to loom into it. Perhaps
somebody else does :-)"
Comment 2 Christian - Manny Calavera - Neumair 2006-01-03 04:34:43 UTC
I think matlab files typically start with "function" or "%", but other than that
it seems to be nontrivial to detect the difference between Objective-C and
matlab files. Paolo pointed out on IRC that Objective-C files typically use the
"#import" statement, but considering that especially in OSS environments source
files typically start with comments specifying the license etc. I don't think
this is strong enough.
Comment 3 Paolo Maggi 2006-01-03 04:52:54 UTC
May be you can match:

/* or // or #import or #include or @interface or @implementation

for Objective-C

I think this should match 99% of cases.

See also http://en.wikipedia.org/wiki/Objective-C
Comment 4 Christian - Manny Calavera - Neumair 2006-01-03 23:55:13 UTC
Created attachment 4229 [details] [review]
Patch that was commited.

I had to add various match patterns, but now detection seems to be quite
reliable for the gnustep source code and some random matlab scripts I
downloaded. I've added the "text/x-octave" alias for the matlab MIME type
because according to google it is already used (for instance in gedit).
Comment 5 Christian - Manny Calavera - Neumair 2006-01-03 23:55:53 UTC
Closing.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.