The filetype_extensions.conf on my system (Debian 12) as well as the one in the repository do not bind header files to the C file type and I stumbled over this because my snippets were not working sometimes (in newly created files where the type was automatically set to C++ for some reason, might be a plugin, no idea).
https://github.com/geany/geany/blob/ddb627889997df7b5a5a44ce581f7973824478cc...
NB: *.h is also associated with other filetypes such as CUDA and Objective-C. I tried to find a reason for this but searching for c and *.h is not exactly helpful... ;) I was able to find a/the relevant commit though with git's blame: https://github.com/geany/geany/commit/c7bf89a46444c6d75ac89395f0663c99cd5e79...
Since this was almost a decade ago I would like to poke for a re-evaluation of the underlying issue. I'll set it on my machines now and report if I notice anything dramatically breaking.
The problem is that `.h` is an extension used for multiple filetypes in the real world and I have my personal feelings about this [expletive deleted] insanity, thats what `.hpp` is for, but anyway the world is what it is and `.h` is used for C, C++ and others.
Because C++ is a superset of C, and C++ has rather more in the "header" files than C does usually, C++ headers need to be C++, they rarely highlight or parse well if treated as C. But C ones will still pretty much parse and highlight correctly if treated as C++. So it was decided that making the setting for `.h` C++ will be mostly ok for C contents too. So the default setting in `filetype_extensions.conf` put `*.h` on C++. And because C++ is before any other filetype that also uses `*.h` the C++ setting overrides those settings which are after it.
And since Geany has a mix of C and C++ with both using `.h` for header, then of course the default settings must suit Geany :stuck_out_tongue_winking_eye:.
Your options for using `.h` are:
1. if you only use C but no C++ then in `filetype_extensions.conf` add `.h` to C 2. add your snipets to both C and C++ 3. add `// -*- C -*-` to your C headers so they are explicit independent of the extension
github-comments@lists.geany.org