trying to fix

This commit is contained in:
Chris Cochrun 2022-01-03 12:41:35 -06:00
parent fa407dfeb6
commit e013d7569e
22945 changed files with 447936 additions and 0 deletions

View file

@ -0,0 +1,38 @@
<p>I dont know about you, but from time to time I definitely have the need to
re-run some Emacs command that takes user input (e.g. <code class="language-plaintext highlighter-rouge">query-replace</code>). For the
purpose of this article lets call such commands “complex” commands.
Obviously we can just invoke the same command, provide again the input (directly or using some parameter history if available), but it would be nice if there was
a faster way to do this.</p>
<p>As its usually the case with Emacs, such a way already exists - the
built-in command <code class="language-plaintext highlighter-rouge">repeat-complex-command</code>. By default its bound to both
<code class="language-plaintext highlighter-rouge">C-x M-:</code> and <code class="language-plaintext highlighter-rouge">C-x M-ESC</code>.<sup id="fnref:1"><a class="footnote" href="https://emacsredux.com/blog/2021/11/24/redo-complex-command/#fn:1" rel="footnote">1</a></sup> When you invoke the command youll see in the
minibuffer the last Emacs command you ran and you can use <code class="language-plaintext highlighter-rouge">M-n</code> and <code class="language-plaintext highlighter-rouge">M-p</code> to move
forward and backward in the command history.</p>
<p>Youll notice that the commands are listed as Emacs Lisp code that you can edit
directly if needed. Youll also notice there are no commands that dont any parameters on the list. Imagine something like:</p>
<div class="language-emacs-lisp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">(</span><span class="nv">describe-key</span> <span class="o">'</span><span class="p">((</span><span class="s">"\272"</span> <span class="o">.</span> <span class="nv">[134217786]</span><span class="p">)))</span>
<span class="p">(</span><span class="nv">occur</span> <span class="s">"emacs"</span> <span class="no">nil</span><span class="p">)</span>
<span class="p">(</span><span class="nv">projectile-ag</span> <span class="s">"emacs"</span> <span class="no">nil</span><span class="p">)</span>
<span class="p">(</span><span class="nv">markdown-insert-gfm-code-block</span> <span class="s">"emacs-lisp"</span> <span class="no">nil</span><span class="p">)</span>
</code></pre></div></div>
<p>This might also give you a hint as to why the keybinding <code class="language-plaintext highlighter-rouge">C-x M-:</code> was chosen -
its pretty close to <code class="language-plaintext highlighter-rouge">M-:</code> (<code class="language-plaintext highlighter-rouge">eval-expression</code>), which allows you to run
arbitrary Emacs Lisp code from the minibuffer.</p>
<p>When it comes to Emacs were all constantly learning. I didnt know about this
command until several days ago I saw it in a
<a href="https://twitter.com/mickeynp/status/1457826371057639429?s=20">tweet</a> shared by
<a href="https://twitter.com/mickeynp">Mickey Petersen</a>, a true Master of Emacs. Thanks
for the tip, Mickey!</p>
<div class="footnotes">
<ol>
<li id="fn:1">
<p>Not exactly the most convenient keybindings, right? <a class="reversefootnote" href="https://emacsredux.com/blog/2021/11/24/redo-complex-command/#fnref:1">↩</a></p>
</li>
</ol>
</div>