<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
 xmlns:content="http://purl.org/rss/1.0/modules/content/"
 xmlns:wfw="http://wellformedweb.org/CommentAPI/"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:atom="http://www.w3.org/2005/Atom"
 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
 xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
 xmlns:georss="http://www.georss.org/georss"
 xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
 xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<atom:link href="https://tilde.town/~cryptk/blog/posts/rss.xml" rel="self" type="application/rss+xml" />
<title>(interzone)</title>
<link>https://tilde.town/~cryptk/blog/</link>
<description><![CDATA[Emacs Lisp Magick]]></description>
<language>en</language>
<lastBuildDate>Tue, 09 Jun 2026 16:02:30 -0300</lastBuildDate>
<generator>Emacs 30.2 org-publish-rss.el 0.8</generator>
<item>
<title>Keep your input, change the target</title>
<link>https://tilde.town/~cryptk/blog/posts/keep-your-input-change-the-target.html</link>
<pubDate>Sat, 30 May 2026 20:46:00 -0300</pubDate>
<guid>https://tilde.town/~cryptk/blog/posts/keep-your-input-change-the-target.html</guid>
<description>
<![CDATA[<p>
I rely on a common set of commands for lookup and jumping around. And more often than not, I&rsquo;m searching for something that I know exists somewhere, but it&rsquo;s not coming up in the results. Because I&rsquo;m typing in the wrong command interface.
</p>

<p>
And that&rsquo;s precisely the use case for <code>embark-become</code>.
</p>

<p>
I used <a href="https://github.com/oantolin/embark/">embark</a> mostly for jumping to commands&rsquo; definitions from within M-x and killing multiple buffers with <code>embark-act-all</code>. Re-reading its documentation, I found it already solves a problem I&rsquo;ve been tackling the hard way.
</p>

<p>
My partial solution was to keep some related commands on each other&rsquo;s keymaps, using <a href="https://github.com/minad/consult/">consult</a>&rsquo;s <code>consult-customize</code> macro. When I&rsquo;m in <code>consult-outline</code>, for example, I use the same keybinding to <i>escalate</i> my input to <code>consult-line</code>, and from there to <code>consult-line-multi</code>, which is very handy.
</p>

<p>
Still, that doesn&rsquo;t work as well for non-consult commands, and my workarounds were getting too involved and fragile. More importantly, they don&rsquo;t prevent me from invoking the wrong keybinding and having to start over.
</p>

<p>
What <a href="https://github.com/oantolin/embark/#switching-to-a-different-command-without-losing-what-youve-typed">embark-become</a> does is find related commands by looking for the current minibuffer command in the keymaps from <code>embark-become-keymaps</code>. It then manages to replace the current command with another one while preserving the input you&rsquo;ve just typed.
</p>

<p>
By <i>becoming</i> aware of that, I was able to erase many lines from my configuration and replace them with a custom keymap:
</p>

<div class="org-src-container">
<pre class="src src-emacs-lisp"><code><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">defvar-keymap</span> my/embark-become-map
    <span class="org-builtin">:doc</span> <span class="org-doc">"My common lookup commands."</span>
    <span class="org-string">"b"</span> #'consult-buffer
    <span class="org-string">"f"</span> #'find-file
    <span class="org-string">"x"</span> #'execute-extended-command
    <span class="org-string">"h"</span> #'consult-org-hop
    <span class="org-string">"q"</span> #'my/org-ql-find
    <span class="org-string">"s"</span> #'describe-symbol
    <span class="org-string">"l"</span> #'consult-line
    <span class="org-string">"L"</span> #'consult-line-multi
    <span class="org-string">"o"</span> #'consult-outline
    <span class="org-string">"i"</span> #'consult-imenu
    <span class="org-string">"I"</span> #'consult-imenu-multi
    <span class="org-string">"c"</span> #'my/org-capture-note<span class="org-rainbow-delimiters-depth-1">)</span>

<span class="org-rainbow-delimiters-depth-1">(</span>add-hook 'embark-become-keymaps 'my/embark-become-map<span class="org-rainbow-delimiters-depth-1">)</span>
</code></pre>
</div>

<p>
I also bound <code>embark-become</code> to <code>C-M-.</code> in the <code>minibuffer-local-map</code>.
</p>

<p>
Now, whenever I&rsquo;m typing something inside one of those commands, I can quickly switch to any other and keep the current input.
</p>
<div id="outline-container-orga06493f" class="outline-2">
<h2 id="orga06493f"><span class="section-number-2">1.</span> Custom commands</h2>
<div class="outline-text-2" id="text-1">
<p>
Three of the commands above are specific to my usual workflow.
</p>

<p>
<code>consult-org-hop</code> is from a package of mine, <a href="https://github.com/bcardoso/org-hop">org-hop</a>. I use it daily to hop to any Org heading from my files by searching for its title, outline path, or tags.
</p>

<p>
When I need to find something that may be present in the <i>contents</i> of a heading, I rely on <a href="https://github.com/alphapapa/org-ql">org-ql-find</a>:
</p>

<div class="org-src-container">
<pre class="src src-emacs-lisp"><code><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">defun</span> <span class="org-function-name">my/org-ql-find</span> <span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">&amp;optional</span> arg<span class="org-rainbow-delimiters-depth-2">)</span>
  <span class="org-doc">"Run `</span><span class="org-doc"><span class="org-constant">org-ql-find</span></span><span class="org-doc">' in Org mode buffers.</span>
<span class="org-doc">When ARG is non-nil, search only in current buffer."</span>
  <span class="org-rainbow-delimiters-depth-2">(</span><span class="org-keyword">interactive</span> <span class="org-string">"P"</span><span class="org-rainbow-delimiters-depth-2">)</span>
  <span class="org-rainbow-delimiters-depth-2">(</span><span class="org-keyword">let</span> <span class="org-rainbow-delimiters-depth-3">(</span><span class="org-rainbow-delimiters-depth-4">(</span>org-ql-default-predicate 'rifle<span class="org-rainbow-delimiters-depth-4">)</span><span class="org-rainbow-delimiters-depth-3">)</span>
    <span class="org-rainbow-delimiters-depth-3">(</span><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-4">(</span><span class="org-keyword">and</span> arg <span class="org-rainbow-delimiters-depth-5">(</span>derived-mode-p 'org-mode<span class="org-rainbow-delimiters-depth-5">)</span><span class="org-rainbow-delimiters-depth-4">)</span>
        <span class="org-rainbow-delimiters-depth-4">(</span>org-ql-find <span class="org-rainbow-delimiters-depth-5">(</span>current-buffer<span class="org-rainbow-delimiters-depth-5">)</span><span class="org-rainbow-delimiters-depth-4">)</span>
      <span class="org-rainbow-delimiters-depth-4">(</span>org-ql-find <span class="org-rainbow-delimiters-depth-5">(</span>org-buffer-list<span class="org-rainbow-delimiters-depth-5">)</span><span class="org-rainbow-delimiters-depth-4">)</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>
</code></pre>
</div>

<p>
If I&rsquo;m still unable to find what I want, or when the results aren&rsquo;t really related with the topic I&rsquo;m working on, I create a new note:
</p>

<div class="org-src-container">
<pre class="src src-emacs-lisp"><code><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">defun</span> <span class="org-function-name">my/org-capture-note</span> <span class="org-rainbow-delimiters-depth-2">(</span>input<span class="org-rainbow-delimiters-depth-2">)</span>
  <span class="org-doc">"Run Org capture from current minibuffer INPUT."</span>
  <span class="org-rainbow-delimiters-depth-2">(</span><span class="org-keyword">interactive</span> <span class="org-string">"sNew note title: "</span><span class="org-rainbow-delimiters-depth-2">)</span>
  <span class="org-rainbow-delimiters-depth-2">(</span>org-capture nil <span class="org-string">"n"</span><span class="org-rainbow-delimiters-depth-2">)</span>
  <span class="org-rainbow-delimiters-depth-2">(</span>insert <span class="org-rainbow-delimiters-depth-3">(</span><span class="org-keyword">or</span> input <span class="org-string">""</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span>
  <span class="org-rainbow-delimiters-depth-2">(</span>goto-char <span class="org-rainbow-delimiters-depth-3">(</span>point-max<span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>
</code></pre>
</div>

<p>
This command prompts for a note title, with the initial contents from the minibuffer input. After I adjust the writing, it runs <code>org-capture</code> and inserts the title where the template &ldquo;n&rdquo; leaves the cursor on in a regular capture. Finally, it moves the point to the end of the buffer, where I can proceed to write the new note&rsquo;s contents.
</p>
</div>
</div>
<div id="outline-container-orge28775d" class="outline-2">
<h2 id="orge28775d"><span class="section-number-2">2.</span> Final thoughts</h2>
<div class="outline-text-2" id="text-2">
<p>
With this simple setup, invoking a command by mistake becomes just a matter of reorientation, not interruption.
</p>

<p>
You keep moving forward by changing what you are <i>matching against</i>, and not what you are <i>typing for</i>.
</p>
</div>
</div>
]]>
</description></item>
<item>
<title>Hello, world</title>
<link>https://tilde.town/~cryptk/blog/posts/hello-world.html</link>
<pubDate>Sun, 24 May 2026 23:49:00 -0300</pubDate>
<guid>https://tilde.town/~cryptk/blog/posts/hello-world.html</guid>
<description>
<![CDATA[<p>
Welcome to <code>(interzone)</code>.
</p>

<p>
This blog will likely be mostly about Emacs.
</p>

<p>
I&rsquo;d been planning to do this for quite some time, but I kept putting it off. Finally, I managed to get it done. Here it is.
</p>

<p>
And here&rsquo;s <a href="https://tilde.town/~cryptk/blog/posts/../yaob.html">how I built it</a>.
</p>

<p>
Let&rsquo;s see how it unfolds.
</p>
]]>
</description></item>
</channel>
</rss>
