<p><b>@b4n</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/2181#discussion_r296441933">scripts/update-nsis-functions.sh</a>:</p>
<pre style='color:#555'>> +
+# extract variable names (then sort the result, conver to lowercase and replace new lines by spaces)
+variables=$(\
+    sed --silent --regexp-extended\
+        --expression 's/^[ ]*m_ShellConstants.add\(_T\("(.*)"\),.*,.*\);.*$/\1/p' \
+        --expression 's/^[ ]*m_UserVarNames.add\(_T\("(.*)"\),.*\);.*$/\1/p' "${BUILD_CPP_FILE}" | \
+    sort | \
+    tr '[:upper:]' '[:lower:]' | \
+    tr '\n' ' ')
+
+# hardcode a few more, as found in the documentation ("4.2.2 Other Writable Variables")
+variables_extra='{nsisdir} 0 1 2 3 4 5 6 7 8 9 r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 \\n \\r \\t $'
+variables="${variables_extra} ${variables}"
+# remove leading and trailing whitespaces
+variables="$(echo "$variables" | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')"
+functions="$(echo "$functions" | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')"
</pre>
<p>what about moving that in the initial generation next to the other ones?  also it looks like a little bit of duplication, so what about adding a small function like this:</p>
<div class="highlight highlight-source-shell"><pre><span class="pl-en">normalize</span>() {
   sort <span class="pl-k">|</span> tr <span class="pl-s"><span class="pl-pds">'</span>[:upper:]<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">'</span>[:lower:]<span class="pl-pds">'</span></span> <span class="pl-k">|</span> tr <span class="pl-s"><span class="pl-pds">'</span>\n<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">'</span> <span class="pl-pds">'</span></span> <span class="pl-k">|</span> sed <span class="pl-s"><span class="pl-pds">'</span>s/^[[:blank:]]*//;s/[[:blank:]]*$//<span class="pl-pds">'</span></span>
}

functions=<span class="pl-s"><span class="pl-pds">$(</span></span>
<span class="pl-s">    sed --silent --regexp-extended <span class="pl-s"><span class="pl-pds">'</span>s/^\{TOK_.*,_T\("(.*)"\),[0-9]+,.*$/\1/p<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-smi">${TOKENS_CPP_FILE}</span><span class="pl-pds">"</span></span> <span class="pl-k">|</span> \</span>
<span class="pl-s">    normalize</span>
<span class="pl-s"><span class="pl-pds">)</span></span>

variables=<span class="pl-s"><span class="pl-pds">$(</span></span>
<span class="pl-s">    sed --silent --regexp-extended \</span>
<span class="pl-s">        --expression <span class="pl-s"><span class="pl-pds">'</span>s/^[ ]*m_ShellConstants.add\(_T\("(.*)"\),.*,.*\);.*$/\1/p<span class="pl-pds">'</span></span> \</span>
<span class="pl-s">        --expression <span class="pl-s"><span class="pl-pds">'</span>s/^[ ]*m_UserVarNames.add\(_T\("(.*)"\),.*\);.*$/\1/p<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-smi">${BUILD_CPP_FILE}</span><span class="pl-pds">"</span></span> <span class="pl-k">|</span> \</span>
<span class="pl-s">    normalize</span>
<span class="pl-s"><span class="pl-pds">)</span></span>

<span class="pl-c"><span class="pl-c">#</span> […]</span></pre></div>

<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/2181?email_source=notifications&email_token=AAIOWJ62CHXNBNY7LYU7Y7DP3X65HA5CNFSM4HWTGO52YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB4K52UA#pullrequestreview-253091152">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJYQXKWA2ZUHQWBB65LP3X65HANCNFSM4HWTGO5Q">mute the thread</a>.<img src="https://github.com/notifications/beacon/AAIOWJ5DRXRGEPMJR4BSKBTP3X65HA5CNFSM4HWTGO52YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB4K52UA.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/pull/2181?email_source=notifications\u0026email_token=AAIOWJ62CHXNBNY7LYU7Y7DP3X65HA5CNFSM4HWTGO52YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB4K52UA#pullrequestreview-253091152",
"url": "https://github.com/geany/geany/pull/2181?email_source=notifications\u0026email_token=AAIOWJ62CHXNBNY7LYU7Y7DP3X65HA5CNFSM4HWTGO52YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB4K52UA#pullrequestreview-253091152",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>