If you open up an Objective-C file with the ".m" extension, it will set the filetype to Matlab/Octave.
To fix it, you have to go to `Tools=>Configuration Files=>filetype_extensions.conf`. Then remove *.m from `Matlab/Octave=`.
To solve this, you'd have to check the code in the file, which I imagine would be a pain.
However, almost every Objective-C file will contain at least one `#import` or `#include`. You could probably just check if the file contains this.
I'm not sure which is more popular. If Matlab/Octave is more popular, then maybe it should be ahead of Objective-C files.
To fix it, you have to go to Tools=>Configuration Files=>filetype_extensions.conf. Then remove *.m from Matlab/Octave=.
Correct.
To solve this, you'd have to check the code in the file, which I imagine would be a pain.
However, almost every Objective-C file will contain at least one #import or #include. You could probably just check if the file contains this.
So do C/C++ files.
I'm not sure which is more popular. If Matlab/Octave is more popular, then maybe it should be ahead of Objective-C files.
The `filetype_extensions.conf` is in alphabetical order by filetype name, so `M`atlab wins over `O`bjective-C. Geany devs don't know which is most popular with an individual user, so its alphabetical, bat as you note above you can change it to your preference.
So do C/C++ files.
Sorry, I meant that first you would see if the file extension is `.m`. Then you would do the #import/#inclue check.
The filetype_extensions.conf is in alphabetical order by filetype name, so Matlab wins over Objective-C. Geany devs don't know which is most popular with an individual user, so its alphabetical, bat as you note above you can change it to your preference.
That's fine if this is the intended design of Geany.
However, for new users to Geany, they will have to find where to make this change and change it. From a design perspective, this seems like a strange burden on users, where they need to delete a file association in the settings for their file association to work. This would be particularly troublesome if you're using both Matlab/Octave and Objective-C files. You'd be better off editing only your Objective-C files in one editor, and then only editing your Matlab/Octave files in another editor.
Either way, since I think I'm the first person to report this issue, I'm thinking that no one seems to use Linux (or Geany) for editing Objective-C files, so it probably doesn't matter, and this issue can be closed.
I suspect you objective-c users simply deleted the matlab association and forgot about it.
You can also mark the filetype in the file using an Emacs type `-*- filetype -*-` mark in the first two lines.
And to be clear, Geany is intended to be fairly easy to use, and to not have the steep learning cliff of Emacs or Vi.
But Geany is not specifically targeted at first time programmers either, in general it is expected that any programmer with experience will be used to looking stuff up, and can edit configuration files. So its never been a priority to have every setting appear in the preferences GUI or to be perfectly configured by default for every use-case.
Closed #1896.
FWIW, it's fairly easy to write a naive plugin to select Objective-C when it matches @esotericpig's criteria, and I gave it a try for fun: https://github.com/b4n/geany-plugin-matlab-or-objc If that's robust enough, maybe we could check if how fitting it'd be to have something similar in Geany proper (as we already have some inline detection built-in, maybe it can be extended in a non-ugly manner -- although it's trickier than it sounds because we prefer not to have to read filetype files before actually needing them, so we can't read detection settings from filetypes files…)
@b4n, Why not just generalise the plugin, including the regexen in a config file etc and add it to GP, then users can support other conflicts without coding.
github-comments@lists.geany.org