{"id":1730,"date":"2013-02-21T07:00:59","date_gmt":"2013-02-21T12:00:59","guid":{"rendered":"http:\/\/irreal.org\/blog\/?p=1730"},"modified":"2013-02-21T07:01:43","modified_gmt":"2013-02-21T12:01:43","slug":"calling-external-programs","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=1730","title":{"rendered":"Calling External Programs"},"content":{"rendered":"<p>One of the rules specific to EmacsGolf, as opposed to VimGolf, is that you&#8217;re allowed to call external programs to operate on a region of the buffer using something like \u3010<kbd>Ctrl<\/kbd>+<kbd>u<\/kbd> <kbd>Meta<\/kbd>+<kbd>|<\/kbd>\u3011. You can do the same thing from an Elisp program, of course, and Xah Lee has a useful post showing how to <a href=\"http:\/\/ergoemacs.org\/emacs\/elisp_perl_wrapper.html\">call external programs<\/a>.<\/p>\n<p>This functionality is more flexible than many beginners realize. You can call shell scripts, a scripting language such as Perl or Python, or a compiled program such as <code>sort<\/code>\u2014anything that reads from <code>stdin<\/code> and writes to <code>stdout<\/code>. There nothing hard about doing any of this, of course, but you do need to know the proper incantation. See Lee&#8217;s post for the details. Also take a look at <code>shell-command<\/code>. It can be useful when you want to run an external program and optionally capture its output to a buffer\u2014see <a href=\"http:\/\/irreal.org\/blog\/?p=936\">this post<\/a> for an example of its use.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the rules specific to EmacsGolf, as opposed to VimGolf, is that you&#8217;re allowed to call external programs to operate on a region of the buffer using something like \u3010Ctrl+u Meta+|\u3011. You can do the same thing from an &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=1730\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[18],"class_list":["post-1730","post","type-post","status-publish","format-standard","hentry","category-programming","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1730","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1730"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1730\/revisions"}],"predecessor-version":[{"id":1732,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1730\/revisions\/1732"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}