[Github-comments] [geany/geany-plugins] New Plugin, maybe... (mostly) user-interface tweaks. (Issue #1131)

elextr notifications at xxxxx
Thu Nov 11 23:50:01 UTC 2021


The structure containing the autoclose settings is in the API, but its members are deliberately opaque to plugins.  So functions to manipulate those settings have to be added to Geany.

As a general rule structure contents should not be visible in the API as it will break the plugin ABI[^1] every time Geany changes the struct contents.  Having getter and setter functions allows structures to change internally and for any Geany actions to be triggered when setting (for example making the autoclose settings in prefs dialog inactive if a plugin has disabled them).  Not all Geany devs past and present have agreed with or conformed to this advice as you can see in the API :frowning_face: 

A general note, Geany API is something that has grown over time, in general nothing gets put in the API unless asked for, so there is no consistency about what is available.  Even more variable is what built-in functionality can be overridden by plugins, somebody has to want to do it and provide the PR to add it.

Finally getting to the point of the question, for autoclose maybe you can get away with just adding a bit to the autoclose bitmap indicating overridden by plugin and the Geany functionality in `editor.c::auto_close_chars()` can simply do nothing if the override bit is set.  This means the users settings in Geany are not changed by the plugin, so no issues about saving/restoring them and only a `set_plugin_override_autoclose(bool)`[^2] is needed (you don't need a reader since the plugin can easily remember if it set it).

Extra marks if you make the prefs dialog indicate the settings are overridden by a plugin.

[^1]: breaking the ABI isn't a problem for those who can compile their own plugins, but it means all existing precompiled plugins will not load.  It happened once that Debian released a new Geany which happened to break the ABI, but the plugins collection was delayed and suddenly users had no plugins as the old versions would not load.  So we try and break the ABI as as little as possible, which means any structures in the API can't change often, possibly limiting Geany evolution.
[^2]: better name needed

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/1131#issuecomment-966706219
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211111/bc412308/attachment-0001.htm>


More information about the Github-comments mailing list