@xiota commented on this pull request.
@@ -167,6 +307,7 @@ PluginCallback plugin_callbacks[] = {
{"document-open", (GCallback) & on_doc_open, TRUE, NULL}, {"document-activate", (GCallback) & on_doc_activate, TRUE, NULL}, {"document-close", (GCallback) & on_doc_close, TRUE, NULL}, + {"document-filetype-set", (GCallback) & on_doc_filetype_set, TRUE, NULL},
I chose to use that signal because it is more specific for what is intended.
I did not try the open signal, but suppose the Geany opens the file and sends the open signal. Then the plugin changes the file type. Then Geany changes the filetype and sends the filetype signal. Then the plugin won't have accomplished what was intended.
While I agree that generally the plugin should not override a user selection, the plugin would be changing file types of only header files. It's unlikely that the user would need/want to change the type of headers to something not matching the source file.
If you prefer, I will use the document-open signal when I reorganize the code according to what you suggested in another comment.