<p></p>
<p dir="auto">I'm thinking about something like the following:</p>
<ul dir="auto">
<li>Preference variables are registered through a function, like <code>register_config_variable(key_id, group, name, type, ...)</code>.  Session variables could use the same registration system with a different <code>key_id</code>.  Maybe project files also.</li>
<li>All registered variables would be loaded/saved with <code>load_config(key_id)</code> and <code>save_config(key_id)</code>.  (It would use something like <code>for_each_config_variable</code>.)
<ul dir="auto">
<li>Adding and using a new variable would consist of adding it to the appropriate struct and registering it with the config management system.  No more manually adding load/save code to separate functions.  Existing structs would stay intact.</li>
</ul>
</li>
<li>Preferences could be set/get with something like <code>get_config_variable(key_id, group, name)</code> and <code>set_config_variable(key_id, group, name, ...)</code>.
<ul dir="auto">
<li>Existing code would continue to work.  The registration system could use pointers to access the same variables.</li>
</ul>
</li>
<li>There could be a runtime override <code>override_config_variable(key_id, group, name, ...)</code> that sets an override flag so preferences can set sensitivity or display notices.  It would also prevent writing override values to the config/session files.
<ul dir="auto">
<li>Plugin identity could also be tracked, similar to <code>plugin_signal_connect</code>, so when the plugin is unloaded, the previous setting can be restored.</li>
</ul>
</li>
</ul>
<p dir="auto">This could all be implemented in a plugin to manage its own settings as proof of concept to ensure that it makes sense before modifying Geany.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany-plugins/issues/1131#issuecomment-966756151">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ6TSTGL3UUG62QVIMDULRYDBANCNFSM5HWWFOFQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/AAIOWJ22H33JFUVHH4JNZVDULRYDBA5CNFSM5HWWFOF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHGPYONY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany-plugins/issues/1131#issuecomment-966756151",
"url": "https://github.com/geany/geany-plugins/issues/1131#issuecomment-966756151",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>