{"id":10903,"date":"2022-10-24T12:24:42","date_gmt":"2022-10-24T16:24:42","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=10903"},"modified":"2022-10-24T12:24:42","modified_gmt":"2022-10-24T16:24:42","slug":"undo-in-region","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=10903","title":{"rendered":"Undo In Region"},"content":{"rendered":"<p>Over at the Emacs subreddit, tms9918 says <a href=\"https:\/\/www.reddit.com\/r\/emacs\/comments\/yb4nhu\/is_there_anything_like_undo_at_this_line\/\">he sometimes changes a line, make changes in other parts of the file, and then wants to restore that first line<\/a>. He was asking if there was anyway of doing that. There is, of course, as <a href=\"http:\/\/irreal.org\/blog\/?p=8614\">I\u2019ve written before<\/a>. The thing is, tms9918\u2019s post was full of comments expressing wonder at how the commenter didn\u2019t already know this. That led me to believe that a reprise of the issue was called for, especially since it\u2019s so useful.<\/p>\n<p>It is, after all, a situation that comes up often: you make a series of changes and then find that you want to undo one of the earlier changes. It\u2019s extraordinarily easy to do. All you need do is highlight the region you want to restore and undo will apply only in that region. It works out-of-the-box if you\u2019re using the default Emacs undo system. If you\u2019re using <code>undo-tree<\/code>, you have to set <code>undo-tree-enable-undo-in-region<\/code> to <code>t<\/code> in your configuration.<\/p>\n<p>You don\u2019t need this all the time, of course, but when you do it\u2019s easy to remember how to do it. There\u2019s not special key binding to know or lookup. You simply highlight the region you want to restore and invoke undo in the usual way. Try it out; you\u2019ll be delighted.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over at the Emacs subreddit, tms9918 says he sometimes changes a line, make changes in other parts of the file, and then wants to restore that first line. He was asking if there was anyway of doing that. There is, &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=10903\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-10903","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\/10903","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=10903"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10903\/revisions"}],"predecessor-version":[{"id":10904,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10903\/revisions\/10904"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}