GNU Octave is a Free implementation of the Matlab language (a programming language for numerical computing). Octave/Matlab script files have a '.m' extension. However, it seems that Objective-C also use this extension, so magic is needed to tell Octave/Matlab apart from Objective-C. It seems like a file is detected as being an Octave/Matlab script if it either starts with '%' (used for comments) or 'function'. Octave, however, also allows '#' to be used for comments (like pretty much all other scripted languages). So, it would be great if this could be recognised as well. This might, however, collide with Objective-C as these programs are recognised as starting with '#import'. If this is an issue, I would recommend recognising Octave/Matlab also as starting with '# ' or '##'. Thanks, Søren
Yes, the issue is there. I just added to git/master few simple testscases for the issue, and the addition of the '##' pattern for matlab files. Not sure about '# ', can you have things like: # import <stdio.h> in Obj-C? Also, can you attach a sample file misrecognized?
Created attachment 34794 [details] 5 simple examples The attached tar.gz file contains 5 files that all should be recognised as being Octave source files. On my system, all of them are recognised as being Objective-C in gedit, but that might be an Ubuntu bug. I am not an Objective-C coder so I don't know if you are allowed to do things like # import but looking at online examples it seems nobody actually does this. From a practical point of view, I guess it is fine to ignore this issue.
Please follow the instructions at: http://cgit.freedesktop.org/xdg/shared-mime-info/tree/HACKING#n31 for mime-type additions.
The original recommendation, to use "##" at offset 0 as magic for Octave as already been implemented with commit a1f1b88f so I think this can be closed. I am proposing a slightly different approach at bug #88596 , to have the x-matlab and x-octave mimetypes separated.
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.