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?
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 :-)"
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.
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
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).
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.