{"id":12022,"date":"2024-03-07T12:15:23","date_gmt":"2024-03-07T17:15:23","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=12022"},"modified":"2024-03-07T12:15:23","modified_gmt":"2024-03-07T17:15:23","slug":"unified-context-switching","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=12022","title":{"rendered":"Unified Context Switching"},"content":{"rendered":"<p>\nJames Dyer has a <a href=\"https:\/\/www.emacs.dyerdwelling.family\/emacs\/20240305160708-emacs--unified-interface-for-switching-contexts\/\">really interesting post<\/a> on how he used a bit of Elisp to solve one of his workflow problems. He&rsquo;d recently abandoned his use of <code>save=desktop<\/code> in favor of <code>recentf<\/code>. His reasons for switching don&rsquo;t really matter\u2014although you can read them in his post\u2014but after opting for <code>recentf<\/code> he wanted a way to switch to contexts other than files. He wanted to be able to switch to a recent file, a buffer, a bookmark, or a new theme.\n<\/p>\n<p>\nAll that&rsquo;s possible out of the box, of course, but Dyer didn&rsquo;t want to worry about separate keybindings for each of them; he wanted a unified selection method. It took a surprising small amount of Elisp to get this done. A single binding invokes a completing read with all the files, buffers, bookmarks, and themes as possibilities.\n<\/p>\n<p>\nDyer shows the code in his post. It&rsquo;s amazingly straightforward. The only complicated thing is that he uses some of the more esoteric capabilities of completing read, many of which I didn&rsquo;t know about.\n<\/p>\n<p>\nEven if you&rsquo;re not interested in building a unified context switching mechanism such as his, his code is worth studying for what it reveals about the features of completing read. It&rsquo;s a lot more capable than you probably think. As usual, with Dyer&rsquo;s post, it&rsquo;s short and won&rsquo;t take you long to read.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>James Dyer has a really interesting post on how he used a bit of Elisp to solve one of his workflow problems. He&rsquo;d recently abandoned his use of save=desktop in favor of recentf. His reasons for switching don&rsquo;t really matter\u2014although &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=12022\">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-12022","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\/12022","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=12022"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12022\/revisions"}],"predecessor-version":[{"id":12023,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12022\/revisions\/12023"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}