Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unneeded rewriting of settings.json #3009

Merged
merged 4 commits into from
Mar 14, 2024

Conversation

dmaluka
Copy link
Collaborator

@dmaluka dmaluka commented Nov 3, 2023

It doesn't seem necessary to write settings to settings.json when registering a new option. The option is set to its default value, which means that it will not be written to settings.json (precisely because it's the default value), so the contents of settings.json don't change and thus don't need to be written again.

This unneeded writing, in particular, causes unexpected "The file on disk has changed. Reload file? (y,n,esc)" each time when we open settings.json via micro.

Fixes #2647

As a bonus, a few other small fixes and code improvements.

Apply the same fix as 4d13308 to all kinds of options, not just to
plugin options.
Avoid code duplication between RegisterCommonOption() and
RegisterCommonOptionPlug(), exactly the same way as it is done for
RegisterGlobalOption() and RegisterGlobalOptionPlug().
It doesn't seem necessary to write settings to settings.json when
registering a new option. The option is set to its default value, which
means that it will not be written to settings.json (precisely because
it's the default value), so the contents of settings.json don't change
and thus don't need to be written again.

This unneeded writing, in particular, causes unexpected "The file on
disk has changed. Reload file? (y,n,esc)" each time when we open
settings.json via micro.

Fixes zyedidia#2647
@dmaluka dmaluka merged commit 606bcec into zyedidia:master Mar 14, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

settings.json is needlessly written every time micro is started
2 participants