{"id":9609,"date":"2021-04-08T18:44:27","date_gmt":"2021-04-08T22:44:27","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=9609"},"modified":"2021-04-08T18:44:27","modified_gmt":"2021-04-08T22:44:27","slug":"running-a-shell-command-from-emacs","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=9609","title":{"rendered":"Running a Shell Command from Emacs"},"content":{"rendered":"<p>Over at <a href=\"https:\/\/emacsredux.com\">Emacs Redux<\/a>, Bozhidar Batsov has a <a href=\"https:\/\/emacsredux.com\/blog\/2021\/04\/07\/run-shell-commands-from-the-minibuffer\/\">short post<\/a> on using <kbd>Meta<\/kbd>+<kbd>!<\/kbd> to run a shell command from the minibuffer. The output can go to various places\u2014see Batsov\u2019s post for the details\u2014but usually what you want is to specify the prefix argument (<kbd>Ctrl<\/kbd>+<kbd>u<\/kbd> <kbd>Meta<\/kbd>+<kbd>!<\/kbd>) so that the output of the command is inserted at point.<\/p>\n<p>It\u2019s a useful command but I hardly ever use it. I\u2019m much more likely to use <code>shell-command-on-region<\/code> (<kbd>Meta<\/kbd>+<kbd>|<\/kbd>) which pipes the contents of the buffer into a shell command. Analogously to <kbd>Meta<\/kbd>+<kbd>!<\/kbd>, specifying the universal argument will cause the contents of the buffer to replaced by the output of the shell command.<\/p>\n<p>Emacs has so much builtin functionality that you probably won\u2019t use these commands very often but sometimes they\u2019re just what you need.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over at Emacs Redux, Bozhidar Batsov has a short post on using Meta+! to run a shell command from the minibuffer. The output can go to various places\u2014see Batsov\u2019s post for the details\u2014but usually what you want is to specify &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=9609\">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":[5],"tags":[18],"class_list":["post-9609","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9609","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=9609"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9609\/revisions"}],"predecessor-version":[{"id":9610,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9609\/revisions\/9610"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}