<p>To be consistent with Compile/ Run/ Build the following modification should be done:</p>
<pre><code>gchar *command_orig = g_strdup(command);
gchar *command_line = build_replace_placeholder(doc, command_orig);
gint isfilecontext = strcmp(command_orig, command_line) != 0;
g_free(command_orig);
if (isfilecontext && doc && doc->changed) //save file if it's in context
{
        if (!document_save_file(doc, FALSE))
            return;
}
</code></pre>
<p>This provides 'save before run' feature for the edited file if the context string contains %f, %d etc. placeholders.<br>
I don't know how to explain this more clearly. Perhaps I'm a bad explainer and a bad boy at that. You folks are much more clear about a separate PR from context action etc.</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/pull/1841#issuecomment-384507413">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ_0xQoTOBYl1O06XCr2ayf1Zpwwqks5tsUksgaJpZM4Thz7Y">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJ8SSSkiAcss9zPwdaU0MhWiW6eKyks5tsUksgaJpZM4Thz7Y.gif" height="1" width="1" alt="" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/pull/1841#issuecomment-384507413"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<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://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"PERSON","message":"@aplsimple in #1841: To be consistent with Compile/ Run/ Build the following modification should be done:\r\n\r\n    gchar *command_orig = g_strdup(command);\r\n    gchar *command_line = build_replace_placeholder(doc, command_orig);\r\n    gint isfilecontext = strcmp(command_orig, command_line) != 0;\r\n    g_free(command_orig);\r\n    if (isfilecontext \u0026\u0026 doc \u0026\u0026 doc-\u003echanged) //save file if it's in context\r\n    {\r\n            if (!document_save_file(doc, FALSE))\r\n                return;\r\n    }\r\n\r\nThis provides 'save before run' feature for the edited file if the context string contains %f, %d etc. placeholders.\r\nI don't know how to explain this more clearly. Perhaps I'm a bad explainer and a bad boy at that. You folks are much more clear about a separate PR from context action etc."}],"action":{"name":"View Pull Request","url":"https://github.com/geany/geany/pull/1841#issuecomment-384507413"}}}</script>