{"id":3493,"date":"2023-04-03T14:04:19","date_gmt":"2023-04-03T13:04:19","guid":{"rendered":"https:\/\/pmortensen.eu\/world2\/?p=3493"},"modified":"2023-04-21T13:34:19","modified_gmt":"2023-04-21T12:34:19","slug":"integration-of-edit-overflow-into-geany","status":"publish","type":"post","link":"https:\/\/pmortensen.eu\/world2\/2023\/04\/03\/integration-of-edit-overflow-into-geany\/","title":{"rendered":"Integration of Edit Overflow into Geany"},"content":{"rendered":"<p>Using <a href=\"https:\/\/pmortensen.eu\/world\/EditOverflow.php?LookUpTerm=Edit%20Overflow\">Edit&nbsp;Overflow<\/a> directly from <a href=\"https:\/\/pmortensen.eu\/world2\/2020\/03\/29\/using-geany\/\">Geany<\/a> has turned out to be surprisingly useful. If one is unsure about the spelling of a word, select it and press <em>Ctrl<\/em> + <em>2<\/em>. The word will either 1) Be unchanged (the spelling is correct). 2) Be changed (the spelling is incorrect) 3) Have appended <em>&#8220;@!$&#8221;<\/em> (Edit Overflow doesn&#8217;t have it in its word list).<\/p>\n<p>This avoids the overhead of using <a href=\"https:\/\/pmortensen.eu\/world\/EditOverflow.php?OverflowStyle=Native\">the web interface<\/a> (even if automated by a macro keyboard as there is still the very significant delay). Though the context that the associated URL provides is absent.<\/p>\n<p>It can also be used for shorthands which are then expanded by Edit Overflow, for example, with a difficult spelling and\/or a long word. <!-- (who can spell XXXX?) --> Example: Expanding <em>&#8220;<a href=\"https:\/\/pmortensen.eu\/world\/EditOverflow.php?LookUpTerm=vulns\">vulns<\/a>&#8220;<\/em> to <em>&#8220;vulnerabilities&#8221;<\/em>. Text templates can be used for the same purpose, but Edit Overflow has <a href=\"https:\/\/pmortensen.eu\/EditOverflow\/_Wordlist\/EditOverflowList_latest.html\">a lot more words<\/a>.<\/p>\n<h2>Installation<\/h2>\n<p>At the moment, Edit Overflow first needs to be build\/compiled on the system where you want to use it. Set up Geany to invoke Edit Overflow through its command line interface with the text selection in a Geany document, and have a script make the necessary conversions to and from Edit Overflow, similar to <a href=\"https:\/\/pmortensen.eu\/world2\/2020\/03\/29\/using-geany\/#Sort_lines\">the &#8216;sort&#8217; section<\/a> in <a href=\"https:\/\/pmortensen.eu\/world2\/2020\/03\/29\/using-geany\/\">the Geany blog post<\/a>.<\/p>\n<p>Use this Perl one-liner on Linux:<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\nperl -e 'while (&lt;&gt;) { my $out = $_; $exe = &quot;\\\/home\\\/mortensen\\\/temp2\\\/2022-03-01\\\/_DotNET_tryout\\\/EditOverflow4\\\/bin\\\/Debug\\\/netcoreapp3.1\\\/EditOverflow3&quot;; my $regExtr = &quot;Corrected word for .+\\\\: (.+)&quot;; my $output = qx\/export LOOKUP=\\&quot;$_\\&quot;; $exe \/; if ($output =~ \/$regExtr\/) { $out = $1; } else { my $output2 = qx\/export LOOKUP=\\&quot;$_\\_\\&quot;; $exe \/; if ($output2 =~ \/$regExtr\/) { $out = $1; } else {$out .= &quot;@!\\$&quot;; } } print &quot;$out&quot;; }'\r\n<\/pre>\n<p>Configure the $exe part. The path to the Edit Overflow executable probably needs to be changed from the default <em>&#8220;\/home\/mortensen\/temp2\/2022-03-01\/_DotNET_tryout\/EditOverflow4\/bin\/Debug\/netcoreapp3.1\/EditOverflow3&#8221;<\/em> (this is for a particular build folder location).<\/p>\n<p>Add it to menu <em>&#8220;Edit&#8221;<\/em> &rarr; <em>&#8220;Format&#8221;<\/em> &rarr; <em>&#8220;Send Selection to&#8221;<\/em> &rarr; <em>&#8220;Format&#8221;<\/em> &rarr; <em>&#8220;Set Custom Commands&#8221;<\/em>. If it becomes the second item, then Ctrl + 2 will perform the Edit Overflow correction of the selection in a Geany document.<\/p>\n<h2>How does it work?<\/h2>\n<p>Edit Overflow has a command-line interface. For example, it can export the word list in various formats. And looking up a word in the word list is also supported. The word to be corrected is taken as the environment variable &#8220;LOOKUP&#8221; (not a command-line parameter; this is in order to avoid the complications with escaping spaces and escaping various special characters). For example, this will look up the misspelling &#8220;Javascript&#8221;:<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\nexport LOOKUP=Javascript\r\n.\/EditOverflow3\r\n<\/pre>\n<p>where <em>EditOverflow3<\/em> is the name of the Edit Overflow executable and the current directory is where <em>EditOverflow3<\/em> is.<\/p>\n<p>Thus the script must first take the input from standard input and set up the environment variable &#8220;LOOKUP&#8221;.<\/p>\n<p>Output:<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\nCorrected word for Javascript: JavaScript\r\n<\/pre>\n<p>After execution of Edit Overflow, the Perl script extracts the corrected word from that output (Edit Overflow&#8217;s output to standard output) by using the regular expression:<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\nCorrected word for .+\\\\: (.+)\r\n<\/pre>\n<p>The Perl script only passes the correct word (&#8220;JavaScript&#8221; in this example) onto Geany (through the Perl script&#8217;s output to standard output); the Perl script acts like a filtering layer, so we get the desired result.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using Edit&nbsp;Overflow directly from Geany has turned out to be surprisingly useful. If one is unsure about the spelling of a word, select it and press Ctrl + 2. The word will either 1) Be unchanged (the spelling is correct). &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/pmortensen.eu\/world2\/2023\/04\/03\/integration-of-edit-overflow-into-geany\/\"> <span class=\"screen-reader-text\">Integration of Edit Overflow into Geany<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17,14,18],"tags":[],"_links":{"self":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts\/3493"}],"collection":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/comments?post=3493"}],"version-history":[{"count":55,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts\/3493\/revisions"}],"predecessor-version":[{"id":3616,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts\/3493\/revisions\/3616"}],"wp:attachment":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/media?parent=3493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/categories?post=3493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/tags?post=3493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}