<p>The main idea is to save the session file list more often to prevent<br>
accidental lost but saving the rest of the configuration might help<br>
as well.<br>
To prevent too many save attempts, an idle function is used and it's<br>
only added once until it was executed.</p>
<p>This might help <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="314617872" data-permission-text="Issue title is private" data-url="https://github.com/geany/geany/issues/1826" data-hovercard-type="issue" data-hovercard-url="/geany/geany/issues/1826/hovercard" href="https://github.com/geany/geany/issues/1826">#1826</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="213598732" data-permission-text="Issue title is private" data-url="https://github.com/geany/geany/issues/1426" data-hovercard-type="pull_request" data-hovercard-url="/geany/geany/pull/1426/hovercard" href="https://github.com/geany/geany/pull/1426">#1426</a> and replaces <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="325766729" data-permission-text="Issue title is private" data-url="https://github.com/geany/geany/issues/1860" data-hovercard-type="pull_request" data-hovercard-url="/geany/geany/pull/1860/hovercard" href="https://github.com/geany/geany/pull/1860">#1860</a>.</p>
<p>IIRC at the very beginning I was a bit concerned about IO access and performance when writing the settings too often. At least performance doesn't seem to be a problem: <code>configuration_save</code> takes about 1-2 milliseconds on my system and IO access happens in the document-related actions in any way.</p>
<p>Even though I tested the code, I would like to use it "in production" for some time to get sure there are no unseen side effects or similar.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/geany/geany/pull/2114'>https://github.com/geany/geany/pull/2114</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Save main and project configuration whenever documents are opened/closed</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/geany/geany/pull/2114/files#diff-0">src/keyfile.c</a>
    (38)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/geany/geany/pull/2114.patch'>https://github.com/geany/geany/pull/2114.patch</a></li>
  <li><a href='https://github.com/geany/geany/pull/2114.diff'>https://github.com/geany/geany/pull/2114.diff</a></li>
</ul>

<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/pull/2114">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ171pxFnFLZy-apLLEPmV0UzSi5lks5vbRvmgaJpZM4cQ_4i">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJ43Auw_u4dy6y0dh6nJZMMIUKaQ2ks5vbRvmgaJpZM4cQ_4i.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany","title":"geany/geany","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Save main and project configuration whenever documents are opened/closed (#2114)"}],"action":{"name":"View Pull Request","url":"https://github.com/geany/geany/pull/2114"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/pull/2114",
"url": "https://github.com/geany/geany/pull/2114",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>