{"id":7432,"date":"2018-08-24T12:09:52","date_gmt":"2018-08-24T16:09:52","guid":{"rendered":"http:\/\/irreal.org\/blog\/?p=7432"},"modified":"2018-08-24T12:09:52","modified_gmt":"2018-08-24T16:09:52","slug":"splitting-an-org-block","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=7432","title":{"rendered":"Splitting An Org Block"},"content":{"rendered":"<p>\nKaushal Modi has a nice post on <a href=\"https:\/\/scripter.co\/splitting-an-org-block-into-two\/\">how to split an Org block<\/a>. That comes up in the context of, say, writing a literate program and deciding you want to insert some commentary in the middle of the block. A simple keypress and the block is split in two and the cursor is positioned between the two parts.\n<\/p>\n<p>\nThe notion of &ldquo;block&rdquo; is general. The splitting will work with any type of Org block so its use extends beyond the simple case above. You wouldn&rsquo;t think this would be too complicated but, in fact, it&rsquo;s a bit fiddly. There&rsquo;s no built-in predicate to tell you when you&rsquo;re inside <i>any<\/i> Org block so Modi had write that first. The rest is mostly diddling around with regexes but there&rsquo;s still the problem of deciding where to split the block.\n<\/p>\n<p>\nModi shows all his code and has a nice commentary on what he&rsquo;s doing so it&rsquo;s easy to follow along. There&rsquo;s also a pointer to his <a href=\"https:\/\/github.com\/kaushalmodi\/.emacs.d\/blob\/master\/setup-files\/setup-org.el\">setup-org.el<\/a> file where you can see all the code at once. This is a nice post and Modi&rsquo;s code may be useful to those of you who frequently use Org blocks in your writing. It&rsquo;s also another wonderful example of how Emacs lets you scratch just about any itch.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kaushal Modi has a nice post on how to split an Org block. That comes up in the context of, say, writing a literate program and deciding you want to insert some commentary in the middle of the block. A &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=7432\">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,4],"class_list":["post-7432","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs","tag-org-mode"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7432","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=7432"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7432\/revisions"}],"predecessor-version":[{"id":7433,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7432\/revisions\/7433"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}