{"id":12068,"date":"2024-03-27T12:13:52","date_gmt":"2024-03-27T16:13:52","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=12068"},"modified":"2024-03-27T12:13:52","modified_gmt":"2024-03-27T16:13:52","slug":"an-explanation-of-the-mark-ring","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=12068","title":{"rendered":"An Explanation Of The Mark Ring"},"content":{"rendered":"<p>\nArialdo Martini has a <a href=\"https:\/\/arialdomartini.github.io\/\/emacs-mark-ring\">very informative post<\/a> about the Emacs mark ring and how it works. On the surface, it&rsquo;s pretty simple. The mark ring is a ring buffer that records positions inside a buffer\u2014or several buffers in the case of the global mark ring\u2014and allows you to return to or otherwise use those positions.\n<\/p>\n<p>\nWhen you dig a little deeper, you find that there&rsquo;s a lot more to it. For example, the mark helps define a region in an Emacs buffer and that fact can be leveraged to perform all sorts of useful tasks.\n<\/p>\n<p>\nThe mark ring actually stores <a href=\"https:\/\/www.gnu.org\/software\/emacs\/manual\/html_node\/elisp\/Markers.html\">markers<\/a> to a given position so they are automatically adjusted if the absolute position of a place changes. Thus, you can, for example, push a position onto the mark ring, add text above that position, and still jump to where the mark was set even though its absolute position has moved.\n<\/p>\n<p>\nIn addition to allowing you to push positions onto the mark ring, Emacs will also record positions for you. For example, if you jump to a new position, your old position is pushed onto the mark ring. That allows you to do things like search for a symbol and then jump back to where you started. The exact rules for when Emacs pushes the mark onto the mark ring or global mark ring are a bit complex. <a href=\"http:\/\/irreal.org\/blog\/?p=11173\">This Irreal post<\/a> discusses a video the explains some of those complexities.\n<\/p>\n<p>\nThe simple mark ring mechanism enables all sorts of useful functionality. Take a look at Martini&rsquo;s post for some examples.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Arialdo Martini has a very informative post about the Emacs mark ring and how it works. On the surface, it&rsquo;s pretty simple. The mark ring is a ring buffer that records positions inside a buffer\u2014or several buffers in the case &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=12068\">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-12068","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\/12068","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=12068"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12068\/revisions"}],"predecessor-version":[{"id":12069,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12068\/revisions\/12069"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}