<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>(or emacs</title>
 <link href="https://oremacs.com/atom.xml" rel="self"/>
 <link href="https://oremacs.com/"/>
 <updated>2021-12-31T18:36:15+01:00</updated>
 <id>https://oremacs.com</id>
 <author>
   <name></name>
   <email></email>
 </author>

 
 <entry>
   <title>Happy New Year 2022!</title>
   <link href="https://oremacs.com/2021/12/31/happy-new-year/"/>
   <updated>2021-12-31T00:00:00+01:00</updated>
   <id>https://oremacs.com/2021/12/31/happy-new-year</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;In 2020, I managed to squeeze out just one post. Well, 2021 ran out just as fast as 2020. So here we
are:&lt;/p&gt;

&lt;pre&gt;
  &lt;span class=&quot;diff-context&quot;&gt; 2020-12-31-happy-new-year.md&lt;/span&gt;
  &lt;span class=&quot;diff-indicator-added&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;diff-added&quot;&gt;2021-12-31-happy-new-year.md
&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;This year, I&amp;#39;ll review a really cool package I&amp;#39;ve found. It&amp;#39;s not new, I just didn&amp;#39;t manage to
stumble upon it over the years. So it&amp;#39;s new to me, and might be a useful pointer to others as well.&lt;/p&gt;

&lt;h2 id=&quot;emmet-mode&quot;&gt;Emmet-mode&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/smihica/emmet-mode&quot;&gt;Emmet-mode&lt;/a&gt; is a wonderful Emacs package which greatly
improves HTML code generation. It&amp;#39;s based on &lt;a href=&quot;https://emmet.io/&quot;&gt;Emmet&lt;/a&gt;, so you can read up on the
syntax &lt;a href=&quot;https://docs.emmet.io/abbreviations/syntax/&quot;&gt;here&lt;/a&gt;.  I&amp;#39;ve discovered it quite recently after
reading Arjen Wiersma&amp;#39;s
&lt;a href=&quot;https://arjenwiersma.nl/writeups/emacs/22-years-of-emacs/&quot;&gt;22-years-of-emacs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The gist is that &lt;code&gt;ul#nav&amp;gt;li.item$*4&amp;gt;a{Item $}&lt;/code&gt; will expand to:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;nav&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;item1&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;Item 1&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;item2&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;Item 2&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;item3&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;Item 3&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;item4&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;Item 4&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above reminded me of &lt;a href=&quot;https://oremacs.com/2014/12/26/the-little-package-that-could/&quot;&gt;tiny.el&lt;/a&gt;,
the concept of using &lt;code&gt;*4&lt;/code&gt; to create four items, and &lt;code&gt;$&lt;/code&gt; for automatic numbering is very similar.&lt;/p&gt;

&lt;p&gt;Emmet goes above and beyond the 3 &lt;a href=&quot;https://github.com/joaotavora/yasnippet&quot;&gt;yasnippets&lt;/a&gt; I had in my
config for inserting HTML tags. Note also the handy &lt;code&gt;html:5&lt;/code&gt; snippet, which expands to:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!doctype html&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;en&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;UTF-8&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;Document&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And as a cherry on top, when used in &lt;code&gt;clojure-mode&lt;/code&gt;, these snippets will produce &lt;a href=&quot;https://github.com/weavejester/hiccup&quot;&gt;hiccup&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;getting-emmet-mode-for-free&quot;&gt;Getting emmet-mode for free&lt;/h2&gt;

&lt;p&gt;As I wrote &lt;a href=&quot;https://oremacs.com/2015/05/17/avy-goto-line/&quot;&gt;earlier&lt;/a&gt; (feels like ages ago), I like to
get functionality for free, i.e. without having to sacrifice any old key bindings or learning new
key bindings. So I&amp;#39;ve integrated the code of &lt;code&gt;emmet-expand-line&lt;/code&gt; with &lt;kbd&gt;C-o&lt;/kbd&gt; (&lt;code&gt;ora-open-line&lt;/code&gt;).
&lt;br&gt;&lt;a href=&quot;https://github.com/abo-abo/oremacs/blob/614aaac1b49bb61fecfeae4671ec78b863ab054e/keys.el#L347&quot;&gt;Here&lt;/a&gt; is the relevant cond branch:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;emmet-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emmet-expr-on-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;markup&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emmet-transform&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;first&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;second&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;third&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emmet-insert-and-flash&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;markup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emmet-reposition-cursor&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We check if &lt;code&gt;emmet-mode&lt;/code&gt; has detected a valid snippet at point. In that case, expand it. This allows
us to chain multiple snippet engines (like &lt;code&gt;yasnippet&lt;/code&gt;, &lt;code&gt;auto-yasnippet&lt;/code&gt;, &lt;code&gt;tiny&lt;/code&gt;, &lt;code&gt;emmet-mode&lt;/code&gt;), and
even provide a &lt;code&gt;hydra&lt;/code&gt; as a fallback for even more easy to reach commands on &lt;kbd&gt;C-o&lt;/kbd&gt;!&lt;/p&gt;

&lt;h2 id=&quot;personal&quot;&gt;Personal&lt;/h2&gt;

&lt;p&gt;Our son, Lev, was born on May 7, 2021. He is our love, happiness, our shining light in 2021.
And also the reason why I didn&amp;#39;t have too much free time to do Emacs stuff.
Big thanks to &lt;a href=&quot;https://github.com/basil-conto&quot;&gt;Basil L. Contovounesios&lt;/a&gt; for helping me maintain Ivy!
I&amp;#39;m hoping to be much more active on Github in 2022.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lev_1.jpg&quot; alt=&quot;Lev&quot;&gt;&lt;/p&gt;

&lt;p&gt;In other personal news, I&amp;#39;m currently looking for a new job as a Software Engineer.  If you&amp;#39;d like
me to work with you, please get in touch via &lt;a href=&quot;https://www.linkedin.com/in/oleh-krehel/&quot;&gt;LinkedIn&lt;/a&gt; or
&lt;a href=&quot;https://twitter.com/_abo_abo&quot;&gt;Twitter&lt;/a&gt;.  Also, a big thanks to everyone
&lt;a href=&quot;https://oremacs.com/donate/&quot;&gt;donating&lt;/a&gt; to support my open-source work. It means a lot.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I wish everyone reading this good health in 2022! And happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Happy New Year!</title>
   <link href="https://oremacs.com/2020/12/31/happy-new-year/"/>
   <updated>2020-12-31T00:00:00+01:00</updated>
   <id>https://oremacs.com/2020/12/31/happy-new-year</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;As 2020 is almost running out, I have noticed that I didn&amp;#39;t manage to post anything this year.  So
here&amp;#39;s a haphazard attempt to fix that.&lt;/p&gt;

&lt;h2 id=&quot;org-roam&quot;&gt;Org-roam&lt;/h2&gt;

&lt;p&gt;I&amp;#39;d like to share a wonderful Emacs package I&amp;#39;ve started using this year:
&lt;a href=&quot;https://github.com/org-roam/org-roam&quot;&gt;org-roam&lt;/a&gt;. Even though in my Org notes I see that I
encountered this package in February 2020, I&amp;#39;ve actually started using it on December 10, trying to
figure out what &lt;a href=&quot;https://en.wikipedia.org/wiki/Zettelkasten&quot;&gt;Zettelkasten&lt;/a&gt; are and how to deal with
them.&lt;/p&gt;

&lt;p&gt;Overall, 22 days isn&amp;#39;t a whole lot of experience, and I&amp;#39;m looking forward to see how useful
Zettelkasten and &lt;code&gt;org-roam&lt;/code&gt; will be to me in a year. But I already have written down 341 notes,
which amounts to around 15 notes per day.&lt;/p&gt;

&lt;p&gt;In my previous/current system, &lt;a href=&quot;https://github.com/abo-abo/plain-org-wiki&quot;&gt;plain-org-wiki&lt;/a&gt;, I
organize my knowledge into 209 tag categories. For instance, one of them, &lt;code&gt;Linux&lt;/code&gt;, has 290
entries. Another, &lt;code&gt;VPN&lt;/code&gt;, has 15 entries. I&amp;#39;ll show an example of how &lt;code&gt;org-roam&lt;/code&gt; improved my workflow
by showing a note I&amp;#39;ve added:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;#+title: Use a custom DNS when resolving a specific host on Linux&lt;/p&gt;

&lt;p&gt;On &lt;code&gt;Linux&lt;/code&gt;, I have a &lt;code&gt;DNS&lt;/code&gt; server that can resolve certain VPN-only websites.  But the problem is
that it&amp;#39;s only available if I&amp;#39;m connected to my work VPN. So I can&amp;#39;t configure it in a common way,
since the common way would simply use that DNS always, whether or not it&amp;#39;s up. The =dnsmasq=
package solves all these issues.&lt;/p&gt;

&lt;p&gt;The code: &lt;code&gt;local&lt;/code&gt;, and &lt;code&gt;permalink&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Above is one zettel - a note named &amp;quot;Use a custom DNS when resolving a specific host on Linux&amp;quot; that&amp;#39;s
liked to two other notes: &amp;quot;Linux&amp;quot;, and &amp;quot;DNS&amp;quot;. Both of those notes are basically empty files that are
used for tagging purposes. I use &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;org-roam-buffer-activate&lt;/code&gt; to see what other notes
are linked to them.&lt;/p&gt;

&lt;p&gt;Suppose, instead of using &lt;code&gt;org-roam&lt;/code&gt;, I wanted to add the above piece of knowledge to my old system
of tagged data. Does this information belong in &lt;code&gt;Linux.org&lt;/code&gt; or in &lt;code&gt;VPN.org&lt;/code&gt;? Moreover, do I really
want to add one more entry to &lt;code&gt;Linux.org&lt;/code&gt;? It&amp;#39;s getting really crowded with 290 entries already
there. So with the old system, it&amp;#39;s the anxiety on where to put the note combined with the pressure
of keeping it short. Both things are solved by using Zettelkasten!&lt;/p&gt;

&lt;h2 id=&quot;org-roam-config&quot;&gt;Org-roam config&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s &lt;a href=&quot;https://github.com/abo-abo/oremacs/blob/15e6a33d314121ea0b3f1659dbc3ee8181dce854/modes/ora-org-roam.el&quot;&gt;my config for
org-roam&lt;/a&gt;
so far.&lt;/p&gt;

&lt;p&gt;All of the functionality that I use is in the &lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt; below:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-org-roam&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:idle&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Launcher for &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`org-roam&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-roam-insert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;insert&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-org-roam-find-file&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;find-file&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-roam-buffer-activate&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;backlinks&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-roam-todo&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;todo&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The only difference between &lt;code&gt;ora-org-roam-find-file&lt;/code&gt; and &lt;code&gt;org-roam-find-file&lt;/code&gt; is that my variant
supports &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;ivy&lt;/a&gt; actions.&lt;/p&gt;

&lt;p&gt;And &lt;code&gt;ora-roam-todo&lt;/code&gt; is a small wrapper around this code, which gives me an overview of loose ends in
my notes that I&amp;#39;d like to follow up on:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;unread-command-events&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;listify-key-sequence&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c C-o M-&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;counsel-rg&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^\\* TODO&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-roam-directory&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;--sort modified&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What the above does technically: runs &lt;code&gt;counsel-rg&lt;/code&gt; on my &lt;code&gt;org-roam-directory&lt;/code&gt; looking for &lt;code&gt;* TODO&lt;/code&gt;,
while sorting on the file modification date, instead of the default sorting by path. Here, &lt;kbd&gt;C-c
C-o&lt;/kbd&gt; is the binding of &lt;code&gt;ivy-occur&lt;/code&gt;, and &lt;kbd&gt;M-&amp;gt;&lt;/kbd&gt; is &lt;code&gt;end-of-buffer&lt;/code&gt;. And the whole code
overall produces an ivy-occur buffer without having to go into minibuffer and press &lt;kbd&gt;C-c
C-o&lt;/kbd&gt; manually. The &lt;code&gt;unread-command-events&lt;/code&gt; trick is a nice way to automate this.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I&amp;#39;d like to thank the creators of &lt;code&gt;org-roam&lt;/code&gt;. Well done!&lt;/p&gt;

&lt;p&gt;Happy New Year! I wish everyone good health, justice, equality, and happiness!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy 0.13.0 is out</title>
   <link href="https://oremacs.com/2019/10/16/ivy-0.13.0/"/>
   <updated>2019-10-16T00:00:00+02:00</updated>
   <id>https://oremacs.com/2019/10/16/ivy-0.13.0</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Ivy&lt;/a&gt; is a completion method that&amp;#39;s
similar to &lt;code&gt;Ido&lt;/code&gt;, but with emphasis on simplicity and customizability.&lt;/p&gt;

&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;/h2&gt;

&lt;p&gt;The current release constitutes of 183 commits and 3 months of
progress since &lt;code&gt;0.12.0&lt;/code&gt;. Many issues ranging from
&lt;a href=&quot;https://github.com/abo-abo/swiper/issues/2153&quot;&gt;#2153&lt;/a&gt; to
&lt;a href=&quot;https://github.com/abo-abo/swiper/issues/2278&quot;&gt;#2278&lt;/a&gt; were fixed.
The number of people who contributed code as grown to form 148 to
&lt;a href=&quot;https://github.com/abo-abo/swiper/graphs/contributors&quot;&gt;160&lt;/a&gt;. Thanks,
everyone!&lt;/p&gt;

&lt;h2 id=&quot;details-on-changes&quot;&gt;Details on changes&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Changelog.org&lt;/code&gt; has been a part of the repository since &lt;code&gt;0.6.0&lt;/code&gt;, you
can get the details of the current and past changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;in &lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/doc/Changelog.org#0130&quot;&gt;org-mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;in &lt;a href=&quot;http://oremacs.com/swiper/Changelog#0.13.0&quot;&gt;HTML&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;highlights&quot;&gt;Highlights&lt;/h2&gt;

&lt;p&gt;Many improvements are incremental and don&amp;#39;t require any extra code to
enable.  I&amp;#39;ll go over a few selected features that require a bit of
information to make a good use of them.&lt;/p&gt;

&lt;h3 id=&quot;new-bindings&quot;&gt;New bindings&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-find-file&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;~~&lt;/kbd&gt; to move to the local home directory from remote or &lt;code&gt;/sudo::&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;/ RET ~&lt;/kbd&gt; achieves the same thing, but is longer.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-o R&lt;/kbd&gt; calls &lt;code&gt;find-file-read-only&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-git-grep&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-x C-d&lt;/kbd&gt; to switch the current directory.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swiper-isearch&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-o w&lt;/kbd&gt; to copy the current line and go back to where you started.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New features&lt;/h2&gt;

&lt;h3 id=&quot;counsel-package&quot;&gt;&lt;code&gt;counsel-package&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;The idea of &lt;code&gt;counsel-package&lt;/code&gt; is to install and remove packages with a single binding:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c P&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-package&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But if the package contents weren&amp;#39;t up to date, a separate &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;package-refresh-contents&lt;/code&gt;
had to be triggered, which was an annoying overhead. Now &lt;code&gt;counsel-package&lt;/code&gt; will look at the time
stamps of the appropriate &lt;code&gt;archive-contents&lt;/code&gt; files, and call &lt;code&gt;package-refresh-contents&lt;/code&gt; if the
timestamp is outdated by more than 4 hours.&lt;/p&gt;

&lt;h3 id=&quot;counsel-m-x&quot;&gt;&lt;code&gt;counsel-M-x&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Some commands are intended to be called only via their key binding. Make them disappear
from &lt;code&gt;counsel-M-x&lt;/code&gt; like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;put&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-find-symbol&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;no-counsel-M-x&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;counsel-rg&quot;&gt;&lt;code&gt;counsel-rg&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;The default setting of &lt;code&gt;ivy-case-fold-search-default&lt;/code&gt; is &lt;code&gt;&amp;#39;auto&lt;/code&gt;, which means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the input &amp;quot;emacs&amp;quot; matches &amp;quot;emacs&amp;quot;, &amp;quot;EMACS&amp;quot;, and &amp;quot;Emacs&amp;quot;&lt;/li&gt;
&lt;li&gt;the input &amp;quot;Emacs&amp;quot; matches only &amp;quot;Emacs&amp;quot;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This now also applies to &lt;code&gt;counsel-rg&lt;/code&gt;: Ivy will pass the &lt;code&gt;-i&lt;/code&gt; flag to &lt;code&gt;ripgrep&lt;/code&gt; appropriately, based
on &lt;code&gt;ivy-case-fold-search-default&lt;/code&gt;. You should remove the &lt;code&gt;-S&lt;/code&gt; flag from &lt;code&gt;counsel-rg-base-command&lt;/code&gt; if
you customized it.&lt;/p&gt;

&lt;h3 id=&quot;ivy-update-candidates&quot;&gt;&lt;code&gt;ivy-update-candidates&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is a new API for asynchronous calls. To use it, pass to &lt;code&gt;ivy-read&lt;/code&gt;: &lt;code&gt;:dynamic-collection t&lt;/code&gt;,
and a collection function that takes a user input string, starts some asynchronous process based on
that input, and returns &lt;code&gt;0&lt;/code&gt;. The &lt;code&gt;0&lt;/code&gt; return result tells Ivy that no candidates were returned;
instead, &lt;code&gt;ivy-update-candidates&lt;/code&gt; is used in the async callback.&lt;/p&gt;

&lt;p&gt;See &lt;code&gt;counsel-google&lt;/code&gt; for a reference implementation.&lt;/p&gt;

&lt;h3 id=&quot;ivy-use-virtual-buffers&quot;&gt;&lt;code&gt;ivy-use-virtual-buffers&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;You can now choose between: recent files, or bookmarks, or both, or none. Don&amp;#39;t forget that
&lt;code&gt;counsel-set-variable&lt;/code&gt; makes it very easy to set customization options.&lt;/p&gt;

&lt;h2 id=&quot;new-commands&quot;&gt;New Commands&lt;/h2&gt;

&lt;p&gt;I have put these separately so they don&amp;#39;t get lost in the crowd. Be sure to try them out.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-buffer-or-recentf&lt;/code&gt; - list buffers visiting files (highlighted) then the &lt;code&gt;recentf&lt;/code&gt; file
list.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-fonts&lt;/code&gt; - show a list of all supported font families for a particular frame.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-google&lt;/code&gt; - asynchronously query the Google predictive search API.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-major&lt;/code&gt; - switch &lt;code&gt;major-mode&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-slime-repl-history&lt;/code&gt; - browse SLIME REPL history.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Again, thanks to all the contributors. Happy hacking!&lt;/p&gt;

&lt;p&gt;PS. Thanks to everyone who supports me on &lt;a href=&quot;https://liberapay.com/abo-abo&quot;&gt;Liberapay&lt;/a&gt; and
&lt;a href=&quot;https://www.patreon.com/abo_abo&quot;&gt;Patreon&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;I am now also on &lt;a href=&quot;https://github.com/users/abo-abo/sponsorship&quot;&gt;Github sponsors&lt;/a&gt;, which is an
interesting new effort by Github. The cool thing is that&amp;#39;s more integrated with Github, there are
less transaction fees, and Github matches every donation for up to $5000 for a whole year.
Please consider joining there, since every $1 per month that you donate is doubled by Github.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy 0.12.0 is out</title>
   <link href="https://oremacs.com/2019/07/20/ivy-0.12.0/"/>
   <updated>2019-07-20T00:00:00+02:00</updated>
   <id>https://oremacs.com/2019/07/20/ivy-0.12.0</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Ivy&lt;/a&gt; is a completion method that&amp;#39;s
similar to &lt;code&gt;Ido&lt;/code&gt;, but with emphasis on simplicity and customizability.&lt;/p&gt;

&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;/h2&gt;

&lt;p&gt;The current release constitutes of 398 commits and 6 months of
progress since &lt;code&gt;0.11.0&lt;/code&gt;. Many issues ranging from
&lt;a href=&quot;https://github.com/abo-abo/swiper/issues/1904&quot;&gt;#1904&lt;/a&gt; to
&lt;a href=&quot;https://github.com/abo-abo/swiper/issues/2151&quot;&gt;#2151&lt;/a&gt; were fixed.
The number of people who contributed code as grown to
&lt;a href=&quot;https://github.com/abo-abo/swiper/graphs/contributors&quot;&gt;148&lt;/a&gt;. Thanks,
everyone!&lt;/p&gt;

&lt;h2 id=&quot;details-on-changes&quot;&gt;Details on changes&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Changelog.org&lt;/code&gt; has been a part of the repository since &lt;code&gt;0.6.0&lt;/code&gt;, you
can get the details of the current and past changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;in &lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/doc/Changelog.org#0120&quot;&gt;org-mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;in &lt;a href=&quot;http://oremacs.com/swiper/Changelog#0.12.0&quot;&gt;HTML&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;highlights&quot;&gt;Highlights&lt;/h2&gt;

&lt;p&gt;Many improvements are incremental and don&amp;#39;t require any extra code to
enable.  I&amp;#39;ll go over a few selected features that require a bit of
information to make a good use of them.&lt;/p&gt;

&lt;h3 id=&quot;new-bindings&quot;&gt;New bindings&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-descbinds&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-o x&lt;/kbd&gt; execute action.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-file-jump&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-o d&lt;/kbd&gt; dired.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-find-file&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-o c&lt;/kbd&gt; copy file.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;&amp;#96;&lt;/kbd&gt; bookmarks: efficiently jump between recent directories.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;$&lt;/kbd&gt; directories stored in environment variables.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-DEL&lt;/kbd&gt; go up directory. Customize: &lt;code&gt;counsel-up-directory-level&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;RET&lt;/kbd&gt; open file. Customize: &lt;code&gt;counsel-find-file-extern-extensions&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;//&lt;/kbd&gt; when on remote, cd to remote root.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;/ C-j&lt;/kbd&gt; select local root.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;~&lt;/kbd&gt; when on remote, cd to remote home.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;/ C-j ~&lt;/kbd&gt; cd to local home from remote.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-git-log&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-o v&lt;/kbd&gt; open the current commit in &lt;code&gt;magit&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-rg&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-x C-d&lt;/kbd&gt; change the current directory for grep.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-avy&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-v&lt;/kbd&gt; to scroll down.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-v&lt;/kbd&gt; to scroll up.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-read&lt;/code&gt; &lt;kbd&gt;C-o&lt;/kbd&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;m&lt;/kbd&gt; mark and move down.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;u&lt;/kbd&gt; unmark and move down.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;DEL&lt;/kbd&gt; move up and unmark.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;t&lt;/kbd&gt; toggle marks.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;d&lt;/kbd&gt; perform the action on all marked elements.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-switch-buffer&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-k&lt;/kbd&gt; kill buffer.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-o x&lt;/kbd&gt; open buffer file externally.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-reverse-i-search&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-k&lt;/kbd&gt; remove item from the history.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-commands-extensions&quot;&gt;New Commands extensions&lt;/h2&gt;

&lt;p&gt;These commands are new variants and adaptations of existing commands.&lt;/p&gt;

&lt;p&gt;Thing at point variants:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;swiper-all-thing-at-point&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swiper-isearch-thing-at-point&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swiper-thing-at-point&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Search variants that go backwards:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;swiper-backward&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-grep-or-swiper-backward&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swiper-isearch-backward.&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A variant of &lt;code&gt;ivy-switch-buffer&lt;/code&gt; with live preview:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-switch-buffer&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-switch-buffer-other-window&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And finally:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-dired&lt;/code&gt; - like &lt;code&gt;counsel-find-file&lt;/code&gt;, but open &lt;code&gt;dired&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swiper-isearch-toggle&lt;/code&gt; - toggle between &lt;code&gt;swiper&lt;/code&gt; and &lt;code&gt;isearch&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-commands&quot;&gt;New Commands&lt;/h2&gt;

&lt;p&gt;I have put these separately so they don&amp;#39;t get lost in the crowd. Be sure to try them out.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-compile&lt;/code&gt; - completion for &lt;code&gt;compile&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-register&lt;/code&gt; - completion for registers.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-minor&lt;/code&gt; - completion for minor modes.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swiper-isearch&lt;/code&gt; - a faster &lt;code&gt;swiper&lt;/code&gt; that&amp;#39;s not line-based.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Again, thanks to all the contributors. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy reverse-i-search</title>
   <link href="https://oremacs.com/2019/07/09/ivy-reverse-i-search/"/>
   <updated>2019-07-09T00:00:00+02:00</updated>
   <id>https://oremacs.com/2019/07/09/ivy-reverse-i-search</id>
   <content type="html">&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;

&lt;p&gt;I&amp;#39;m sure many are aware of the &lt;kbd&gt;C-r&lt;/kbd&gt; functionality in &lt;a href=&quot;https://www.gnu.org/software/bash/manual/html_node/Commands-For-History.html#Commands-For-History&quot;&gt;bash&lt;/a&gt; (a whole lot of Emacs
bindings are valid in bash and do the same thing). I also like the quirky Emacs-style prompt, that
uses a backquote to open and a straight quote to close a your quoted input:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/bash-reverse-i-search.png&quot; alt=&quot;bash-reverse-i-search.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;So when you want to &lt;code&gt;cd&lt;/code&gt; to somewhere where you were before you do &lt;kbd&gt;C-r&lt;/kbd&gt; &lt;code&gt;cd&lt;/code&gt;. And then the
&lt;kbd&gt;C-r&lt;/kbd&gt; &amp;quot;roulette&amp;quot; begins: you keep pressing &lt;kbd&gt;C-r&lt;/kbd&gt; over and over, in the hopes to find
what you were looking for.&lt;/p&gt;

&lt;h2 id=&quot;getting-better-history-completion-with-ivy&quot;&gt;Getting better history completion with Ivy&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Ivy&lt;/a&gt; improves the &amp;quot;roulette&amp;quot; situation in two ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You get an overview of the matching candidates and their count,&lt;/li&gt;
&lt;li&gt;You can quickly narrow down the candidates with fuzzy matching.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here&amp;#39;s the basic setup to enable &lt;kbd&gt;C-r&lt;/kbd&gt; completion using ivy:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;minibuffer-local-map&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-r&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-minibuffer-history&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;shell-mode-map&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-r&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-shell-history&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The first key binding is also part of &lt;code&gt;counsel-mode&lt;/code&gt;, while the second needs to be set up separately,
after &lt;code&gt;shell-mode&lt;/code&gt; was loaded.&lt;/p&gt;

&lt;p&gt;And here&amp;#39;s how &lt;code&gt;counsel-shell-history&lt;/code&gt; looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-shell-history.png&quot; alt=&quot;counsel-shell-history.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;The cool thing is that &lt;code&gt;ivy-reverse-i-search&lt;/code&gt; applies to &lt;em&gt;any&lt;/em&gt; Ivy command, not just for shell
command completion. I find it especially useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-find-file&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;eval-expression&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;recent-improvement-delete-history-items&quot;&gt;Recent improvement: delete history items&lt;/h2&gt;

&lt;p&gt;While searching with regexes is great, it&amp;#39;s not so great when the old stuff that we won&amp;#39;t ever need
gets in the way. So now you can delete it with &lt;kbd&gt;C-k&lt;/kbd&gt;. Since &lt;kbd&gt;C-k&lt;/kbd&gt; also has to
serve as &lt;code&gt;ivy-kill-line&lt;/code&gt;, the history deleting behavior will only come into effect when the point is
at the end of the line (so that &lt;code&gt;ivy-kill-line&lt;/code&gt; does not make sense anyway).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-reverse-i-search-kill.png&quot; alt=&quot;ivy-reverse-i-search-kill.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;This way, your typos don&amp;#39;t stay around to haunt you.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope you&amp;#39;ll find &lt;code&gt;ivy-reverse-i-search&lt;/code&gt; a useful boost to your completion needs. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy usability improvements when dealing with directories</title>
   <link href="https://oremacs.com/2019/06/27/ivy-directory-improvements/"/>
   <updated>2019-06-27T00:00:00+02:00</updated>
   <id>https://oremacs.com/2019/06/27/ivy-directory-improvements</id>
   <content type="html">&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;

&lt;p&gt;When &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Ivy&lt;/a&gt; just started out as a completion framework, the
functionality was supposed to be simple: select one string from a list of strings. The UI is simple
enough:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Show the list of strings that match the entered text,&lt;/li&gt;
&lt;li&gt;Use &lt;kbd&gt;C-n&lt;/kbd&gt; and &lt;kbd&gt;C-p&lt;/kbd&gt; to navigate them,&lt;/li&gt;
&lt;li&gt;Use &lt;kbd&gt;C-m&lt;/kbd&gt; or &lt;kbd&gt;C-j&lt;/kbd&gt; to submit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Emacs has three key bindings that mean &amp;quot;Enter&amp;quot;: &lt;kbd&gt;RET&lt;/kbd&gt;, &lt;kbd&gt;C-m&lt;/kbd&gt;, and
&lt;kbd&gt;C-j&lt;/kbd&gt;. But in terminal mode, &lt;code&gt;emacs -nw&lt;/code&gt;, &lt;kbd&gt;RET&lt;/kbd&gt; and &lt;kbd&gt;C-m&lt;/kbd&gt; are the same
binding: Emacs can&amp;#39;t distinguish them. So we have at most two bindings. Fortunately, the world of
completion is simple at the moment, and we only need one binding.&lt;/p&gt;

&lt;h2 id=&quot;file-name-completion&quot;&gt;File name completion&lt;/h2&gt;

&lt;p&gt;Enter file name completion. When you&amp;#39;re completing file names, you are selecting not one string, but
many strings in succession while moving from one directory to the next. So we need at least two key
bindings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;kbd&gt;C-m&lt;/kbd&gt; (&lt;code&gt;ivy-done&lt;/code&gt;) to select the current candidate and exit completion.&lt;/li&gt;
&lt;li&gt;Use &lt;kbd&gt;C-j&lt;/kbd&gt; (&lt;code&gt;ivy-alt-done&lt;/code&gt;) to change the current directory to the current candidate without exiting completion.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What to do when &lt;kbd&gt;C-j&lt;/kbd&gt; is used on a file and not on a directory? Might as well open the
file: same action as &lt;kbd&gt;C-m&lt;/kbd&gt;. OK, we had two key bindings, and we have used them. Hopefully
nothing else comes up.&lt;/p&gt;

&lt;p&gt;Enter creating a new file, i.e. selecting something that&amp;#39;s not on the list of strings.
Suppose I call &lt;code&gt;find-file&lt;/code&gt;, enter &amp;quot;do&amp;quot;, and the only match is a directory named &amp;quot;doc&amp;quot;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pressing &lt;kbd&gt;C-m&lt;/kbd&gt; will end completion with the &amp;quot;doc&amp;quot; directory selected.&lt;/li&gt;
&lt;li&gt;Pressing &lt;kbd&gt;C-j&lt;/kbd&gt; will continue completion inside the &amp;quot;doc&amp;quot; directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So creating a file named &amp;quot;do&amp;quot; is the third action. Our two &amp;quot;Enter&amp;quot; keybindings are already taken by
the first two different useful actions. So we need a third key binding. The one I chose is
&lt;kbd&gt;C-M-j&lt;/kbd&gt; (&lt;code&gt;ivy-immediate-done&lt;/code&gt;).  It means: I don&amp;#39;t care that the current input is not on
the list of candidate strings, submit it anyway.&lt;/p&gt;

&lt;h2 id=&quot;directory-creation&quot;&gt;Directory creation&lt;/h2&gt;

&lt;p&gt;Enter directory creation: &lt;code&gt;dired-create-directory&lt;/code&gt; and &lt;code&gt;make-directory&lt;/code&gt;. These built-in Emacs
commands request file name completion, but what they tell Ivy is no different from what &lt;code&gt;find-file&lt;/code&gt;
tells: &amp;quot;I want to select a file&amp;quot;. However, for these commands, the &lt;kbd&gt;C-M-j&lt;/kbd&gt; action is the
one that makes most sense. Here it would be nice for Ivy to take the back seat and just act like an
interactive &lt;code&gt;ls&lt;/code&gt;, since the user will enter a completely new string that&amp;#39;s not on the list of
candidates.&lt;/p&gt;

&lt;p&gt;For a long time, you still had to use &lt;kbd&gt;C-M-j&lt;/kbd&gt; with those commands, to much frustration of
new but also existing users, including myself. But a few days ago, I looked at the prompt that
&lt;code&gt;dired-create-directory&lt;/code&gt; uses: &amp;quot;Create directory: &amp;quot;. That prompt is passed to Ivy. Using the prompt
to detect the intention of the command is a bit of a hack, but I think in this case it&amp;#39;s
justifiable. So now Ivy will recognize that the intention commands that request file name completion
and pass the &amp;quot;Create directory: &amp;quot; prompt is to create a directory, and all key bindings will do just
that: &lt;kbd&gt;C-m&lt;/kbd&gt;, &lt;kbd&gt;C-j&lt;/kbd&gt;, and &lt;kbd&gt;C-M-j&lt;/kbd&gt; will behave the same in this case.&lt;/p&gt;

&lt;h2 id=&quot;an-alternative-key-binding-scheme&quot;&gt;An alternative key binding scheme&lt;/h2&gt;

&lt;p&gt;Note that &lt;kbd&gt;C-m&lt;/kbd&gt; and &lt;kbd&gt;C-j&lt;/kbd&gt; behave differently only for directories. But thanks to
the fact that &amp;quot;.&amp;quot; is always the first candidate, &lt;kbd&gt;C-m&lt;/kbd&gt; for directories is equivalent to
&lt;kbd&gt;C-j C-j&lt;/kbd&gt;. So we can get away with just using &lt;code&gt;ivy-alt-done&lt;/code&gt;, and bind &lt;kbd&gt;C-m&lt;/kbd&gt; to
&lt;code&gt;ivy-immediate-done&lt;/code&gt;. Or swap the two meanings:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-minibuffer-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-j&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-immediate-done&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-minibuffer-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-m&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-alt-done&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The price to pay here is the extra context switch when we simply want to select a directory.  We
could the bind &lt;code&gt;ivy-done&lt;/code&gt; to &lt;kbd&gt;C-M-j&lt;/kbd&gt; and avoid the context switch, but then we&amp;#39;re back to
three bindings once more. Still, I thought that swapping the bindings is an interesting idea worth
sharing.&lt;/p&gt;

&lt;h2 id=&quot;canceling-dired-dwim-target&quot;&gt;Canceling &lt;code&gt;dired-dwim-target&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Setting &lt;code&gt;dired-dwim-target&lt;/code&gt; is a nice productivity boost. It allows to use Emacs in a similar way to
a two-pane file explorer, like &lt;a href=&quot;https://linux.die.net/man/1/mc&quot;&gt;mc(1)&lt;/a&gt;. But it was really annoying when I was in &lt;code&gt;dir-1&lt;/code&gt; with the
intention to copy a file to a different name in &lt;code&gt;dir-1&lt;/code&gt; (e.g. create a backup, or copy a template),
but the current directory was set to &lt;code&gt;dir-2&lt;/code&gt; because of a random &lt;code&gt;dired&lt;/code&gt; window I had open. In that
case, I had to call &lt;code&gt;delete-other-windows&lt;/code&gt;, perform the copy, and then restore the window
configuration with &lt;code&gt;winner-undo&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I did the above many times over many years, until I finally dug into the code of &lt;code&gt;dired.el&lt;/code&gt; to see
how &lt;code&gt;dired-dwim-target&lt;/code&gt; worked. Turns out it was storing &lt;code&gt;dir-1&lt;/code&gt; in the &lt;code&gt;minibuffer-defaults&lt;/code&gt;
variable.  So now Ivy will use that variable when I press &lt;kbd&gt;M-n&lt;/kbd&gt;. All in all, it was a five
minute fix.  But rather than regret that I didn&amp;#39;t do it years ago, I&amp;#39;m glad I did it now. It only
remains to build some muscle memory to press &lt;kbd&gt;M-n&lt;/kbd&gt; in that situation.&lt;/p&gt;

&lt;p&gt;I&amp;#39;m guesstimating that &lt;code&gt;dired-dwim-target&lt;/code&gt; works to my advantage 90% of the time when I press
&lt;kbd&gt;C&lt;/kbd&gt; in &lt;code&gt;dired&lt;/code&gt;.  For the other 10% of the times, I can now press &lt;kbd&gt;M-n&lt;/kbd&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope you find the new functionality useful. I&amp;#39;m always open to &lt;a href=&quot;https://github.com/abo-abo/swiper/issues/&quot;&gt;new ideas and pull
requests&lt;/a&gt;. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>hydra 0.15.0 is out</title>
   <link href="https://oremacs.com/2019/05/18/hydra-0.15.0/"/>
   <updated>2019-05-18T00:00:00+02:00</updated>
   <id>https://oremacs.com/2019/05/18/hydra-0.15.0</id>
   <content type="html">&lt;p&gt;This release consists of 45 commits done over the course of the last 2 years. With this version, I
have introduced a
&lt;a href=&quot;https://github.com/abo-abo/hydra/blob/f27fce1b2f0a9162e159557bdeb2c0c94defb4d2/doc/Changelog.org#0150&quot;&gt;Changelog.org&lt;/a&gt;,
similar to what &lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/doc/Changelog.org&quot;&gt;ivy&lt;/a&gt; and
&lt;a href=&quot;https://github.com/abo-abo/avy/blob/master/doc/Changelog.org&quot;&gt;avy&lt;/a&gt; have.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/Hydra.jpg&quot; alt=&quot;hydra&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;highlights&quot;&gt;Highlights&lt;/h2&gt;

&lt;h3 id=&quot;display-hints-using-posframe&quot;&gt;Display hints using posframe&lt;/h3&gt;

&lt;p&gt;A new defcustom &lt;code&gt;hydra-hint-display-type&lt;/code&gt; was introduced that can be either &lt;code&gt;lv&lt;/code&gt; (the default),
&lt;code&gt;message&lt;/code&gt;, or &lt;code&gt;posframe&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/tumashu/posframe&quot;&gt;Posframe&lt;/a&gt; is a package that leverages a new feature in Emacs
26.1: the ability to display child frames. The advantage of using child frames is that you can
easily position them anywhere within your frame area. For example, the default setting is to put it
in the center of the current window, which is closer to where your eyes are focused than the
minibuffer. Child frames don&amp;#39;t interfere with the content of the buffers which they
overlap. Finally, you can select a different font for the child frame.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-posframe.png&quot; alt=&quot;hydra-posframe&quot;&gt;&lt;/p&gt;

&lt;h3 id=&quot;less-boilerplate-in-defhydra&quot;&gt;Less boilerplate in defhydra&lt;/h3&gt;

&lt;p&gt;You no longer have to add &lt;code&gt;:hint nil&lt;/code&gt;, and you can skip the docstring as well:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-clock&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:column&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Clock&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-clock-cancel&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:column&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Do&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-clock-display&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;display&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-clock-modify-effort-estimate&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;effort&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-clock-in&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;in&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-clock-goto&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;jump&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-clock-out&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;out&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-clock-report&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;report&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;add-heads-to-an-existing-hydra&quot;&gt;Add heads to an existing hydra&lt;/h3&gt;

&lt;p&gt;You can now add heads to an existing hydra like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-extendable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;extendable&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;down&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra+&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-extendable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;up&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The new macro &lt;code&gt;defhydra+&lt;/code&gt; takes the same arguments as &lt;code&gt;defhydra&lt;/code&gt;, so it&amp;#39;s quite easy to split up or
join your hydras.&lt;/p&gt;

&lt;p&gt;The use case of &lt;code&gt;defhydra+&lt;/code&gt; is when you have many packages that want to add heads to an existing
hydra. Some of them may be optional or loaded lazily.&lt;/p&gt;

&lt;p&gt;You can now have a base &lt;code&gt;defhydra&lt;/code&gt;, and then use &lt;code&gt;defhydra+&lt;/code&gt; to add heads to it when a new package
is loaded. Example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-toggle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:column&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Exit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;whitespace-mode&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;whitespace-mode: %S&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;whitespace-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;nb&quot;&gt;:column&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Toggles&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;use-package&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;:config&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra+&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-toggle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-toggle-link-display&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;org link display: %S&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-descriptive-links&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Big thanks to all contributors, and I hope you enjoy the new release. Happy hacking!&lt;/p&gt;

&lt;p&gt;PS. Thanks to everyone who supports me on &lt;a href=&quot;https://liberapay.com/abo-abo&quot;&gt;Liberapay&lt;/a&gt; and
&lt;a href=&quot;https://www.patreon.com/abo_abo&quot;&gt;Patreon&lt;/a&gt;!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>avy 0.5.0 is out</title>
   <link href="https://oremacs.com/2019/05/11/avy-0.5.0/"/>
   <updated>2019-05-11T00:00:00+02:00</updated>
   <id>https://oremacs.com/2019/05/11/avy-0.5.0</id>
   <content type="html">&lt;p&gt;This release consists of 109 commits done over the course of the last 3 years by me and many
&lt;a href=&quot;https://github.com/abo-abo/avy/graphs/contributors&quot;&gt;contributors&lt;/a&gt;. Similarly to the &lt;code&gt;0.4.0&lt;/code&gt;
release, the release notes are in
&lt;a href=&quot;https://github.com/abo-abo/avy/blob/master/doc/Changelog.org#050&quot;&gt;Changelog.org&lt;/a&gt;. I recommend
reading them &lt;a href=&quot;https://raw.githubusercontent.com/abo-abo/avy/master/doc/Changelog.org&quot;&gt;inside Emacs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/wiki/abo-abo/avy/images/avy-avatar-1.png&quot; alt=&quot;avy.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;highlights&quot;&gt;Highlights&lt;/h2&gt;

&lt;p&gt;A lot of new code is just straight upgrades, you don&amp;#39;t need to do
anything extra to use them. Below, I&amp;#39;ll describe the other part of the
new code, which is new commands and custom vars.&lt;/p&gt;

&lt;h3 id=&quot;new-api-functions&quot;&gt;New API functions&lt;/h3&gt;

&lt;p&gt;New functions have been added as drop-in replacements of double-dash (private) Avy functions that
were used in other packages and configs. Please replace the references to the obsolete functions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;avy-jump&lt;/code&gt; is a drop-in replacement of &lt;code&gt;avy--generic-jump&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;&lt;code&gt;avy-process&lt;/code&gt; is a drop-in replacement of &lt;code&gt;avy--process&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;new-dispatch-actions&quot;&gt;New dispatch actions&lt;/h3&gt;

&lt;p&gt;The concept of dispatch actions was introduced in &lt;a href=&quot;https://oremacs.com/2016/01/23/avy-0.4.0/&quot;&gt;0.4.0&lt;/a&gt;.
Suppose you have bound:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-t&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avy-goto-word-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and a word that starts with a &amp;quot;w&amp;quot; and is select-able with &amp;quot;a&amp;quot;. Here&amp;#39;s what you can do now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-t w a&lt;/kbd&gt; to jump there&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-t w x a&lt;/kbd&gt; - &lt;code&gt;avy-action-kill-move&lt;/code&gt;: kill the word and move there,&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-t w X a&lt;/kbd&gt; - &lt;code&gt;avy-action-kill-stay&lt;/code&gt;: kill the word without moving the point,&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-t w i a&lt;/kbd&gt; - &lt;code&gt;avy-action-ispell&lt;/code&gt;: use ispell/flyspell to correct the word,&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-t w y a&lt;/kbd&gt; - &lt;code&gt;avy-action-yank&lt;/code&gt;: yank the word at point,&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-t w t a&lt;/kbd&gt; - &lt;code&gt;avy-action-teleport&lt;/code&gt;: kill the word and yank it at point,&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-t w z a&lt;/kbd&gt; - &lt;code&gt;avy-action-zap-to-char&lt;/code&gt;: kill from point up to selected point.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can customize &lt;code&gt;avy-dispatch-alist&lt;/code&gt; to modify these actions, and also ensure that there&amp;#39;s no
overlap with your &lt;code&gt;avy-keys&lt;/code&gt;, if you customized them.&lt;/p&gt;

&lt;h3 id=&quot;new-avy-style-setting-words&quot;&gt;New &lt;code&gt;avy-style&lt;/code&gt; setting: &amp;#39;words&lt;/h3&gt;

&lt;p&gt;You can now customize:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-style&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;words&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And you&amp;#39;ll see overlays like &amp;quot;by&amp;quot;, &amp;quot;if&amp;quot;, &amp;quot;is&amp;quot;, &amp;quot;it&amp;quot;, &amp;quot;my&amp;quot; for 2-letter sequences, and &amp;quot;can&amp;quot;, &amp;quot;car&amp;quot;,
&amp;quot;cog&amp;quot; for 3-letter sequences. You might find them easier to type than &amp;quot;hla&amp;quot;, &amp;quot;lls&amp;quot; and &amp;quot;jhl&amp;quot;. But
you will have to adjust your &lt;code&gt;avy-dispatch-alist&lt;/code&gt;, e.g. to use only upper case characters.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avy-style-words.png&quot; alt=&quot;avy-style-words&quot;&gt;&lt;/p&gt;

&lt;h3 id=&quot;avy-linum-mode&quot;&gt;&lt;code&gt;avy-linum-mode&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is feature is a mix of &lt;code&gt;linum-mode&lt;/code&gt; and &lt;code&gt;ace-window-display-mode&lt;/code&gt;. You&amp;#39;ll see the overlays when
you enable this mode, so that there&amp;#39;s less context switch when you call &lt;code&gt;avy-goto-line&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;restarting-an-avy-search&quot;&gt;Restarting an &lt;code&gt;avy&lt;/code&gt; search&lt;/h3&gt;

&lt;p&gt;Suppose you jumped to a word that starts with &amp;quot;a&amp;quot;. Now you want to jump to a different word that
also starts with &amp;quot;a&amp;quot;. You can use &lt;code&gt;avy-resume&lt;/code&gt; for this.&lt;/p&gt;

&lt;p&gt;Additionally, you can use &lt;code&gt;avy-next&lt;/code&gt; and &lt;code&gt;avy-prev&lt;/code&gt; to cycle between the last &lt;code&gt;avy&lt;/code&gt;
candidates. Here&amp;#39;s an example hydra to facilitate it:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-avy-cycle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-next&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;next&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-prev&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;prev&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-&amp;#39;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-avy-cycle/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Big thanks to all contributors, and I hope you enjoy the new release. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Change the current time in Org-mode</title>
   <link href="https://oremacs.com/2019/04/11/worf-change-time/"/>
   <updated>2019-04-11T00:00:00+02:00</updated>
   <id>https://oremacs.com/2019/04/11/worf-change-time</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;I&amp;#39;m constantly amazed by other people&amp;#39;s Org workflows. Now that &lt;a href=&quot;https://old.reddit.com/r/emacs/search?q=Weekly+tips+trick&amp;restrict_sr=on&amp;sort=relevance&amp;t=all&quot;&gt;the weekly tips&lt;/a&gt; are a
thing, I see more and more cool Org configs, and I&amp;#39;m inspired to get more organized myself.&lt;/p&gt;

&lt;p&gt;My own Org usage is simplistic in some areas, and quite advanced in others. While I wrote a lot of
code to manipulate Org files ( &lt;a href=&quot;https://github.com/abo-abo/worf&quot;&gt;worf&lt;/a&gt;,
&lt;a href=&quot;https://github.com/abo-abo/org-download&quot;&gt;org-download&lt;/a&gt;, &lt;a href=&quot;https://github.com/abo-abo/orca&quot;&gt;orca&lt;/a&gt;,
&lt;a href=&quot;https://github.com/abo-abo/org-fu&quot;&gt;org-fu&lt;/a&gt;, &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;counsel&lt;/a&gt;), the
amount of Org files and TODO items that I have isn&amp;#39;t huge:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;counsel-git&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;org$ !log&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; 174 items&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;counsel-rg&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\* DONE|CANCELLED|TODO&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; 8103 items&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Still, that&amp;#39;s enough to get out-of-date files: just today I dug up a file with 20 outstanding TODO
items that should have been canceled last November!&lt;/p&gt;

&lt;h2 id=&quot;how-to-close-20-todos-using-a-timestamp-in-the-past&quot;&gt;How to close 20 TODOs using a timestamp in the past&lt;/h2&gt;

&lt;p&gt;When I cancel an item, pressing &lt;kbd&gt;tc&lt;/kbd&gt; (mnemonic for TODO-Cancel), Org mode inserts a time
stamp with the current time. However, for this file, I wanted to use October 31st 2018 instead of
the current time. Org mode already has options like &lt;code&gt;org-use-last-clock-out-time-as-effective-time&lt;/code&gt;,
&lt;code&gt;org-use-effective-time&lt;/code&gt;, and &lt;code&gt;org-extend-today-until&lt;/code&gt; that manipulate the current time for
timestamps, but they didn&amp;#39;t fit my use case.&lt;/p&gt;

&lt;p&gt;So I&amp;#39;ve advised &lt;code&gt;org-current-effective-time&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defvar-local&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;worf--current-effective-time&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;worf--current-effective-time&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;orig-fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;worf--current-effective-time&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;funcall&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;orig-fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;advice-add&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;org-current-effective-time&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:around&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;worf--current-effective-time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;worf-change-time&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Set &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`current-time&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; in the current buffer for &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`org-todo&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Use &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`keyboard-quit&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; to unset it.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;worf--current-effective-time&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;condition-case&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-read-date&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;totime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;quit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A few things of note here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;worf--current-effective-time&lt;/code&gt; is buffer-local, so that it modifies time only for the current
buffer&lt;/li&gt;
&lt;li&gt;I re-use the awesome &lt;code&gt;org-read-date&lt;/code&gt; for a nice visual feedback when inputting the new time&lt;/li&gt;
&lt;li&gt;Instead of having a separate function to undo the current-time override, I capture the &lt;code&gt;quit&lt;/code&gt;
signal that &lt;kbd&gt;C-g&lt;/kbd&gt; sends.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;The above code is already part of &lt;a href=&quot;https://github.com/abo-abo/worf&quot;&gt;worf&lt;/a&gt; and is bound to
&lt;kbd&gt;cT&lt;/kbd&gt;. I even added it to &lt;a href=&quot;https://oremacs.com/worf/README.html#worf-change-time&quot;&gt;the manual&lt;/a&gt;. I hope you find it useful. Happy organizing!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Swiper-isearch - a more isearch-like swiper</title>
   <link href="https://oremacs.com/2019/04/07/swiper-isearch/"/>
   <updated>2019-04-07T00:00:00+02:00</updated>
   <id>https://oremacs.com/2019/04/07/swiper-isearch</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;Since its introduction in 2015, &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt;, while nice most of the time, had two problems:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Slow startup for large buffers.&lt;/li&gt;
&lt;li&gt;Candidates were lines, so if you had two or more matches on the same line, the first one was selected.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Over time, workarounds were added to address these problems.&lt;/p&gt;

&lt;h2 id=&quot;problem-1-slow-startup&quot;&gt;Problem 1: slow startup&lt;/h2&gt;

&lt;p&gt;Almost right away, calling &lt;code&gt;font-lock-ensure&lt;/code&gt; was limited to only small enough buffers.&lt;/p&gt;

&lt;p&gt;In 2016, &lt;code&gt;counsel-grep-or-swiper&lt;/code&gt; was &lt;a href=&quot;https://oremacs.com/2016/04/26/ivy-0.8.0/&quot;&gt;introduced&lt;/a&gt;. It
uses an external process (&lt;code&gt;grep&lt;/code&gt;) to search through large files.&lt;/p&gt;

&lt;p&gt;In 2017, I found &lt;a href=&quot;https://github.com/BurntSushi/ripgrep&quot;&gt;ripgrep&lt;/a&gt;, which does a &lt;a href=&quot;https://oremacs.com/2017/08/04/ripgrep/&quot;&gt;better
job&lt;/a&gt; than &lt;code&gt;grep&lt;/code&gt; for searching one file:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-grep-base-command&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;&amp;quot;rg -i -M 120 --no-heading --line-number --color never %s %s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The advantage here is that the search can be performed on very large files. The trade-off is that we
have to type in at least 3 characters before we send it to the external process. Otherwise, when the
process returns a lot of results, Emacs will lag while receiving all that output.&lt;/p&gt;

&lt;h2 id=&quot;problem-2-candidates-are-lines&quot;&gt;Problem 2: candidates are lines&lt;/h2&gt;

&lt;p&gt;In 2015, &lt;code&gt;swiper-avy&lt;/code&gt; was &lt;a href=&quot;https://oremacs.com/2015/05/23/swiper-0.5.0/&quot;&gt;added&lt;/a&gt;, which could also be
used as a workaround for many candidates on a single line. Press &lt;kbd&gt;C-&amp;#39;&lt;/kbd&gt; to visually select
any candidate on screen using &lt;a href=&quot;https://github.com/abo-abo/avy&quot;&gt;avy&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;enter-swiper-isearch&quot;&gt;Enter &lt;code&gt;swiper-isearch&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Finally, less than a week ago, I wrote &lt;code&gt;swiper-isearch&lt;/code&gt; to fix &lt;a href=&quot;https://github.com/abo-abo/swiper/issues/1931&quot;&gt;#1931&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Differences from the previous commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Every candidate is a point position and not a line. The UX of going from one candidate to the next
is finally &lt;code&gt;isearch&lt;/code&gt;-like, I enjoy it a lot.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unlike &lt;code&gt;swiper&lt;/code&gt;, no line numbers are added to the candidates. This allows it to be as fast as
&lt;a href=&quot;https://github.com/syohex/emacs-anzu&quot;&gt;anzu&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unlike &lt;code&gt;counsel-grep&lt;/code&gt;, no external process is used. So you get feedback even after inputting a
single char.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I like it a lot so far, enough to make it my default search:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;swiper-isearch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Try out &lt;code&gt;swiper-isearch&lt;/code&gt;, see if it can replace &lt;code&gt;swiper&lt;/code&gt; for you; &lt;code&gt;counsel-grep-or-swiper&lt;/code&gt; still has
its place, I think. Happy hacking!&lt;/p&gt;

&lt;p&gt;PS. Thanks to everyone who supports me on &lt;a href=&quot;https://liberapay.com/abo-abo&quot;&gt;Liberapay&lt;/a&gt; and
&lt;a href=&quot;https://www.patreon.com/abo_abo&quot;&gt;Patreon&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;PPS. Thanks to everyone who contributes &lt;a href=&quot;https://github.com/abo-abo/swiper/&quot;&gt;issues and patches&lt;/a&gt;!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Progress bars for apt in shell</title>
   <link href="https://oremacs.com/2019/03/24/shell-apt/"/>
   <updated>2019-03-24T00:00:00+01:00</updated>
   <id>https://oremacs.com/2019/03/24/shell-apt</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;For a couple years now, I use &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;shell&lt;/code&gt; as my main shell. Recently, I have fixed one of
the minor annoyances that go along with using &lt;code&gt;shell&lt;/code&gt; in Emacs. At least since Ubuntu 18.04, the
terminal &amp;quot;progress bar&amp;quot; feature, displayed below is non-optional:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/apt-install-progress-1.png&quot; alt=&quot;apt-install-progress-1&quot;&gt;&lt;/p&gt;

&lt;p&gt;It uses terminal escape codes to display the progress bar, and &lt;code&gt;shell-mode&lt;/code&gt; can&amp;#39;t handle them well,
so they clobber a lot of the output.&lt;/p&gt;

&lt;h2 id=&quot;initial-work-around&quot;&gt;Initial work around&lt;/h2&gt;

&lt;p&gt;Previously, I was using this work around, since &lt;code&gt;apt-get&lt;/code&gt; doesn&amp;#39;t display the progress bar:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# sudo apt upgrade&lt;/span&gt;
sudo apt-get upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;progress-bar-in-the-mode-line&quot;&gt;Progress bar in the mode line&lt;/h2&gt;

&lt;p&gt;But typing 4 extra chars is hard. And &lt;code&gt;apt-get&lt;/code&gt; will likely get these progress bars at some point as
well. So I spent around an hour of my weekend hacking an Elisp solution. Here is the code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;advice-add&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;ansi-color-apply-on-region&lt;/span&gt;
 &lt;span class=&quot;nb&quot;&gt;:before&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ora-ansi-color-apply-on-region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-ansi-color-apply-on-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;begin&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Fix progress bars for e.g. apt(8).&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Display progress in the mode line instead.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;end-marker&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;copy-marker&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;mb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;copy-marker&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\0337&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;end-marker&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mb&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-beginning&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\0338&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;end-marker&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ora-apt-progress-message&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;substring-no-properties&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete-and-extract-region&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mb&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-apt-progress-message&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;progress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mode-line-process&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt;
             &lt;span class=&quot;s&quot;&gt;&amp;quot;Progress: \\[ *\\([0-9]+\\)%\\]&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;progress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;:%s &amp;quot;&lt;/span&gt;
                     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;progress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot;%%%% &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;:%s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;force-mode-line-update&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The solution will detect e.g. &lt;code&gt;&amp;quot;\0337...Progress: [ 25%]...\0338&amp;quot;&lt;/code&gt;, remove it from the shell buffer
and display &lt;code&gt;&amp;quot;25%&amp;quot;&lt;/code&gt; in the mode line instead.&lt;/p&gt;

&lt;h2 id=&quot;use-the-echo-area-instead-of-the-mode-line&quot;&gt;Use the Echo Area instead of the mode line&lt;/h2&gt;

&lt;p&gt;The above is a good enough solution specifically for &lt;code&gt;apt(8)&lt;/code&gt;, but not for the generic case. Let&amp;#39;s
try to emulate how e.g. &lt;code&gt;gnome-terminal&lt;/code&gt; handles these escape sequences.  It takes sequences like
&lt;code&gt;&amp;quot;\0337.*\0338&amp;quot;&lt;/code&gt; and displays them in the bottom of the window. Kind of like the Emacs Echo
Area. That&amp;#39;s easy enough to do:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-apt-progress-message&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;progress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;message&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;replace-regexp-in-string&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;%&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;%%&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ansi-color-apply&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;progress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Above, we use &lt;code&gt;ansi-color-apply&lt;/code&gt; to get rid of any extra terminal escape codes.  I decided to stay
with the Echo Area version instead of the mode line version. Here&amp;#39;s how it looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/apt-install-progress-2.png&quot; alt=&quot;apt-install-progress-2&quot;&gt;&lt;/p&gt;

&lt;p&gt;You can find all of the above code in &lt;a href=&quot;https://github.com/abo-abo/oremacs/blob/afa4d0e3b1a60467ec163220e9823d1f014ab6a4/modes/ora-shell.el&quot;&gt;my config&lt;/a&gt;.
Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Using exclusion patterns when grepping</title>
   <link href="https://oremacs.com/2018/03/05/grep-exclude/"/>
   <updated>2018-03-05T00:00:00+01:00</updated>
   <id>https://oremacs.com/2018/03/05/grep-exclude</id>
   <content type="html">&lt;h2 id=&quot;git&quot;&gt;Git&lt;/h2&gt;

&lt;p&gt;I like &lt;a href=&quot;https://git-scm.com/&quot;&gt;Git&lt;/a&gt;. A lot. After years of use it has
really grown on me. It&amp;#39;s (mostly) fast, (often) reliable, and (always)
distributed. For me, all properties are important, but being able to
do &lt;code&gt;git init&lt;/code&gt; to start a new project in seconds is the best feature.&lt;/p&gt;

&lt;p&gt;When it comes to working with Git day-to-day, a nice GUI can really
make a difference. In Emacs world, of course it&amp;#39;s
&lt;a href=&quot;https://magit.vc/&quot;&gt;Magit&lt;/a&gt;. Outside of Emacs (brr),
&lt;a href=&quot;https://git-cola.github.io/&quot;&gt;git-cola&lt;/a&gt; looks to be the most promising
one. If you&amp;#39;re aware of something better, please share - I&amp;#39;m keeping a
list of suggestions for my non-Emacs using colleagues.&lt;/p&gt;

&lt;h2 id=&quot;ivy-integration-for-git&quot;&gt;Ivy integration for Git&lt;/h2&gt;

&lt;p&gt;The main two commands in &lt;a href=&quot;https://github.com/abo-abo/swiper/&quot;&gt;ivy&lt;/a&gt;
that I use for Git are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-git&lt;/code&gt;: select a file tracked by Git&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-rg&lt;/code&gt;: grep for a line in all files tracked by Git, using
&lt;a href=&quot;https://github.com/BurntSushi/ripgrep&quot;&gt;ripgrep&lt;/a&gt; as the backend.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are many alternatives to &lt;code&gt;counsel-rg&lt;/code&gt; that use a different
backend: &lt;code&gt;counsel-git-grep&lt;/code&gt;, &lt;code&gt;counsel-ag&lt;/code&gt;, &lt;code&gt;counsel-ack&lt;/code&gt;,
&lt;code&gt;counsel-pt&lt;/code&gt;. But &lt;code&gt;counsel-rg&lt;/code&gt; is the fastest, especially when I have
to deal with Git repositories that are 2Gb in size (short explanation:
it&amp;#39;s a Perforce repo with a bunch of binaries, because why not; and
I&amp;#39;m using &lt;a href=&quot;https://git-scm.com/docs/git-p4&quot;&gt;git-p4&lt;/a&gt; to interact with
it).&lt;/p&gt;

&lt;h2 id=&quot;using-ignore-with-ripgrep&quot;&gt;Using &lt;code&gt;.ignore&lt;/code&gt; with ripgrep&lt;/h2&gt;

&lt;p&gt;Adding an &lt;code&gt;.ignore&lt;/code&gt; file to the root of your project can really speed
up your searches.  In my sample project, I went from 10k files to less
than 500 files.&lt;/p&gt;

&lt;p&gt;Example content:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;/TAGS
*.min.js*
/Build/Output/
/ThirdParty/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you can see, both file patterns and directories are supported.  One
other nifty thing that I discovered only recently is that you can use
&lt;code&gt;ripgrep&lt;/code&gt; as the backed for &lt;code&gt;counsel-git&lt;/code&gt; in addition to
&lt;code&gt;counsel-rg&lt;/code&gt;. Which means the same &lt;code&gt;.ignore&lt;/code&gt; file is used for both
commands. Here&amp;#39;s the setting:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-git-cmd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;rg --files&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here&amp;#39;s my setting for &lt;code&gt;counsel-rg&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-rg-base-command&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;&amp;quot;rg -i -M 120 --no-heading --line-number --color never %s .&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The main difference in comparison to the default
&lt;code&gt;counsel-rg-base-command&lt;/code&gt; is &lt;code&gt;-M 120&lt;/code&gt; which means: truncate all lines
that are longer than 120 characters. This is really helpful when Emacs
is accepting input from &lt;code&gt;ripgrep&lt;/code&gt;: a megabyte long line of minified JS
is not only useless since you can&amp;#39;t see it whole, but it will also
likely hang Emacs for a while.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope you found these bits of info useful. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Using digits to select company-mode candidates</title>
   <link href="https://oremacs.com/2017/12/27/company-numbers/"/>
   <updated>2017-12-27T00:00:00+01:00</updated>
   <id>https://oremacs.com/2017/12/27/company-numbers</id>
   <content type="html">&lt;p&gt;I&amp;#39;d like to share a customization of
&lt;a href=&quot;https://github.com/company-mode/company-mode&quot;&gt;company-mode&lt;/a&gt; that I&amp;#39;ve
been using for a while.  I refined it just recently, I&amp;#39;ll explain
below how.&lt;/p&gt;

&lt;h2 id=&quot;basic-setting&quot;&gt;Basic setting&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;company-show-numbers&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now, numbers are shown next to the candidates, although they don&amp;#39;t do
anything yet:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/company-numbers.png&quot; alt=&quot;company-numbers&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;add-some-bindings&quot;&gt;Add some bindings&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;company-active-map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapc&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;%d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ora-company-number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;number-sequence&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;company-abort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;self-insert-command&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;return&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Besides binding &lt;kbd&gt;0&lt;/kbd&gt;..&lt;kbd&gt;9&lt;/kbd&gt; to complete their
corresponding candidate, it also un-binds &lt;kbd&gt;RET&lt;/kbd&gt; and binds
&lt;kbd&gt;SPC&lt;/kbd&gt; to close the company popup.&lt;/p&gt;

&lt;h2 id=&quot;actual-code&quot;&gt;Actual code&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-company-number&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Forward to &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`company-complete-number&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;Unless the number is potentially part of the candidate.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;In that case, insert the number.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;k&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;this-command-keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;re&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;company-prefix&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cl-find-if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;re&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                    &lt;span class=&quot;nv&quot;&gt;company-candidates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;self-insert-command&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;company-complete-number&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-to-number&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Initially, I would just bind &lt;code&gt;company-complete-number&lt;/code&gt;. The problem
with that was that if my candidate list was &lt;code&gt;(&amp;quot;var0&amp;quot; &amp;quot;var1&amp;quot; &amp;quot;var2&amp;quot;)&lt;/code&gt;,
then entering &lt;kbd&gt;1&lt;/kbd&gt; means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;select the first candidate (i.e. &lt;code&gt;&amp;quot;var0&amp;quot;&lt;/code&gt;), instead of:&lt;/li&gt;
&lt;li&gt;insert &lt;code&gt;&amp;quot;1&amp;quot;&lt;/code&gt;, resulting in &lt;code&gt;&amp;quot;var1&amp;quot;&lt;/code&gt;, i.e. the second candidate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My customization will now check &lt;code&gt;company-candidates&lt;/code&gt;&amp;mdash;the list of
possible completions&amp;mdash;for the above mentioned conflict. And if
it&amp;#39;s detected, the key pressed will be inserted instead of being used
to select a candidate.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Looking at &lt;code&gt;git-log&lt;/code&gt;, I&amp;#39;ve been using &lt;code&gt;company-complete-number&lt;/code&gt; for at
least 3 years now.  It&amp;#39;s quite useful, and now also more seamless,
since I don&amp;#39;t have to type e.g. &lt;kbd&gt;C-q 2&lt;/kbd&gt; any more. In any
case, thanks to the author and the contributors of
&lt;code&gt;company-mode&lt;/code&gt;. Merry Christmas and happy hacking in the New Year!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Comparison of transaction fees on Patreon and similar services</title>
   <link href="https://oremacs.com/2017/12/10/patreon/"/>
   <updated>2017-12-10T00:00:00+01:00</updated>
   <id>https://oremacs.com/2017/12/10/patreon</id>
   <content type="html">&lt;p&gt;On December 7, Patreon made an announcement about the change in their
transaction fee structure. The results as of December 10 speak for
themselves:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;December 2017 summary: -$29 in pledges, -6 patrons&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;All leaving patrons marked &amp;quot;I&amp;#39;m not happy with Patreon&amp;#39;s features or
services.&amp;quot; as the reason for leaving, with quotes ranging from:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The billing changes are not great.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;to:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Patreon&amp;#39;s new fees are unacceptable&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this article, I will explore the currently available methods for
supporting sustainable Free Software development and compare their
transaction fees.&lt;/p&gt;

&lt;h2 id=&quot;my-experience&quot;&gt;My experience&lt;/h2&gt;

&lt;p&gt;My experience taking donations is very short. I announced my &lt;a href=&quot;http://oremacs.com/2017/10/18/patreon/&quot;&gt;fund
raising campaign&lt;/a&gt; on
&lt;a href=&quot;https://www.patreon.com/abo_abo&quot;&gt;Patreon&lt;/a&gt; in October 2017.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s what I collected so far, vs the actual money spent by the
contributors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2017-11-01: &lt;code&gt;$140.42 / $162.50 = 86.41%&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;2017-12-01: &lt;code&gt;$163.05 / $187.50 = 86.96%&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The numbers here are using the old Patreon rules that are going away
this month.&lt;/p&gt;

&lt;h2 id=&quot;real-numbers&quot;&gt;Real numbers&lt;/h2&gt;

&lt;table border=&quot;2&quot; cellspacing=&quot;0&quot; cellpadding=&quot;6&quot; rules=&quot;groups&quot; frame=&quot;hsides&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th scope=&quot;col&quot;&gt;&lt;b&gt;method&lt;/b&gt;&lt;/th&gt;
&lt;th scope=&quot;col&quot;&gt;&lt;b&gt;formula&lt;/b&gt;&lt;/th&gt;
&lt;th scope=&quot;col&quot;&gt;&lt;b&gt;charged&lt;/b&gt;&lt;/th&gt;
&lt;th scope=&quot;col&quot;&gt;&lt;b&gt;donated&lt;/b&gt;&lt;/th&gt;
&lt;th scope=&quot;col&quot;&gt;&lt;b&gt;fee&lt;/b&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;old Patreon&lt;/td&gt;
&lt;td&gt;???&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$0.86&lt;/td&gt;
&lt;td&gt;14%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;border-bottom: 2px solid #000;&quot;/&gt;
&lt;/tbody&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;new Patreon&lt;/td&gt;
&lt;td&gt;7.9% + $0.35&lt;/td&gt;
&lt;td&gt;$1.38&lt;/td&gt;
&lt;td&gt;$0.95&lt;/td&gt;
&lt;td&gt;31%&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;$2.41&lt;/td&gt;
&lt;td&gt;$1.90&lt;/td&gt;
&lt;td&gt;21%&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;$5.50&lt;/td&gt;
&lt;td&gt;$4.75&lt;/td&gt;
&lt;td&gt;14%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;border-bottom: 2px solid #000;&quot;/&gt;
&lt;/tbody&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;OpenCollective&lt;/td&gt;
&lt;td&gt;12.9% + $0.30&lt;/td&gt;
&lt;td&gt;$1.33&lt;/td&gt;
&lt;td&gt;$0.90&lt;/td&gt;
&lt;td&gt;32%&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;$2.36&lt;/td&gt;
&lt;td&gt;$1.80&lt;/td&gt;
&lt;td&gt;24%&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;$5.45&lt;/td&gt;
&lt;td&gt;$4.50&lt;/td&gt;
&lt;td&gt;18%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;border-bottom: 2px solid #000;&quot;/&gt;
&lt;/tbody&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Flattr&lt;/td&gt;
&lt;td&gt;16.5%&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$0.84&lt;/td&gt;
&lt;td&gt;17%&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$1.67&lt;/td&gt;
&lt;td&gt;17%&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;&amp;#xa0;&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$4.18&lt;/td&gt;
&lt;td&gt;17%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;border-bottom: 2px solid #000;&quot;/&gt;
&lt;/tbody&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Liberapay&lt;/td&gt;
&lt;td&gt;0.585%&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$0.99&lt;/td&gt;
&lt;td&gt;1%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;on-patreon&quot;&gt;On Patreon&lt;/h2&gt;

&lt;p&gt;Just like everyone else, I&amp;#39;m not happy with the incoming change to the
Patreon fees. But even after the change, it&amp;#39;s still a better deal than
OpenCollective, which is used quite successfully e.g. by
&lt;a href=&quot;https://opencollective.com/cider&quot;&gt;CIDER&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Just to restate the numbers in the table, if all backers give $1
(which is the majority currently, and I actually would generally
prefer 5 new $1 backers over 1 new $5 backer), with the old system I
get $0.86, while with the new system it&amp;#39;s $0.69. That&amp;#39;s more than 100%
increase in transaction fees.&lt;/p&gt;

&lt;h2 id=&quot;on-opencollective&quot;&gt;On OpenCollective&lt;/h2&gt;

&lt;p&gt;It&amp;#39;s more expensive than the new Patreon fees in every category or
scenario.&lt;/p&gt;

&lt;h2 id=&quot;on-flattr&quot;&gt;On Flattr&lt;/h2&gt;

&lt;p&gt;Flattr is in the same bucket as Patreon, except with slightly lower
fees currently. Their default plan sounds absolutely ridiculous to me:
you install a browser plug-in so that a for-profit corporation can
track which websites you visit most often in order to distribute the
payments you give them among those websites.&lt;/p&gt;

&lt;p&gt;If it were a completely local tool which doesn&amp;#39;t upload any data on
the internet and instead gives you a monthly report to adjust your
donations, it would have been a good enough tool. Maybe with some
adjustments for mind-share bubbles, which result in prominent projects
getting more rewards than they can handle, while small projects fade
away into obscurity without getting a chance. But right now it&amp;#39;s
completely crazy. Still, if you don&amp;#39;t install the plug-in, you can
probably still use Flattr and it will work similarly to Patreon.&lt;/p&gt;

&lt;p&gt;I made an &lt;a href=&quot;https://flattr.com/@abo-abo&quot;&gt;account&lt;/a&gt;, just in case, but I
wouldn&amp;#39;t recommend going to Flattr unless you&amp;#39;re already there, or the
first impression it made on me is wrong.&lt;/p&gt;

&lt;h2 id=&quot;on-paypal&quot;&gt;On Paypal&lt;/h2&gt;

&lt;p&gt;Paypal is OK in a way, since a lot of the time the organizations like
Patreon are just middle men on top of Paypal. On the other hand,
there&amp;#39;s no way to set up recurring donations. And it&amp;#39;s harder for me
to plan decisions regarding my livelihood if I don&amp;#39;t know at least
approximately the sum I&amp;#39;ll be getting next month.&lt;/p&gt;

&lt;p&gt;My account, in case you want to make a lump sum donation:
&lt;a href=&quot;https://paypal.me/aboabo&quot;&gt;paypal.me/aboabo&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;on-bitcoin&quot;&gt;On Bitcoin&lt;/h2&gt;

&lt;p&gt;Bitcoin is similar to Paypal, except it also:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;has a very bad impact on the environment,&lt;/li&gt;
&lt;li&gt;is a speculative bubble that supports either earning or losing money
without actually providing value to the society.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I prefer to stay away from Bitcoin.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://liberapay.com/abo-abo&quot;&gt;Liberapay&lt;/a&gt; sounds almost too good to
be true. At the same time, their fees are very realistic, you could
almost say optimal, since there are &lt;em&gt;no fees&lt;/em&gt; for transfers between
members. So you can spend either €20.64 (via card) or €20.12 (via bank
wire) to charge €20 into your account and give me €1 per month at no
further cost. If you change your mind after one month, you can
withdraw your remaining €19 for free if you use a SEPA (Single Euro
Payments Area) bank.&lt;/p&gt;

&lt;p&gt;If I set out today to set up a service similar to Liberapay, even with
my best intentions and the most optimistic expectations, I don&amp;#39;t see
how a better offer could be made. I recommend anyone who wants to
support me to try it out. And, of course, I will report back with real
numbers if anything comes out of it.&lt;/p&gt;

&lt;p&gt;Thanks to all my patrons for their former and ongoing support.  At one
point we were at 30% of the monthly goal (25% atm.). This made me very
excited and optimistic about the future. Although I&amp;#39;m doing Free
Software for almost 5 years now, it&amp;#39;s actually 3 years in academia and
2 years in industry. Right now, I&amp;#39;m feeling a burnout looming over the
horizon, and I was really hoping to avoid it by spending less time
working at for-profit corporations. Any help, either monetary or
advice is appreciated. If you&amp;#39;re a part of a Software Engineering or a
Research collective that makes you feel inspired instead of exhausted
in the evening and you have open positions in EU or on remote, have a
look at my &lt;a href=&quot;https://www.linkedin.com/in/oleh-krehel/&quot;&gt;LinkedIn&lt;/a&gt; -
maybe we could become colleagues in the future. I&amp;#39;ll accept
connections from anyone - if you&amp;#39;re reading this blog, we probably
have a lot in common; and it&amp;#39;s always better together.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy 0.10.0 is out</title>
   <link href="https://oremacs.com/2017/11/30/ivy-0.10.0/"/>
   <updated>2017-11-30T00:00:00+01:00</updated>
   <id>https://oremacs.com/2017/11/30/ivy-0.10.0</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Ivy&lt;/a&gt; is a completion method that&amp;#39;s
similar to &lt;code&gt;Ido&lt;/code&gt;, but with emphasis on simplicity and customizability.&lt;/p&gt;

&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;/h2&gt;

&lt;p&gt;The current release constitutes of 280 commits and 8 months of
progress since &lt;code&gt;0.9.0&lt;/code&gt;. Many issues ranging from
&lt;a href=&quot;https://github.com/abo-abo/swiper/issues/952&quot;&gt;#952&lt;/a&gt; to
&lt;a href=&quot;https://github.com/abo-abo/swiper/issues/1336&quot;&gt;#1336&lt;/a&gt; were fixed.
The number of people who contributed code as grown to
&lt;a href=&quot;https://github.com/abo-abo/swiper/graphs/contributors&quot;&gt;91&lt;/a&gt;; thanks,
everyone!&lt;/p&gt;

&lt;h2 id=&quot;details-on-changes&quot;&gt;Details on changes&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Changelog.org&lt;/code&gt; has been a part of the repository since &lt;code&gt;0.6.0&lt;/code&gt;, you
can get the details of the current and past changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;in &lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/doc/Changelog.org#0100&quot;&gt;org-mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;in &lt;a href=&quot;http://oremacs.com/swiper/Changelog#0-10-0&quot;&gt;HTML&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;highlights&quot;&gt;Highlights&lt;/h2&gt;

&lt;p&gt;Many improvements are incremental and don&amp;#39;t require any extra code to
enable.  I&amp;#39;ll go over a few selected features that require a bit of
information to make a good use of them.&lt;/p&gt;

&lt;h3 id=&quot;selectable-prompt&quot;&gt;Selectable prompt&lt;/h3&gt;

&lt;p&gt;Off by default. You can turn it on like so:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-use-selectable-prompt&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After this, your current input becomes selectable as a
candidate. Press &lt;kbd&gt;C-p&lt;/kbd&gt; when you&amp;#39;re on the first candidate to
select your input instead.&lt;/p&gt;

&lt;p&gt;This solves the long standing issue of e.g. creating a file or
a directory &lt;code&gt;foo&lt;/code&gt; when a file &lt;code&gt;foobar&lt;/code&gt; already exists. Previously, the
only solution was to use &lt;kbd&gt;C-M-j&lt;/kbd&gt;.  It&amp;#39;s still available, but
now you can also select your input with &lt;kbd&gt;C-p&lt;/kbd&gt; and press
&lt;kbd&gt;RET&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;new-global-actions-for-ivy&quot;&gt;New global actions for ivy&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ivy-set-actions&lt;/code&gt; was used to enable the following bindings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press &lt;kbd&gt;M-o w&lt;/kbd&gt; to copy the current candidate to the kill ring.&lt;/li&gt;
&lt;li&gt;Press &lt;kbd&gt;M-o i&lt;/kbd&gt; to insert the current candidate into the buffer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These bindings are valid for any completion session by default.&lt;/p&gt;

&lt;h3 id=&quot;use-c-d-in-ivy-occur-buffers&quot;&gt;Use &lt;kbd&gt;C-d&lt;/kbd&gt; in ivy-occur buffers&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s an example use-case: search your source code for a variable
name with e.g. &lt;code&gt;counsel-rg&lt;/code&gt; and call &lt;code&gt;ivy-occur&lt;/code&gt; (&lt;kbd&gt;C-c C-o&lt;/kbd&gt;).
Suppose you get 10 results, only 4 of which are interesting.  You can
now delete the uninteresting ones with &lt;kbd&gt;C-d&lt;/kbd&gt;. Then maybe
check off the others with &lt;kbd&gt;C-d&lt;/kbd&gt; as well as you complete them
one by one. A sort of a TODO list.&lt;/p&gt;

&lt;p&gt;Similarly, if you want to go over variables to customize, you can call
&lt;code&gt;counsel-describe-variable&lt;/code&gt; with input &lt;code&gt;^counsel-[^-]&lt;/code&gt; and then check
off the ones you have already examined with &lt;kbd&gt;C-d&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;defcustoms-to-play-with&quot;&gt;Defcustoms to play with&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s the list of new &lt;code&gt;defcustom&lt;/code&gt; or &lt;code&gt;defvar&lt;/code&gt; that might be
interesting to review:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-async-filter-update-time&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-async-ignore-re&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-describe-function-function&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-describe-function-preselect&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-find-file-ignore-regexp&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-fzf-dir-function&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-git-grep-skip-counting-lines&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-git-log-split-string-re&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-url-expansions&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-auto-select-single-candidate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-magic-slash-non-match-action&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy--preferred-re-builders&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-truncate-lines&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-commands&quot;&gt;New Commands&lt;/h2&gt;

&lt;p&gt;14 new commands were added by me and many contributors. Here&amp;#39;s the list:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-ack&lt;/code&gt; - completion for &lt;a href=&quot;https://beyondgrep.com/&quot;&gt;ack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-apropos&lt;/code&gt; - completion for &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/emacs/Apropos.html&quot;&gt;apropos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-file-register&lt;/code&gt; - completion for &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/emacs/File-Registers.html&quot;&gt;file registers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-fzf&lt;/code&gt; - completion for &lt;a href=&quot;https://github.com/junegunn/fzf&quot;&gt;fzf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-git-change-worktree&lt;/code&gt; - completion for &lt;a href=&quot;https://git-scm.com/docs/git-worktree&quot;&gt;git-worktree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-git-checkout&lt;/code&gt; - completion for &lt;a href=&quot;https://git-scm.com/docs/git-checkout&quot;&gt;git-checkout&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-minibuffer-history&lt;/code&gt; - generalization of &lt;code&gt;counsel-expression-history&lt;/code&gt; and &lt;code&gt;counsel-shell-command-history&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-org-capture&lt;/code&gt; - completion for &lt;a href=&quot;http://orgmode.org/manual/Capture.html&quot;&gt;org-capture&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-org-file&lt;/code&gt; - browse all attachments for the current Org file&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-org-goto&lt;/code&gt; - completion for Org headings&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-org-goto-all&lt;/code&gt; - completion for Org headings in all open buffers&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-switch-to-shell-buffer&lt;/code&gt; - switch to a shell buffer, or create one&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-occur-delete-candidate&lt;/code&gt; - delete current candidate in &lt;code&gt;ivy-occur-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-switch-view&lt;/code&gt; - select a &lt;a href=&quot;https://oremacs.com/2016/06/27/ivy-push-view/&quot;&gt;window configuration&lt;/a&gt;, decoupled from &lt;code&gt;ivy-switch-buffer&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My personal favorites are &lt;code&gt;counsel-fzf&lt;/code&gt; and &lt;code&gt;counsel-org-file&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Again, thanks to all the contributors. Happy hacking!&lt;/p&gt;

&lt;p&gt;P.S. Please consider joining my &lt;a href=&quot;https://www.patreon.com/abo_abo&quot;&gt;74 patrons&lt;/a&gt; to give me the opportunity to work on Free Software a lot more. We are currently at 30% of the goal.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Save Ivy file completions to Dired</title>
   <link href="https://oremacs.com/2017/11/18/dired-occur/"/>
   <updated>2017-11-18T00:00:00+01:00</updated>
   <id>https://oremacs.com/2017/11/18/dired-occur</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;I think &lt;code&gt;ivy-occur&lt;/code&gt; (&lt;kbd&gt;C-c C-o&lt;/kbd&gt;) is one of the coolest
features in &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;ivy&lt;/a&gt;.  It allows you
to save your current search into a new buffer. This has many uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;get a full overview of all candidates&lt;/li&gt;
&lt;li&gt;many useful modal bindings (&lt;kbd&gt;q&lt;/kbd&gt;, &lt;kbd&gt;j&lt;/kbd&gt;,
&lt;kbd&gt;k&lt;/kbd&gt;, &lt;kbd&gt;f&lt;/kbd&gt;) and mouse support&lt;/li&gt;
&lt;li&gt;ability to manipulate candidates as text&lt;/li&gt;
&lt;li&gt;save the search for later, with the option to refresh the search with &lt;kbd&gt;g&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;go over candidates as a TODO list, using &lt;kbd&gt;C-d&lt;/kbd&gt; to remove elements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything above works for any &lt;code&gt;ivy-read&lt;/code&gt; session. But the most
powerful features come into play when &lt;code&gt;ivy-occur&lt;/code&gt; gets customized for
a specific collection.&lt;/p&gt;

&lt;h2 id=&quot;ivy-occur-for-grep-like-functions&quot;&gt;&lt;code&gt;ivy-occur&lt;/code&gt; for grep-like functions&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-occur&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;swiper&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;swiper-occur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Thanks to this default customization, the resulting &lt;code&gt;*ivy-occur
swiper*&lt;/code&gt; buffer is in &lt;code&gt;ivy-occur-grep-mode&lt;/code&gt; which inherits from
&lt;code&gt;grep-mode&lt;/code&gt;. Additionally, you can use
&lt;code&gt;ivy-wgrep-change-to-wgrep-mode&lt;/code&gt; &lt;kbd&gt;C-x C-q&lt;/kbd&gt; to edit the result
in-place - pressing &lt;kbd&gt;C-x C-s&lt;/kbd&gt; will save the changes.&lt;/p&gt;

&lt;p&gt;Similar customizations are available for &lt;code&gt;counsel-git-grep&lt;/code&gt;,
&lt;code&gt;counsel-ag&lt;/code&gt;, &lt;code&gt;counsel-rg&lt;/code&gt;, and &lt;code&gt;counsel-grep&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;ivy-occur-for-ivy-switch-buffer&quot;&gt;&lt;code&gt;ivy-occur&lt;/code&gt; for &lt;code&gt;ivy-switch-buffer&lt;/code&gt;&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-occur&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-switch-buffer&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-switch-buffer-occur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This makes &lt;kbd&gt;C-c C-o&lt;/kbd&gt; open your candidates in the powerful
&lt;code&gt;ibuffer&lt;/code&gt;, which adds additional info to your buffer list and allows
you to manipulate buffers easily.&lt;/p&gt;

&lt;p&gt;For instance, to delete all matching buffers you can do &lt;kbd&gt;C-c C-o
tD&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;The source code is short enough to be included here:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-switch-buffer-occur&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Occur function for &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ivy-switch-buffer&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; using &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ibuffer&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ibuffer&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--old-re&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The interface is quite simple: &lt;code&gt;ivy-occur&lt;/code&gt; is responsible for
generating a new buffer, and the occur function
e.g. &lt;code&gt;ivy-switch-buffer-occur&lt;/code&gt; is to fill that buffer with useful
info, based on the current search parameters like &lt;code&gt;ivy-text&lt;/code&gt; and
&lt;code&gt;ivy--old-re&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;ivy-occur-for-counsel-find-file-like-functions&quot;&gt;&lt;code&gt;ivy-occur&lt;/code&gt; for &lt;code&gt;counsel-find-file&lt;/code&gt;-like functions&lt;/h2&gt;

&lt;p&gt;This is a brand new feature that works for &lt;code&gt;counsel-find-file&lt;/code&gt;,
&lt;code&gt;counsel-git&lt;/code&gt;, and &lt;code&gt;counsel-fzf&lt;/code&gt; (which itself is quite new, thanks to
&lt;a href=&quot;https://github.com/jojojames&quot;&gt;@jojojames&lt;/a&gt; for contributing it).&lt;/p&gt;

&lt;p&gt;Since these functions are used to complete file names, we obviously
want &lt;code&gt;ivy-occur&lt;/code&gt; to open a Dired buffer.&lt;/p&gt;

&lt;h3 id=&quot;example-1&quot;&gt;Example 1&lt;/h3&gt;

&lt;p&gt;To delete all &lt;code&gt;*.elc&lt;/code&gt; files in the current folder do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-x C-f&lt;/kbd&gt; &lt;code&gt;elc$&lt;/code&gt; &lt;kbd&gt;C-c C-o&lt;/kbd&gt; &lt;kbd&gt;tDy&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;example-2&quot;&gt;Example 2&lt;/h3&gt;

&lt;p&gt;To copy all Org files in a Git project to some directory do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;counsel-git&lt;/code&gt; &lt;code&gt;org$&lt;/code&gt; &lt;kbd&gt;C-c C-o&lt;/kbd&gt; &lt;kbd&gt;tC&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;example-3&quot;&gt;Example 3&lt;/h3&gt;

&lt;p&gt;To get a list of videos to watch do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;counsel-fzf&lt;/code&gt; &lt;code&gt;mp4$&lt;/code&gt; &lt;kbd&gt;C-c C-o&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I can further e.g. mark 3 files with &lt;kbd&gt;m&lt;/kbd&gt; and use &lt;kbd&gt;r&lt;/kbd&gt;
to send these 3 files to &lt;code&gt;vlc&lt;/code&gt; as a list. See &lt;a href=&quot;https://oremacs.com/2015/01/04/dired-nohup/&quot;&gt;this
post&lt;/a&gt; for my dired setup
that makes &lt;kbd&gt;r&lt;/kbd&gt; work this way.&lt;/p&gt;

&lt;p&gt;You can remove some files afterwards with the usual &lt;kbd&gt;D&lt;/kbd&gt; or
&lt;kbd&gt;dx&lt;/kbd&gt;. And to redisplay the buffer use &lt;kbd&gt;g&lt;/kbd&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope you like the new feature. I had a really good few hours
figuring out how it should work exactly.  Please consider joining my
&lt;a href=&quot;https://www.patreon.com/abo_abo&quot;&gt;72 patrons&lt;/a&gt; to give me the
opportunity to work on Free Software a lot more. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Orca - new package to improve org-capture from browser</title>
   <link href="https://oremacs.com/2017/10/28/orca/"/>
   <updated>2017-10-28T00:00:00+02:00</updated>
   <id>https://oremacs.com/2017/10/28/orca</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/orca&quot;&gt;Orca&lt;/a&gt; is a new Emacs package, an
attempt to refactor my old &lt;a href=&quot;https://github.com/abo-abo/org-fu&quot;&gt;org-fu&lt;/a&gt;
into something that&amp;#39;s much more re-usable and easier to get started
with.&lt;/p&gt;

&lt;h2 id=&quot;orca-functionality&quot;&gt;Orca functionality&lt;/h2&gt;

&lt;h3 id=&quot;problem&quot;&gt;Problem:&lt;/h3&gt;

&lt;p&gt;When capturing from Firefox using
&lt;a href=&quot;http://orgmode.org/worg/org-contrib/org-protocol.html&quot;&gt;org-protocol&lt;/a&gt; (together with
&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/org-capture/&quot;&gt;this addon&lt;/a&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;either I refile each time I capture, which is slow&lt;/li&gt;
&lt;li&gt;or my captures pile up in one place, which is messy&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;solution&quot;&gt;Solution:&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Define rules for where links from certain websites should be captured.&lt;/li&gt;
&lt;li&gt;Allow to capture directly into the current org-mode buffer, since it&amp;#39;s likely related to what I&amp;#39;m working with on.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;part-1-rules-example&quot;&gt;Part 1: Rules example&lt;/h3&gt;

&lt;p&gt;Here is my example list of configurations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Capture URL matching &lt;a href=&quot;https://www.reddit.com/emacs/&quot;&gt;https://www.reddit.com/emacs/&lt;/a&gt; to &lt;code&gt;emacs.org:Reddit&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;Capture URL matching &lt;a href=&quot;https://emacs.stackexchange.com/&quot;&gt;https://emacs.stackexchange.com/&lt;/a&gt; to &lt;code&gt;emacs.org:Questions&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;If nothing else matches, capture to &lt;code&gt;ent.org:Articles&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Corresponding code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;orca-handler-list&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;orca-handler-match-url&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;https://www.reddit.com/&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;~/Dropbox/org/wiki/emacs.org&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Reddit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;orca-handler-match-url&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;https://emacs.stackexchange.com/&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;~/Dropbox/org/wiki/emacs.org&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\* Questions&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;orca-handler-file&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;~/Dropbox/org/ent.org&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\* Articles&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;part-2-current-buffer-example&quot;&gt;Part 2: Current buffer example&lt;/h3&gt;

&lt;p&gt;For example, I&amp;#39;m researching how to implement something with
&lt;a href=&quot;https://www.docker.com/&quot;&gt;docker&lt;/a&gt;.  This means that I have
&lt;code&gt;docker.org&lt;/code&gt; open, along with dozens of tabs in the browser.&lt;/p&gt;

&lt;p&gt;I can configure to capture into the current org-mode buffer with a &lt;code&gt;*
Tasks&lt;/code&gt; heading like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;orca-handler-current-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\* Tasks&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;orca-handler-list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Since &lt;code&gt;docker.org&lt;/code&gt; has &lt;code&gt;* Tasks&lt;/code&gt;, I just click the capture button in
Firefox and follow up with an immediate &lt;kbd&gt;C-c C-c&lt;/kbd&gt; in Emacs.
The link is already in the right position, no need for an extra refile
step.&lt;/p&gt;

&lt;h2 id=&quot;using-customize-with-orca&quot;&gt;Using &lt;code&gt;customize&lt;/code&gt; with orca&lt;/h2&gt;

&lt;p&gt;You can set up the capture rules using &lt;kbd&gt;M-x&lt;/kbd&gt;
&lt;code&gt;customize-group&lt;/code&gt; &lt;kbd&gt;RET&lt;/kbd&gt; &lt;code&gt;orca&lt;/code&gt; &lt;kbd&gt;RET&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s a screenshot:
&lt;img src=&quot;/download/orca-customize.png&quot; alt=&quot;orca-customize&quot;&gt;&lt;/p&gt;

&lt;p&gt;As you see, the customization is a list of an arbitrary length, with
each element falling into one of three categories, each backed by an
Elisp function (&lt;code&gt;orca-handler-current-buffer&lt;/code&gt;, &lt;code&gt;orca-handler-file&lt;/code&gt;,
and &lt;code&gt;orca-handler-match-url&lt;/code&gt;). Each function takes a different number
of arguments (one, two, and three, respectively) - they are all
annotated by the interface.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the code that describes the expected &lt;code&gt;:type&lt;/code&gt; to &lt;code&gt;customize&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;orca-handler-list&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;repeat&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;choice&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Current buffer&amp;quot;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;orca-handler-current-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Heading&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;URL matching regex&amp;quot;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;orca-handler-match-url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;URL&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;File&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Heading&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Default&amp;quot;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;orca-handler-file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;File&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Heading&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can read more about the customization types in &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/elisp/Composite-Types.html&quot;&gt;this manual section&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope you enjoy &lt;code&gt;orca&lt;/code&gt;. I&amp;#39;ve submitted it to MELPA. Hopefully, it
will be available for an easy install very soon.&lt;/p&gt;

&lt;p&gt;Org-mode is a beautiful thing, but my previous attempts to configure
it were huge config files of loosely related (i.e. the only thing in
common was Org-mode) stuff spanning hundreds of lines. Orca is an
improvement in this respect, since it focuses on a very narrow
domain. It still tries to be flexible (just like &lt;code&gt;org-capture&lt;/code&gt;) - you
can plug in your own functions into &lt;code&gt;orca-handler-list&lt;/code&gt;. But
initially, the flexibility can be constrained into the
&lt;code&gt;customize-group&lt;/code&gt; interface, to allow for a self-documenting solution
that&amp;#39;s easy to get started with. Happy hacking!&lt;/p&gt;

&lt;p&gt;PS. Thanks to all my patrons for advancing my
&lt;a href=&quot;https://oremacs.com/2017/10/18/patreon/&quot;&gt;Patreon campaign&lt;/a&gt;!
As of this writing, we&amp;#39;re almost at the &lt;a href=&quot;https://www.patreon.com/abo_abo&quot;&gt;25% mark&lt;/a&gt;
with 61 contributors.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Please consider supporting me on Patreon</title>
   <link href="https://oremacs.com/2017/10/18/patreon/"/>
   <updated>2017-10-18T00:00:00+02:00</updated>
   <id>https://oremacs.com/2017/10/18/patreon</id>
   <content type="html">&lt;p&gt;In light of the recent success of the
&lt;a href=&quot;https://www.kickstarter.com/projects/1681258897/its-magit-the-magical-git-client&quot;&gt;Magit Kickstarter&lt;/a&gt;
(congratulations to &lt;a href=&quot;https://magit.vc/&quot;&gt;@tarsius&lt;/a&gt;, by the way), I got a lot more optimistic about Free Software crowdfunding.&lt;/p&gt;

&lt;p&gt;So I opened a Patreon account where you can support my work:
&lt;a href=&quot;https://www.patreon.com/abo_abo&quot;&gt;https://www.patreon.com/abo_abo&lt;/a&gt;.
The goal I set there is both optimistic and (hopefully) realistic: I&amp;#39;d
like to hack on Free Software 1 day per week indefinitely, reducing my
real world job days to 4 per week.&lt;/p&gt;

&lt;p&gt;Ideally, I&amp;#39;d like to work on Free Software full time (one can dream),
but it doesn&amp;#39;t look like that level of donations is attainable right
now. But I think I could accomplish a lot working a full day per week:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;improve the level of maintenance of my current projects&lt;/li&gt;
&lt;li&gt;polish and release a few projects I have in a semi-complete unreleased state&lt;/li&gt;
&lt;li&gt;produce more content on my &lt;a href=&quot;https://www.youtube.com/user/abo5abo/videos&quot;&gt;YouTube channel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;maybe start working on an Emacs book&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here&amp;#39;s a list of
&lt;a href=&quot;https://github.com/search?q=user:abo-abo+&amp;s=stars&amp;type=Repositories&quot;&gt;popular repositories&lt;/a&gt;
I&amp;#39;ve made over the last 5 years in my free time (all Free Software under GPL):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/avy&quot;&gt;avy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/ace-window&quot;&gt;ace-window&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/org-download&quot;&gt;org-download&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/oremacs&quot;&gt;oremacs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/function-args&quot;&gt;function-args&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/auto-yasnippet&quot;&gt;auto-yasnippet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/ace-link&quot;&gt;ace-link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/pamparam&quot;&gt;pamparam&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/worf&quot;&gt;worf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/tiny&quot;&gt;tiny&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/swiper-helm&quot;&gt;swiper-helm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/define-word&quot;&gt;define-word&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/make-it-so&quot;&gt;make-it-so&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/lpy&quot;&gt;lpy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/helm-make&quot;&gt;helm-make&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/org-fu&quot;&gt;org-fu&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/helm-j-cheatsheet&quot;&gt;helm-j-cheatsheet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/zoutline&quot;&gt;zoutline&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/plain-org-wiki&quot;&gt;plain-org-wiki&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/gtk-pomodoro-indicator&quot;&gt;gtk-pomodoro-indicator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/headlong&quot;&gt;headlong&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/elf-mode&quot;&gt;elf-mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/cook&quot;&gt;cook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/eclipse-theme&quot;&gt;eclipse-theme&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are a user of my work, don&amp;#39;t feel any pressure to donate. We
are all here voluntarily: I publish because I enjoy it, you use the
software because you find it useful. But out there is the real world,
and, although I like my real world job enough, I can&amp;#39;t say that would
I do it voluntarily if I had enough money to meet my needs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you do what you love, you&amp;#39;ll never work a day in your life&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I&amp;#39;d like to do what I love, and I wish you all the same. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Extending completion-at-point for Org-mode</title>
   <link href="https://oremacs.com/2017/10/04/completion-at-point/"/>
   <updated>2017-10-04T00:00:00+02:00</updated>
   <id>https://oremacs.com/2017/10/04/completion-at-point</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;When creating documents, context aware completion is a powerful
mechanism that can help you improve the speed, correctness and
discoverability.&lt;/p&gt;

&lt;p&gt;Emacs provides context aware completion via the &lt;code&gt;complete-symbol&lt;/code&gt;
command, bound to &lt;kbd&gt;C-M-i&lt;/kbd&gt; by default. In order for it to do
something useful, &lt;code&gt;completion-at-point-functions&lt;/code&gt; has to be set up.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;Documentation:

Special hook to find the completion table for the thing at point.
Each function on this hook is called in turn without any argument and should
return either nil to mean that it is not applicable at point,
or a list of the form (START END COLLECTION) where
START and END delimit the entity to complete and should include
point, COLLECTION is the completion table to use to complete it.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For each &lt;code&gt;major-mode&lt;/code&gt;, a different value of
&lt;code&gt;completion-at-point-functions&lt;/code&gt; can (and probably should) apply.  One
of the modes that&amp;#39;s set up nicely by default is &lt;code&gt;emacs-lisp-mode&lt;/code&gt;:
press &lt;kbd&gt;C-M-i&lt;/kbd&gt; to get completion for Elisp variable and
function names. Org-mode, on the other hand, is quite lacking in this
regard: nothing useful happens with &lt;kbd&gt;C-M-i&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s my current setting for Org-mode:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;completion-at-point-functions&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-completion-symbols&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;ora-cap-filesystem&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;org-completion-refs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;org-completion-symbols&quot;&gt;org-completion-symbols&lt;/h2&gt;

&lt;p&gt;When I write about code in Org-mode, I quote items like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;=/home/oleh/=, =HammerFactoryFactory=, etc.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Quoting has several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It looks nice, since it&amp;#39;s in a different face,&lt;/li&gt;
&lt;li&gt;&lt;code&gt;flyspell&lt;/code&gt; doesn&amp;#39;t need to check it, which makes sense since it would
fail on most variable and class names,&lt;/li&gt;
&lt;li&gt;Prevents Org from confusing directory names for italics mark up.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Completion has one more advantage on top of that: if I refer to a
symbol name multiple times within a document, completion helps me to
enter it quickly and correctly. Here&amp;#39;s the corresponding completion
source:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-completion-symbols&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;looking-back&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;=[a-zA-Z]+&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cands&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;save-match-data&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;=\\([a-zA-Z]+\\)=&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cl-pushnew&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string-no-properties&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cands&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:test&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;equal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;nv&quot;&gt;cands&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cands&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-beginning&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-end&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cands&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;First of all, it checks if the point is e.g. after &lt;code&gt;=A&lt;/code&gt;, i.e. we
are in fact entering a new quoted symbol. If that&amp;#39;s not the case,
return &lt;code&gt;nil&lt;/code&gt; and let the other completion sources have a go.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, it looks through the current buffer for each &lt;code&gt;=foo=&lt;/code&gt; and
&lt;code&gt;=bar=&lt;/code&gt;, accumulating them into a list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, it returns the bounds of what we&amp;#39;ve got so far, plus the
found candidates. It&amp;#39;s important that the bounds are passed to the
completion engine, so that it can delete everything inside the
bounds before inserting the whole selected symbol.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;org-cap-filesystem&quot;&gt;org-cap-filesystem&lt;/h2&gt;

&lt;p&gt;This source is for completing file names:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-cap-filesystem&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ffap-string-at-point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\`file:\\(.*\\)\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;compl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;all-completions&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;read-file-name-internal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;compl&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;compl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;offset&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;len&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-text-property&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;face&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                                       &lt;span class=&quot;ss&quot;&gt;&amp;#39;completions-common-part&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cl-incf&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                    &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;compl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I usually enter &lt;code&gt;~&lt;/code&gt;, so that &lt;code&gt;ffap-string-at-point&lt;/code&gt; recognizes it as a
path. Then complete each part of the path with &lt;kbd&gt;C-M-i&lt;/kbd&gt;. It&amp;#39;s
very similar to &lt;code&gt;counsel-find-file&lt;/code&gt;. In fact, I could just use
&lt;code&gt;counsel-find-file&lt;/code&gt; for this, with &lt;kbd&gt;M-o i&lt;/kbd&gt; to insert the file
name instead of opening the selected file.&lt;/p&gt;

&lt;h2 id=&quot;org-completion-refs&quot;&gt;org-completion-refs&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;org-completion-refs&lt;/code&gt; is very similar to &lt;code&gt;org-completion-symbols&lt;/code&gt;: it
will collect all instances of e.g. &lt;code&gt;\label{foo}&lt;/code&gt;, and offer them for
completion when you enter &lt;code&gt;\ref{&lt;/code&gt;. If you want to look at the code,
it&amp;#39;s available in &lt;a href=&quot;https://github.com/abo-abo/oremacs/blob/github/modes/ora-org.el&quot;&gt;my config&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope I convinced you about the usefulness of completion at
point. It&amp;#39;s especially cool since it&amp;#39;s a universal interface for
&lt;code&gt;major-mode&lt;/code&gt;-specific completion. So any IDE-like package for any
language could provide its own completion using the familiar
interface. That could go a long way towards providing a &amp;quot;just works&amp;quot;
experience, particularly when dealing with a new language.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ripgrep</title>
   <link href="https://oremacs.com/2017/08/04/ripgrep/"/>
   <updated>2017-08-04T00:00:00+02:00</updated>
   <id>https://oremacs.com/2017/08/04/ripgrep</id>
   <content type="html">&lt;h2 id=&quot;counsel-rg&quot;&gt;counsel-rg&lt;/h2&gt;

&lt;p&gt;Lately, due to working with a large code base, I&amp;#39;ve grown more and
more fond of &lt;code&gt;counsel-rg&lt;/code&gt;.  It&amp;#39;s an Elisp wrapper
around &lt;a href=&quot;https://github.com/BurntSushi/ripgrep&quot;&gt;ripgrep&lt;/a&gt; - a relatively
new recursive grep tool that aims to be faster than the competition
(&lt;code&gt;ag&lt;/code&gt;, &lt;code&gt;git grep&lt;/code&gt;, &lt;code&gt;pt&lt;/code&gt;, &lt;code&gt;ack&lt;/code&gt; etc).&lt;/p&gt;

&lt;p&gt;Besides being really fast, &lt;code&gt;rg&lt;/code&gt; also has some really
nice
&lt;a href=&quot;https://github.com/BurntSushi/ripgrep/blob/master/doc/rg.1.md&quot;&gt;command switches&lt;/a&gt;.
One such switch is especially useful for Emacs:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;-M, --max-columns NUM
: Don&amp;#39;t print lines longer than this limit in bytes. Longer lines are omitted,
 and only the number of matches in that line is printed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code&gt;-M&lt;/code&gt; switch is useful twofold:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Emacs is slow when dealing with long lines (by long I mean thousands of chars per line)&lt;/li&gt;
&lt;li&gt;Emacs is slow at accepting a huge amount of output from a process&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For each character you add to your input, &lt;code&gt;counsel-rg&lt;/code&gt; starts a new
shell command to recalculate the matches with the new input. This
means that in order to avoid keyboard lag there&amp;#39;s only about 0.1
seconds available for both:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Running the shell command.&lt;/li&gt;
&lt;li&gt;Accepting output from the shell command.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So I&amp;#39;m quite happy that &lt;code&gt;rg&lt;/code&gt; speeds up both steps. Less time spent on
these steps provides for much smoother searching.&lt;/p&gt;

&lt;h2 id=&quot;counsel-grep-or-swiper&quot;&gt;counsel-grep-or-swiper&lt;/h2&gt;

&lt;p&gt;I also work with large log files, one file at a time. For a long time,
I&amp;#39;ve used &lt;code&gt;counsel-grep-or-swiper&lt;/code&gt; as my main search command:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-grep-or-swiper&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But for a 40Mb log file with really long lines
&lt;code&gt;counsel-grep-or-swiper&lt;/code&gt; started to lag a bit. I tried &lt;code&gt;counsel-rg&lt;/code&gt;,
and it was actually faster than &lt;code&gt;grep&lt;/code&gt;, although it was searching the
whole directory. So I thought, why not use &lt;code&gt;rg&lt;/code&gt; instead of &lt;code&gt;grep&lt;/code&gt;? The
switch is actually really easy and required only a simple user
customization:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-grep-base-command&lt;/span&gt;
 &lt;span class=&quot;s&quot;&gt;&amp;quot;rg -i -M 120 --no-heading --line-number --color never &amp;#39;%s&amp;#39; %s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;If you haven&amp;#39;t tried &lt;code&gt;ripgrep&lt;/code&gt; so far, I suggest you give it a go. Happy hacking!&lt;/p&gt;

&lt;p&gt;And if you&amp;#39;re a C hacker and have some free time on your hands, why
not look at the long lines and the process output issues in Emacs? I&amp;#39;d
be very grateful:)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>hydra.el talk @ london.el</title>
   <link href="https://oremacs.com/2017/07/24/hydra-at-london-meetup/"/>
   <updated>2017-07-24T00:00:00+02:00</updated>
   <id>https://oremacs.com/2017/07/24/hydra-at-london-meetup</id>
   <content type="html">&lt;p&gt;Today I gave a talk on &lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt; at the London Emacs meet up -
&lt;a href=&quot;https://www.meetup.com/London-Emacs-Hacking/events/241399003/&quot;&gt;london.el&lt;/a&gt;.
My screen capture is available on &lt;a href=&quot;https://youtu.be/ONHEDj3kWrE&quot;&gt;youtube&lt;/a&gt;,
and the slides are &lt;a href=&quot;https://oremacs.com/download/london.pdf&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://twitter.com/dotemacs&quot;&gt;@dotemacs&lt;/a&gt; for organizing the
event and inviting me.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy 0.9.0 is out</title>
   <link href="https://oremacs.com/2017/04/09/ivy-0.9.0/"/>
   <updated>2017-04-09T00:00:00+02:00</updated>
   <id>https://oremacs.com/2017/04/09/ivy-0.9.0</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Ivy&lt;/a&gt; is a completion method that&amp;#39;s
similar to &lt;code&gt;Ido&lt;/code&gt;, but with emphasis on simplicity and customizability.&lt;/p&gt;

&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;/h2&gt;

&lt;p&gt;The current release constitutes of &lt;code&gt;339&lt;/code&gt; commits and almost a full
year of progress since &lt;code&gt;0.8.0&lt;/code&gt;. Many issues ranging
from &lt;a href=&quot;https://github.com/abo-abo/swiper/issues/493&quot;&gt;#493&lt;/a&gt;
to &lt;a href=&quot;https://github.com/abo-abo/swiper/issues/946&quot;&gt;#946&lt;/a&gt; were fixed.
The number of people who contributed code as grown
to &lt;a href=&quot;https://github.com/abo-abo/swiper/graphs/contributors&quot;&gt;63&lt;/a&gt;;
thanks, everyone!&lt;/p&gt;

&lt;h2 id=&quot;details-on-changes&quot;&gt;Details on changes&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Changelog.org&lt;/code&gt; has been a part of the repository since &lt;code&gt;0.6.0&lt;/code&gt;, you
can get the details of the current and past changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;in &lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/doc/Changelog.org#090&quot;&gt;org-mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;in &lt;a href=&quot;http://oremacs.com/swiper/Changelog.html#0.9.0&quot;&gt;HTML&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;highlights&quot;&gt;Highlights&lt;/h2&gt;

&lt;p&gt;Many improvements are incremental and don&amp;#39;t require any extra code to
enable.  I&amp;#39;ll go over a few selected features that require a bit of
information to make a good use of them.&lt;/p&gt;

&lt;h3 id=&quot;a-better-action-choice-interface&quot;&gt;A better action choice interface&lt;/h3&gt;

&lt;p&gt;For all &lt;code&gt;ivy&lt;/code&gt; completions, pressing &lt;kbd&gt;M-o&lt;/kbd&gt; allows to execute
one of the custom actions for the current command. Now you have an
option to use &lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt; for selecting
an action. Use this code to turn on the feature:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-hydra&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;One big advantage of the new interface is that you can peak at the
action list with &lt;kbd&gt;M-o&lt;/kbd&gt; without dismissing the candidate
list. Press &lt;kbd&gt;M-o&lt;/kbd&gt; again to go back to candidate selection
without selecting an action.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s some code from my config that ensures that I always have some extra actions to choose from:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-insert&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringp&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-kill-new&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kill-new&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringp&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-actions&lt;/span&gt;
 &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-insert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;insert&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-kill-new&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;copy&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;grepping&quot;&gt;Grepping&lt;/h3&gt;

&lt;p&gt;The new &lt;code&gt;counsel-rg&lt;/code&gt; joins the group of grepping commands in &lt;code&gt;counsel&lt;/code&gt;
(&lt;code&gt;counsel-ag&lt;/code&gt;, &lt;code&gt;counsel-git-grep&lt;/code&gt;, &lt;code&gt;counsel-grep&lt;/code&gt;, &lt;code&gt;counsel-pt&lt;/code&gt;). It
wraps around the newly popular and very
fast &lt;a href=&quot;https://github.com/BurntSushi/ripgrep&quot;&gt;ripgrep&lt;/a&gt; shell tool.&lt;/p&gt;

&lt;p&gt;A nice improvement to the grepping commands is the ability to specify
extra flags when you press &lt;kbd&gt;C-u&lt;/kbd&gt; (&lt;code&gt;universal-argument&lt;/code&gt;)
before the
command. See &lt;a href=&quot;https://github.com/abo-abo/swiper/pull/774&quot;&gt;this gif&lt;/a&gt;
for an example of excluding &lt;code&gt;*.el&lt;/code&gt; from the files searched by &lt;code&gt;ag&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;counsel-find-file&quot;&gt;counsel-find-file&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Press &lt;kbd&gt;M-o b&lt;/kbd&gt; to change the current directory to one of the
virtual buffers&amp;#39; directories. You continue to select a file from that
directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press &lt;kbd&gt;M-o r&lt;/kbd&gt; to find the current file as root.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;counsel-git-log&quot;&gt;counsel-git-log&lt;/h3&gt;

&lt;p&gt;You can now customize
&lt;code&gt;counsel-git-log-cmd&lt;/code&gt;. See
&lt;a href=&quot;https://github.com/abo-abo/swiper/issues/652&quot;&gt;#652&lt;/a&gt; for using this to
make &lt;code&gt;counsel-git-log&lt;/code&gt; work on Windows.&lt;/p&gt;

&lt;h3 id=&quot;counsel-mode&quot;&gt;counsel-mode&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-info-lookup-symbol&lt;/code&gt; now substitutes the built in &lt;code&gt;info-lookup-symbol&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Pressing &lt;kbd&gt;C-r&lt;/kbd&gt; while in the minibuffer of &lt;code&gt;eval-expression&lt;/code&gt;
or &lt;code&gt;shell-command&lt;/code&gt; now gives you completion of your previous
history.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;counsel-yank-pop&quot;&gt;counsel-yank-pop&lt;/h3&gt;

&lt;p&gt;Use the new &lt;code&gt;counsel-yank-pop-separator&lt;/code&gt; variable to make
&lt;code&gt;counsel-yank-pop&lt;/code&gt; look
like &lt;a href=&quot;https://github.com/abo-abo/swiper/issues/660&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;ivy&quot;&gt;ivy&lt;/h3&gt;

&lt;p&gt;There was breaking change for alist type collections some months
ago. Right now the action functions receive an &lt;code&gt;item&lt;/code&gt; from the
collection, instead of &lt;code&gt;(cdr item)&lt;/code&gt; like before. If anything breaks,
the easy fix is to add an extra &lt;code&gt;cdr&lt;/code&gt; to the action function.&lt;/p&gt;

&lt;p&gt;Unique index for alist completion was added. The uniqueness assumption
is that the completion system is passed a list of unique strings, of
which one (or more) are selected. Unlike plain string completion,
alists may require violating the uniqueness assumption: there may be
two elements with the same &lt;code&gt;car&lt;/code&gt; but different &lt;code&gt;cdr&lt;/code&gt;. Example: C
function declaration and definition for tag completion. Until now,
whenever two equal strings were sent to &lt;code&gt;ivy-read&lt;/code&gt;, only the first one
could be selected. Now, each alist car gets an integer index assigned
to it as a text property &lt;code&gt;&amp;#39;idx&lt;/code&gt;. So it&amp;#39;s possible to differentiate two
alist items with the same key.&lt;/p&gt;

&lt;p&gt;Action functions don&amp;#39;t require using &lt;code&gt;with-ivy-window&lt;/code&gt; anymore.  This
allows for a lot of simplification, e.g. use &lt;code&gt;insert&lt;/code&gt; instead of
&lt;code&gt;(lambda (x) (with-ivy-window (insert x)))&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;ivy-switch-buffer&quot;&gt;ivy-switch-buffer&lt;/h3&gt;

&lt;p&gt;You can now customize faces in &lt;code&gt;ivy-switch-buffer&lt;/code&gt; by the mode of each buffer.
Here&amp;#39;s a snippet from my config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-switch-buffer-faces-alist&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emacs-lisp-mode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;swiper-match-face-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-mode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-subdir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-mode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-level-4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Looks neat, I think:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-switch-buffer-faces-alist.png&quot; alt=&quot;ivy-switch-buffer-faces-alist&quot;&gt;&lt;/p&gt;

&lt;h3 id=&quot;swiper&quot;&gt;swiper&lt;/h3&gt;

&lt;p&gt;Customize &lt;code&gt;swiper-include-line-number-in-search&lt;/code&gt; if you&amp;#39;d like to
match line numbers while using &lt;code&gt;swiper&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;new-commands&quot;&gt;New Commands&lt;/h2&gt;

&lt;h3 id=&quot;counsel-bookmark&quot;&gt;counsel-bookmark&lt;/h3&gt;

&lt;p&gt;Offers completion for &lt;code&gt;bookmark-jump&lt;/code&gt;. Press &lt;kbd&gt;M-o d&lt;/kbd&gt; to
delete a bookmark and &lt;kbd&gt;M-o e&lt;/kbd&gt; to edit it.&lt;/p&gt;

&lt;p&gt;A custom option &lt;code&gt;counsel-bookmark-avoid-dired&lt;/code&gt;, which is off by
default, allows to continue completion for bookmarked
directories. Turn it on with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-bookmark-avoid-dired&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and when you choose a bookmarked directory, the choice will be
forwarded to &lt;code&gt;counsel-find-file&lt;/code&gt; instead of opening a &lt;code&gt;dired-mode&lt;/code&gt;
buffer.&lt;/p&gt;

&lt;h3 id=&quot;counsel-colors-emacs-and-counsel-colors-web&quot;&gt;counsel-colors-emacs and counsel-colors-web&lt;/h3&gt;

&lt;p&gt;Completion for colors by name:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the default action inserts the color name.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-o h&lt;/kbd&gt; inserts the color hex name.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-o N&lt;/kbd&gt; copies the color name to the kill ring.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-o H&lt;/kbd&gt; copies the color hex name to the kill ring.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The colors are displayed in the minibuffer, it looks really cool:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-colors-emacs.png&quot; alt=&quot;counsel-colors-emacs&quot;&gt;&lt;/p&gt;

&lt;p&gt;You also get 108 shades of grey to choose from, for some reason.&lt;/p&gt;

&lt;h3 id=&quot;counsel-faces&quot;&gt;counsel-faces&lt;/h3&gt;

&lt;p&gt;Completion for faces by name:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-faces.png&quot; alt=&quot;counsel-faces&quot;&gt;&lt;/p&gt;

&lt;h3 id=&quot;counsel-command-history&quot;&gt;counsel-command-history&lt;/h3&gt;

&lt;p&gt;Shows the history of the Emacs commands executed and lets you select
and eval one
again. See &lt;a href=&quot;https://github.com/abo-abo/swiper/pull/826&quot;&gt;#826&lt;/a&gt; for a
nice screenshot.&lt;/p&gt;

&lt;h3 id=&quot;counsel-company&quot;&gt;counsel-company&lt;/h3&gt;

&lt;p&gt;Picks up &lt;code&gt;company&lt;/code&gt;&amp;#39;s candidates and inserts the result into the buffer.&lt;/p&gt;

&lt;h3 id=&quot;counsel-dired-jump-and-counsel-file-jump&quot;&gt;counsel-dired-jump and counsel-file-jump&lt;/h3&gt;

&lt;p&gt;Jump to a directory or a file in the current directory.&lt;/p&gt;

&lt;h3 id=&quot;counsel-dpkg-and-counsel-rpm&quot;&gt;counsel-dpkg and counsel-rpm&lt;/h3&gt;

&lt;p&gt;Wrap around the popular system package managers.&lt;/p&gt;

&lt;h3 id=&quot;counsel-package&quot;&gt;counsel-package&lt;/h3&gt;

&lt;p&gt;Install or uninstall Emacs packages with completion.&lt;/p&gt;

&lt;h3 id=&quot;counsel-mark-ring&quot;&gt;counsel-mark-ring&lt;/h3&gt;

&lt;p&gt;Navigate the current buffer&amp;#39;s mark ring.&lt;/p&gt;

&lt;h3 id=&quot;counsel-semantic&quot;&gt;counsel-semantic&lt;/h3&gt;

&lt;p&gt;Navigate the current buffer&amp;#39;s tags.&lt;/p&gt;

&lt;h3 id=&quot;counsel-outline&quot;&gt;counsel-outline&lt;/h3&gt;

&lt;p&gt;Navigate the current buffer&amp;#39;s outlines.&lt;/p&gt;

&lt;h3 id=&quot;counsel-recentf&quot;&gt;counsel-recentf&lt;/h3&gt;

&lt;p&gt;Completion for &lt;code&gt;recentf&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;counsel-find-library&quot;&gt;counsel-find-library&lt;/h3&gt;

&lt;p&gt;Completion for &lt;code&gt;find-library&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;counsel-hydra-heads&quot;&gt;counsel-hydra-heads&lt;/h3&gt;

&lt;p&gt;Completion for the last hydra&amp;#39;s heads.&lt;/p&gt;

&lt;h3 id=&quot;counsel-org-agenda-headlines&quot;&gt;counsel-org-agenda-headlines&lt;/h3&gt;

&lt;p&gt;Completion for headlines of files in your &lt;code&gt;org-agenda-files&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Again, thanks to all the contributors. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Using Emacs as a C++ IDE</title>
   <link href="https://oremacs.com/2017/03/28/emacs-cpp-ide/"/>
   <updated>2017-03-28T00:00:00+02:00</updated>
   <id>https://oremacs.com/2017/03/28/emacs-cpp-ide</id>
   <content type="html">&lt;p&gt;Recently, I&amp;#39;ve had to code some C++ at work. And I saw it as a good
opportunity to step up my Emacs&amp;#39; IDE game. I&amp;#39;ve eschewed clang-based
tools until now, but GCC isn&amp;#39;t adding AST support any time soon, and
CEDET is too slow and too clumsy with macros for the particular
project that I
had. Here&amp;#39;s
&lt;a href=&quot;https://bitbucket.org/eigen/eigen/src/525f03452c37a400bcc4df194950fa97aa61936a/Eigen/src/Core/Matrix.h?at=default&amp;fileviewer=file-view-default#Matrix.h-426&quot;&gt;the line&lt;/a&gt; in
&lt;a href=&quot;http://eigen.tuxfamily.org/index.php?title=Main_Page&quot;&gt;Eigen&lt;/a&gt; that
broke the camel&amp;#39;s back. Basically it&amp;#39;s 30 lines of macros that expand
to 30 lines of typedefs. Maybe it&amp;#39;s a valid implementation choice, I&amp;#39;d
rather avoid the macros altogether, but in any case I couldn&amp;#39;t get
CEDET to parse that.&lt;/p&gt;

&lt;h2 id=&quot;use-rtags-for-navigation&quot;&gt;Use Rtags for navigation&lt;/h2&gt;

&lt;p&gt;The first thing I tried
was &lt;a href=&quot;https://github.com/Andersbakken/rtags&quot;&gt;rtags&lt;/a&gt;.  My project was
CMake-based, so I just put this line in my subdirectory &lt;code&gt;Makefile&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;cmake:
    cd ../build &amp;amp;&amp;amp; cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;-DCMAKE_EXPORT_COMPILE_COMMANDS=1&lt;/code&gt; causes a
&lt;code&gt;compile_commands.json&lt;/code&gt; file to be emitted during the actual
compilation. This file describes the compile flags for every source
file. These flags are essential in helping the parser understand
what&amp;#39;s going on.&lt;/p&gt;

&lt;p&gt;Then, in the &lt;code&gt;build&lt;/code&gt; directory I start:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;rdm &amp;amp; rc -J .
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally, &lt;code&gt;rtags-find-symbol-at-point&lt;/code&gt; should work now. I still like to
use CEDET as backup, it&amp;#39;s pretty good at tracking variables
defined in the current function:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ciao-goto-symbol&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;deactivate-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;find-tag-marker-ring&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;rtags&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rtags-find-symbol-at-point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;semantic/ia&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;condition-case&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;semantic-ia-fast-jump&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c++-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ciao-goto-symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c++-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-,&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;pop-tag-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For my other C++ projects which aren&amp;#39;t CMake-based, I use the
excellent &lt;a href=&quot;https://github.com/rizsotto/Bear&quot;&gt;bear&lt;/a&gt; tool to emit the
&lt;code&gt;compile_commands.json&lt;/code&gt; file. It&amp;#39;s as easy as:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;make clean
bear make
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;use-irony-for-completion&quot;&gt;Use Irony for completion&lt;/h2&gt;

&lt;p&gt;It didn&amp;#39;t take long to figure out that &lt;code&gt;rtags&lt;/code&gt; isn&amp;#39;t great at
completion. I almost accepted that&amp;#39;s just the way it is.  But this
morning I decided to make some changes and
try &lt;a href=&quot;https://github.com/Sarcasm/irony-mode&quot;&gt;irony-mode&lt;/a&gt;.  And it
worked beautifully for completion! What&amp;#39;s ironic, is that &lt;code&gt;irony-mode&lt;/code&gt;
doesn&amp;#39;t have &lt;code&gt;goto-symbol&lt;/code&gt;, so the time spent to figure out &lt;code&gt;rtags&lt;/code&gt;
was worth it.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s my Irony setup; I only changed the &lt;kbd&gt;C-M-i&lt;/kbd&gt; binding to
the newly written &lt;code&gt;counsel-irony&lt;/code&gt;, now available in the &lt;code&gt;counsel&lt;/code&gt;
package on MELPA:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;c++-mode-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;irony-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;c-mode-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;irony-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;my-irony-mode-hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;irony-mode-map&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;remap&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;completion-at-point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-irony&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;irony-mode-map&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;remap&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;complete-symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-irony&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;irony-mode-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;my-irony-mode-hook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;irony-mode-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;irony-cdb-autosetup-compile-options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here are some screenshots of &lt;code&gt;counsel-irony&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-irony-1.png&quot; alt=&quot;screenshot-1&quot;&gt;&lt;/p&gt;

&lt;p&gt;First of all, the completion is displayed inline, similarly to modern IDEs.
You can use all of Ivy&amp;#39;s regex tricks to complete your candidate:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-irony-2.png&quot; alt=&quot;screenshot-2&quot;&gt;&lt;/p&gt;

&lt;p&gt;Note how the power of regex matching allows me to narrow the initial
1622 candidates to only 22 functions that have &lt;code&gt;src1&lt;/code&gt; and &lt;code&gt;src2&lt;/code&gt; as
arguments. One of the candidates is cut off for being longer than the
window width. You can still match against the invisible text, but you
won&amp;#39;t see it. It&amp;#39;s possible to use &lt;kbd&gt;C-c C-o&lt;/kbd&gt; (&lt;code&gt;ivy-occur&lt;/code&gt;) to
store the current candidates into a buffer:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-irony-3.png&quot; alt=&quot;screenshot-3&quot;&gt;&lt;/p&gt;

&lt;p&gt;Clicking the mouse on any of the lines in the new buffer will insert
the appropriate symbol into the C++ buffer.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I&amp;#39;d like to thank the authors of &lt;code&gt;rtags&lt;/code&gt; and &lt;code&gt;irony-mode&lt;/code&gt; for these
nice packages. Hopefully, &lt;code&gt;counsel-irony&lt;/code&gt; is a nice addition. Happy
hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Quickly ediff files from dired</title>
   <link href="https://oremacs.com/2017/03/18/dired-ediff/"/>
   <updated>2017-03-18T00:00:00+01:00</updated>
   <id>https://oremacs.com/2017/03/18/dired-ediff</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;ediff.el --- a comprehensive visual interface to diff &amp;amp; patch&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I wrote about
ediff &lt;a href=&quot;https://oremacs.com/2015/01/17/setting-up-ediff/&quot;&gt;years ago&lt;/a&gt;.
Today, I&amp;#39;ll just reference a useful ediff snippet
from &lt;a href=&quot;https://github.com/abo-abo/oremacs&quot;&gt;my config&lt;/a&gt; that I&amp;#39;ve added
some time ago and refined only recently.&lt;/p&gt;

&lt;p&gt;The premise is quite simple: press &lt;kbd&gt;e&lt;/kbd&gt; in &lt;code&gt;dired-mode&lt;/code&gt; to
immediately ediff two marked files, no questions asked:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ora-ediff-files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here&amp;#39;s the code, with a few bells and whistles:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;; -*- lexical-binding: t -*-&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-ediff-files&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-get-marked-files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;wnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;current-window-configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cadr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;read-file-name&lt;/span&gt;
                        &lt;span class=&quot;s&quot;&gt;&amp;quot;file: &amp;quot;&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-dwim-target-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;file-newer-than-file-p&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ediff-files&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ediff-files&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ediff-after-quit-hook-internal&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ediff-after-quit-hook-internal&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set-window-configuration&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;wnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;no more than 2 files should be marked&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Some notes on how the extra code adds convenience:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In case no files are marked, the file at point is used as the first
file, and &lt;code&gt;read-file-name&lt;/code&gt; is used for the second file.  Since I
have the magic &lt;code&gt;(setq dired-dwim-target t)&lt;/code&gt; in my config, in case a
second &lt;code&gt;dired&lt;/code&gt; buffer is open, &lt;code&gt;dired-dwim-target-directory&lt;/code&gt; will
offer it as the starting directory during completion. Very useful
to compare two files in two different directories.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Depending on the order of the arguments to &lt;code&gt;ediff-files&lt;/code&gt;, the
changes will appear either as added or removed;
&lt;code&gt;file-newer-than-file-p&lt;/code&gt; tries to put the arguments in a logical
order by looking at the files&amp;#39; last change times.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;ediff-after-quit-hook-internal&lt;/code&gt; is used to restore the previous
  window configuration after I quit &lt;code&gt;ediff&lt;/code&gt; with &lt;kbd&gt;q&lt;/kbd&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That&amp;#39;s about it. Hopefully, it&amp;#39;s useful. Happy hacking.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Make it so. file1 -&gt; Makefile -&gt; file2</title>
   <link href="https://oremacs.com/2017/02/25/warp-9-make-it-so/"/>
   <updated>2017-02-25T00:00:00+01:00</updated>
   <id>https://oremacs.com/2017/02/25/warp-9-make-it-so</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/make-it-so&quot;&gt;make-it-so&lt;/a&gt; is an old package
of mine that I haven&amp;#39;t yet highlighted on the blog. This package helps
you manage a collection of makefiles that are used to generate new
files from existing files using shell commands.&lt;/p&gt;

&lt;p&gt;You can think of these makefiles as a directory of shell functions,
arranged by the extension of the files that they operate on:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;&lt;/span&gt;$ &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; make-it-so &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; find recipes -name Makefile
recipes/ipynb/to-md/Makefile
recipes/ogv/crop/Makefile
recipes/ogv/trim/Makefile
recipes/ogv/to-gif/Makefile
recipes/pdf/to-txt/Makefile
recipes/md/to-org/Makefile
recipes/md/to-html/Makefile
recipes/cue/split/Makefile
recipes/dot/to-png/Makefile
recipes/m4a/to-mp3/Makefile
recipes/flac/to-mp3/Makefile
recipes/gif/gifsicle/Makefile
recipes/svg/to-png/Makefile
recipes/chm/to-pdf/Makefile
recipes/txt/encode-utf8/Makefile
recipes/mp4/to-mp3/Makefile
recipes/mp4/trim/Makefile
recipes/mp4/replace-audio/Makefile
recipes/png/to-gif/Makefile
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When you call &lt;code&gt;make-it-so&lt;/code&gt; on a particular file, you get completion
for the recipes that are available for that file extension, along with
an option to create a new recipe.&lt;/p&gt;

&lt;h2 id=&quot;example-1-convert-pdf-to-txt&quot;&gt;Example 1: convert &lt;code&gt;pdf&lt;/code&gt; to &lt;code&gt;txt&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Suppose you want to convert a PDF file &lt;code&gt;test.pdf&lt;/code&gt; to a text file &lt;code&gt;test.txt&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In case the recipe is in your collection, you don&amp;#39;t have to remember
the command or the command switches to do it anymore:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;code&gt;test.pdf&lt;/code&gt; in &lt;code&gt;dired&lt;/code&gt; and press &lt;kbd&gt;,&lt;/kbd&gt; (bound to &lt;code&gt;make-it-so&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Select the recipe you want using completion: &lt;code&gt;to-txt&lt;/code&gt; is already provided.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your file and the makefile recipe are moved to the staging area:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;./to-txt_test.pdf/test.pdf
./to-txt_test.pdf/Makefile
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The makefile is opened in a new buffer with the following bindings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;f5&lt;/kbd&gt; (&lt;code&gt;mis-save-and-compile&lt;/code&gt;) will run &lt;code&gt;compile&lt;/code&gt;,
creating &lt;code&gt;test.txt&lt;/code&gt; in the current directory.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-,&lt;/kbd&gt; (&lt;code&gt;mis-finalize&lt;/code&gt;) will finalize the operation,
moving &lt;code&gt;test.pdf&lt;/code&gt; and &lt;code&gt;test.txt&lt;/code&gt; to the parent directory (where
&lt;code&gt;test.pdf&lt;/code&gt; was before), and deleting the staging directory.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-M-,&lt;/kbd&gt; (&lt;code&gt;mis-abort&lt;/code&gt;) will move &lt;code&gt;test.pdf&lt;/code&gt; back to its
initial location and delete all generated files. This command is
effectively an &lt;code&gt;undo&lt;/code&gt; for &lt;code&gt;make-it-so&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It takes a large chunk of text to describe everything, but the key sequence for doing all this is quite short:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;kbd&gt;,&lt;/kbd&gt; - &lt;code&gt;make-it-so&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;RET&lt;/kbd&gt; - select &lt;code&gt;to-txt&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;f5&lt;/kbd&gt; - create &lt;code&gt;test.txt&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-,&lt;/kbd&gt; - finalize.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;example-2-make-a-gif-from-a-series-of-png-images&quot;&gt;Example 2: make a gif from a series of png images&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ll describe the process of creating a high quality gif like this
one, which describes the effect of the &lt;kbd&gt;C&lt;/kbd&gt; key
in &lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lispy-convolute.gif&quot; alt=&quot;lispy-convolute&quot;&gt;&lt;/p&gt;

&lt;p&gt;First, I use &lt;a href=&quot;https://launchpad.net/kazam&quot;&gt;kazam&lt;/a&gt; to take two &lt;code&gt;png&lt;/code&gt;
screenshots of my Emacs screen:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;&lt;/span&gt;$ ls -1 *.png
Screenshot &lt;span class=&quot;m&quot;&gt;2017&lt;/span&gt;-02-25 &lt;span class=&quot;m&quot;&gt;16&lt;/span&gt;:14:49.png
Screenshot &lt;span class=&quot;m&quot;&gt;2017&lt;/span&gt;-02-25 &lt;span class=&quot;m&quot;&gt;16&lt;/span&gt;:15:10.png
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I plan to use &lt;a href=&quot;https://www.lcdf.org/gifsicle/&quot;&gt;gifsicle&lt;/a&gt; to sequence
the still images into a gif. But it only takes &lt;code&gt;gif&lt;/code&gt; as the input
format, so first I have to convert my &lt;code&gt;png&lt;/code&gt; files to non-animated
&lt;code&gt;gif&lt;/code&gt; files.&lt;/p&gt;

&lt;p&gt;I open the &lt;code&gt;dired&lt;/code&gt; buffer where they are located and mark them with
&lt;kbd&gt;m&lt;/kbd&gt; (&lt;code&gt;dired-mark&lt;/code&gt;). Then call &lt;code&gt;make-it-so&lt;/code&gt; with &lt;kbd&gt;,&lt;/kbd&gt;
and select &lt;code&gt;to-gif&lt;/code&gt; recipe.  This recipe has no parameters, so there&amp;#39;s
nothing else to do but &lt;kbd&gt;f5 C-,&lt;/kbd&gt;. Two new files are created:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;&lt;/span&gt;$ ls -1 *.png *.gif
Screenshot_2017-02-25 &lt;span class=&quot;m&quot;&gt;16&lt;/span&gt;:14:49.gif
Screenshot_2017-02-25 &lt;span class=&quot;m&quot;&gt;16&lt;/span&gt;:14:49.png
Screenshot_2017-02-25 &lt;span class=&quot;m&quot;&gt;16&lt;/span&gt;:15:10.gif
Screenshot_2017-02-25 &lt;span class=&quot;m&quot;&gt;16&lt;/span&gt;:15:10.png
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that the file names (the defaults of &lt;code&gt;kazam&lt;/code&gt;) are problematic
when used with makefiles, since they contain spaces and colons. The
Elisp layer of &lt;code&gt;make-it-so&lt;/code&gt; takes care of that. It renames the files
back and forth so that the logic in the makefiles remains simple.&lt;/p&gt;

&lt;p&gt;Next, I mark the two &lt;code&gt;gif&lt;/code&gt; files using &lt;kbd&gt;*%&lt;/kbd&gt;
(&lt;code&gt;dired-mark-files-regexp&lt;/code&gt;), press &lt;kbd&gt;,&lt;/kbd&gt; once more and select
the &lt;code&gt;gifsicle&lt;/code&gt; recipe. I&amp;#39;m presented a makefile with the following
contents:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Makefile&quot; data-lang=&quot;Makefile&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;# ——— parameters —————————————————————————————————&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# delay between frames in hundredths of a second&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;delay&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;60&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# ——— implementation —————————————————————————————&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;DIRGIF&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;shell ls *.gif &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; grep -v anime.gif&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;anime&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;gif&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;anime.gif&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Makefile&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;DIRGIF&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;
    rm -f anime.gif
    gifsicle --delay&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;delay&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; --colors&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;256&lt;/span&gt; --loop &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;DIRGIF&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; &amp;gt; &lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt; &amp;gt;&amp;gt; provide

&lt;span class=&quot;nf&quot;&gt;clean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    rm -f anime.gif provide

&lt;span class=&quot;nf&quot;&gt;install-tools&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    sudo apt-get install gifsicle

&lt;span class=&quot;nf&quot;&gt;.PHONY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;all&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;tools&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clean&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The most commonly useful parameter, the delay between frames, is
nicely documented at the top. I don&amp;#39;t have to remember that the switch
name is &lt;code&gt;--delay&lt;/code&gt; or that the switch style &lt;code&gt;--delay=60&lt;/code&gt; is used. I
simply change the number above until I get the result that I want.&lt;/p&gt;

&lt;h2 id=&quot;example-3-add-a-new-recipe&quot;&gt;Example 3: add a new recipe&lt;/h2&gt;

&lt;p&gt;As a sample scenario, assume you want to convert *.svg to *.png.&lt;/p&gt;

&lt;h3 id=&quot;step-1&quot;&gt;Step 1&lt;/h3&gt;

&lt;p&gt;An internet search leads to &lt;a href=&quot;http://stackoverflow.com/questions/9853325/how-to-convert-a-svg-to-a-png-with-image-magick&quot;&gt;Stack Overflow&lt;/a&gt; and this command:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;inkscape -z -e test.png -w 1024 -h 1024 test.svg
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Navigate to the file(s) in &lt;code&gt;dired&lt;/code&gt; and call &lt;code&gt;make-it-so&lt;/code&gt; with
&lt;kbd&gt;,&lt;/kbd&gt;.  No default actions are available, so just type &amp;quot;to-png&amp;quot;
and hit &lt;kbd&gt;RET&lt;/kbd&gt;.  The &amp;quot;to-&amp;quot; prefix signifies that this is a
conversion, adapting the Makefile to this form:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Makefile&quot; data-lang=&quot;Makefile&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;# This is a template for the Makefile.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Parameters should go in the upper half as:&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#     width = 200&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# and be referenced in the command as $(width)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# ____________________________________________&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;DIRSVG&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;shell dir *.svg&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;DIRPNG&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;DIRSVG:.svg&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;.png&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clean&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Makefile&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;DIRPNG&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;%.png&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; %.&lt;span class=&quot;n&quot;&gt;svg&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;add command here&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt; &amp;gt;&amp;gt; provide

&lt;span class=&quot;nf&quot;&gt;clean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    rm -f *.png provide

&lt;span class=&quot;c&quot;&gt;# Insert the install command here.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# e.g. sudo apt-get install ffmpeg&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;install-tools&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;No tools required&amp;quot;&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;.PHONY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;all&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;tools&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clean&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If the action name doesn&amp;#39;t have a &amp;quot;to-&amp;quot; prefix, the transformation is
assumed to be e.g. &amp;quot;svg&amp;quot; -&amp;gt; &amp;quot;out.svg&amp;quot;. You can change this of course
by editing the Makefile.&lt;/p&gt;

&lt;h3 id=&quot;step-2&quot;&gt;Step 2&lt;/h3&gt;

&lt;p&gt;In case the command needs additional packages in order to work you
might want to change &lt;code&gt;echo &amp;quot;No tools required&amp;quot;&lt;/code&gt; to the appropriate
package install instruction, e.g. &lt;code&gt;sudo apt-get install inkscape&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;When you&amp;#39;re on a new system, this will serve as a reminder of what you
should install in order for the Makefile to work. Simply call:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;&lt;/span&gt;make install-tools
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;step-3&quot;&gt;Step 3&lt;/h3&gt;

&lt;p&gt;Replace &lt;code&gt;echo &amp;quot;add command here&amp;quot;&lt;/code&gt; with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Makefile&quot; data-lang=&quot;Makefile&quot;&gt;&lt;span&gt;&lt;/span&gt;    inkscape -z -e &lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt; -w &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;width&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -h &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;height&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; $^
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The parameters &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; will go to the top of the
Makefile, where they can be customized.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;$@&lt;/code&gt; refers to the output file, &lt;code&gt;test.png&lt;/code&gt; in this case.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;$^&lt;/code&gt; refers to the input file, &lt;code&gt;test.svg&lt;/code&gt; in this case.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That&amp;#39;s it. You can see the final
Makefile &lt;a href=&quot;https://raw.githubusercontent.com/abo-abo/make-it-so/master/recipes/svg/to-png/Makefile&quot;&gt;here&lt;/a&gt;.
Test if the command works with &lt;kbd&gt;f5&lt;/kbd&gt; from the Makefile.  If
you&amp;#39;re happy with it, call &lt;code&gt;mis-finalize&lt;/code&gt; with &lt;kbd&gt;C-,&lt;/kbd&gt; from
&lt;code&gt;dired&lt;/code&gt;.  The Makefile will be saved for all future calls to
&lt;code&gt;make-it-so&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;To summarize the advantages of &lt;code&gt;make-it-so&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write the recipe &lt;em&gt;one time&lt;/em&gt;, never have to look up how to do the
same thing a few months from now.&lt;/li&gt;
&lt;li&gt;A chance to write the recipe &lt;em&gt;zero times&lt;/em&gt;, if someone in the
community has already done it and shared the recipe with you.&lt;/li&gt;
&lt;li&gt;The Elisp layer takes care of hairy file names.&lt;/li&gt;
&lt;li&gt;Parallel commands on multiple files, i.e. &lt;code&gt;make -j8&lt;/code&gt;, are provided for free.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The most important usage tip: until you&amp;#39;re sure that the command and
the Makefile work properly make backups. In fact, make backups period.
Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>elf-mode - view the symbol list in a binary</title>
   <link href="https://oremacs.com/2016/08/28/elf-mode/"/>
   <updated>2016-08-28T00:00:00+02:00</updated>
   <id>https://oremacs.com/2016/08/28/elf-mode</id>
   <content type="html">&lt;p&gt;Recently, I&amp;#39;ve been looking at
&lt;a href=&quot;http://libigl.github.io/libigl/tutorial/tutorial.html#meshrepresentation&quot;&gt;libigl&lt;/a&gt;. I
didn&amp;#39;t manage to fully figure out their CMake build system for
tutorials: although each tutorial has a &lt;code&gt;CMakeLists.txt&lt;/code&gt;, it&amp;#39;s only
possible to build them all at once.&lt;/p&gt;

&lt;p&gt;So I decided to replace &lt;code&gt;CMakeLists.txt&lt;/code&gt; with a good-old &lt;code&gt;Makefile&lt;/code&gt;;
how hard can it be?  Concerning includes, not at all hard: the missing
files are found with &lt;code&gt;counsel-locate&lt;/code&gt; and added to the include path.&lt;/p&gt;

&lt;p&gt;But I had some trouble matching a missing &lt;code&gt;ld&lt;/code&gt; dependency to a library
file. Fixed it with a bunch of googling and guesswork; I still wonder
if there&amp;#39;s a better way. But in the process, I&amp;#39;ve found this useful
command:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;&lt;/span&gt;readelf --syms libGL.so
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;which produces e.g.:&lt;/p&gt;

&lt;pre&gt;&lt;small&gt;
Symbol table '.dynsym' contains 2732 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 000000000004faf0     0 SECTION LOCAL  DEFAULT    8
     2: 00000000000e8f20     0 FUNC    GLOBAL DEFAULT   11 glGetIntegerui64i_vNV
     3: 00000000000e13e0     0 FUNC    GLOBAL DEFAULT   11 glGetMultiTexEnvfvEXT
     4: 00000000000d7440     0 FUNC    GLOBAL DEFAULT   11 glProgramUniform2uiv
     5: 00000000000cfdc0     0 FUNC    GLOBAL DEFAULT   11 glMultiTexCoord3sv
&lt;/small&gt;&lt;/pre&gt;

&lt;p&gt;This is a pretty good representation of a binary file: in this
example, instead of one megabyte of gibberish I see a bit more than
2732 lines describing the functions this file uses and provides.&lt;/p&gt;

&lt;h2 id=&quot;viewing-the-symbol-list-automatically&quot;&gt;Viewing the symbol list automatically&lt;/h2&gt;

&lt;p&gt;I liked the above representation so much that I want to see it by
default. In Emacs, it&amp;#39;s pretty easy to do with &lt;code&gt;auto-mode-alist&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;auto-mode-alist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.\\(?:a\\|so\\)\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elf-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The above code instructs Emacs to call &lt;code&gt;elf-mode&lt;/code&gt; function whenever
the file name ends in &lt;code&gt;*.a&lt;/code&gt; or &lt;code&gt;*.so&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And here&amp;#39;s the body of &lt;code&gt;elf-mode&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defvar-local&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elf-mode&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elf-mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;inhibit-read-only&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elf-mode&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert-file-contents&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-file-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elf-mode&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elf-mode&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;shell-command-to-string&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;readelf --syms %s&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-file-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set-buffer-modified-p&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;read-only-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The idea is very simple: &lt;code&gt;elf-mode&lt;/code&gt; is a toggle function that replaces
the buffer contents with the shell command output. It carefully uses
&lt;code&gt;read-only-mode&lt;/code&gt; and &lt;code&gt;set-buffer-modified-p&lt;/code&gt; so that the file will not
be overwritten by accident with the symbol names.&lt;/p&gt;

&lt;h2 id=&quot;using-autoload-to-avoid-overhead&quot;&gt;Using autoload to avoid overhead&lt;/h2&gt;

&lt;p&gt;As you might imagine, looking at binaries isn&amp;#39;t really a common
task. Is it worth to be dragging this code around from now on, loading
it on each start? The answer is yes, of course. Since the actual cost
is negligible until the feature is used.&lt;/p&gt;

&lt;p&gt;If you look above, &lt;code&gt;elf-mode&lt;/code&gt; has an &lt;code&gt;;;;###autoload&lt;/code&gt; cookie before
it. The cookie results in this line in my &lt;code&gt;loaddefs.el&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;autoload&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;elf-mode&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;modes/ora-elf&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;My &lt;code&gt;init.el&lt;/code&gt; always loads &lt;code&gt;loaddefs.el&lt;/code&gt;, but never loads &lt;code&gt;ora-elf.el&lt;/code&gt;
where the function is defined. That file is only loaded when the
function &lt;code&gt;elf-mode&lt;/code&gt; is called for the first time. The above &lt;code&gt;autoload&lt;/code&gt;
statement simply instructs Emacs to load a particular file when
&lt;code&gt;elf-mode&lt;/code&gt; needs to be called.&lt;/p&gt;

&lt;p&gt;When you use the package manager, the autoloads file is generated and
loaded for you automatically:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;&lt;/span&gt;$ tree elpa/ace-link-20160811.112/

elpa/ace-link-20160811.112/
├── ace-link-autoloads.el
├── ace-link.el
├── ace-link.elc
└── ace-link-pkg.el

&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; directories, &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt; files
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, the package manager will always load &lt;code&gt;ace-link-autoloads.el&lt;/code&gt;,
which instructs Emacs to load &lt;code&gt;ace-link.el&lt;/code&gt; when one of the
&lt;code&gt;;;;###autoload&lt;/code&gt; functions is called and &lt;code&gt;ace-link.el&lt;/code&gt; isn&amp;#39;t yet
loaded.&lt;/p&gt;

&lt;p&gt;As an example of how useful delayed loading is: my 6000 line
&lt;a href=&quot;https://github.com/abo-abo/oremacs&quot;&gt;config&lt;/a&gt; starts in 1.8 seconds.
About 40% of that time is spent on &lt;code&gt;(package-initialize)&lt;/code&gt;, which I
assume is the package manager loading all those &lt;code&gt;*-autoloads.el&lt;/code&gt; files
that I have in my &lt;code&gt;elpa/&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Let me know if there&amp;#39;s interest to have &lt;code&gt;elf-mode&lt;/code&gt; on MELPA.  Also, if
anyone knows how to set mode automatically based on the first few
chars of the file (all binaries seem to start with &lt;code&gt;^?ELF&lt;/code&gt;), I&amp;#39;d like
to know that as well. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Swipe all the files!</title>
   <link href="https://oremacs.com/2016/07/29/brand-new-swiper-all/"/>
   <updated>2016-07-29T00:00:00+02:00</updated>
   <id>https://oremacs.com/2016/07/29/brand-new-swiper-all</id>
   <content type="html">&lt;p&gt;If you&amp;#39;ve ever tried the &lt;code&gt;swiper-all&lt;/code&gt; from
&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt;, forget everything about
it.  The command was super-awkward, since it had to parse all your
open files before giving you a chance enter anything, resulting in
dozens of seconds before the prompt.&lt;/p&gt;

&lt;p&gt;Recently, I&amp;#39;ve had some time to examine and improve it and the result
looks very promising. The new command is now async, which means
there&amp;#39;s no delay before the prompt comes up. Here&amp;#39;s a result I got
with no delay while having around 50 buffers open:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/swiper-all.png&quot; alt=&quot;swiper-all.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;The shortcut I&amp;#39;m using:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c u&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;swiper-all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For efficiency&amp;#39;s sake a small trade off had to be made: the line
numbers are no longer displayed. This actually results in an advantage
that you can select different candidates on the same line.&lt;/p&gt;

&lt;p&gt;There are still a few things I plan to try for the new command, like
adding file-less buffers, caching for incremental regexes and maybe
even newlines in wild cards, but even now it seems very usable. So
give it a try, enjoy and happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Bookmark the current window layout with Ivy</title>
   <link href="https://oremacs.com/2016/06/27/ivy-push-view/"/>
   <updated>2016-06-27T00:00:00+02:00</updated>
   <id>https://oremacs.com/2016/06/27/ivy-push-view</id>
   <content type="html">&lt;p&gt;Today&amp;#39;s post is about the newest feature related to the
&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;ivy-switch-buffer&lt;/a&gt; command. If you
use &lt;code&gt;ivy-mode&lt;/code&gt;, you&amp;#39;re probably already using &lt;code&gt;ivy-switch-buffer&lt;/code&gt;
since it overwrites the built-in &lt;code&gt;switch-to-buffer&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The cool thing about &lt;code&gt;ivy-switch-buffer&lt;/code&gt; is that it&amp;#39;s not only buffers
that are offered for completion. Other buffer-like entities can be
there as well: bookmarks, recently opened files (&lt;code&gt;recentf&lt;/code&gt;), and
finally, window layouts. Since all of those are relatively the same
concept, it&amp;#39;s very convenient to have them all in one place available
for completion.&lt;/p&gt;

&lt;p&gt;Here are the relevant settings:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;; Enable bookmarks and recentf&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-use-virtual-buffers&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;; Example setting for ivy-views&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-views&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dutch + notes {}&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;vert&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;dutch.org&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;notes&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ivy.el {}&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;horz&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-library-name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ivy&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*scratch*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I did mention &lt;code&gt;ivy-views&lt;/code&gt; before in the
&lt;a href=&quot;http://oremacs.com/2016/04/26/ivy-0.8.0/&quot;&gt;ivy-0.8.0 release&lt;/a&gt; post.
But now, instead of setting &lt;code&gt;ivy-views&lt;/code&gt; by hand, you can also bind
&lt;code&gt;ivy-push-view&lt;/code&gt; to a key and store as many window configurations as
you like, really fast. &lt;/p&gt;

&lt;p&gt;What gets stored:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The window list - all windows open on the current frame.&lt;/li&gt;
&lt;li&gt;The window splits relative to each other as a tree. Currently, the
size of the split isn&amp;#39;t saved, all windows are split equally.&lt;/li&gt;
&lt;li&gt;The point positions in each window. If you use just one window,
you&amp;#39;ve got something similar to &lt;code&gt;bookmark-set&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;recommended-key-bindings&quot;&gt;Recommended key bindings&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s what I use currently:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-push-view&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c V&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-pop-view&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;typical-workflow&quot;&gt;Typical workflow&lt;/h2&gt;

&lt;p&gt;Suppose I have two files open: the file &lt;code&gt;2016-06-23-ivy-push-view.md&lt;/code&gt;
and the &lt;code&gt;_posts&lt;/code&gt; directory. By pressing &lt;kbd&gt;C-c v&lt;/kbd&gt; I am prompted
for a view name with the default being e.g. 
&lt;code&gt;{} 2016-06-23-ivy-push-view.md _posts 2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I can still name the view however I want, but I typically just press
&lt;kbd&gt;RET&lt;/kbd&gt;.  The parts of the automatic view name are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;{}&lt;/code&gt; - this is a simple string marker to distinguish the views in
the buffer view. If I enter only &lt;code&gt;{}&lt;/code&gt; into &lt;code&gt;ivy-switch-buffer&lt;/code&gt;
prompt, the candidates will normally filter to only views, since
very rarely will a file or a buffer name match &lt;code&gt;{}&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;2016-06-23-ivy-push-view.md _posts&lt;/code&gt; is the list of buffers stored
in the view. This view has only two buffers, but &lt;code&gt;ivy-push-view&lt;/code&gt; can
handle as many windows as you can cram into a single frame.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;2&lt;/code&gt; means that I already have two views with the same buffers, each
new view with the same buffers gets an increased number for the
suggested name. And it&amp;#39;s not useless to have many views for the same
buffers, since the views also store point positions, not just the
window list.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here&amp;#39;s the beauty of it for me: when I type &lt;code&gt;_posts&lt;/code&gt; into
&lt;code&gt;ivy-switch-buffer&lt;/code&gt; I can chose to open the &lt;code&gt;_posts&lt;/code&gt; directory in a
variety of ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the buffer is currently open, I can just switch there.&lt;/li&gt;
&lt;li&gt;If the buffer is currently closed, I can re-open it, thanks to &lt;code&gt;recentf&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I can open the buffer as part of a stored view(s) in &lt;code&gt;ivy-views&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, if I decide that I don&amp;#39;t need a particular view any more, I
can delete it with &lt;kbd&gt;C-c V&lt;/kbd&gt; (&lt;code&gt;ivy-pop-view&lt;/code&gt;). It&amp;#39;s possible to
delete many views at once by pressing &lt;kbd&gt;C-M-m&lt;/kbd&gt; (&lt;code&gt;ivy-call&lt;/code&gt;),
as usual with most &lt;code&gt;ivy&lt;/code&gt; completion functions.&lt;/p&gt;

&lt;h2 id=&quot;breaking-api-change&quot;&gt;Breaking API change&lt;/h2&gt;

&lt;p&gt;While implementing &lt;code&gt;ivy-set-view&lt;/code&gt; I decided that the current way alist
collections are handled together with actions is sub-optimal.  Here&amp;#39;s
the new way of working:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-with&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;test: &amp;quot;&lt;/span&gt;
     &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;one&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;three&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
     &lt;span class=&quot;nb&quot;&gt;:action&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;t C-m&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; =&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (&amp;quot;three&amp;quot; . 3)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Previously, the return result would be &lt;code&gt;3&lt;/code&gt;, i.e. the &lt;code&gt;cdr&lt;/code&gt; of the
selected candidate. Any code using &lt;code&gt;ivy-read&lt;/code&gt; with an alist-type
collection will break. I fixed all instances in &lt;code&gt;counsel.el&lt;/code&gt;, and
there actually aren&amp;#39;t too many uses in the published third party
packages.&lt;/p&gt;

&lt;p&gt;A simple fix to the problem is to use &lt;code&gt;cdr&lt;/code&gt; in the action function.
Additionally, having more information available in the action function
will serve to improve the code.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Set an Emacs variable with double completion</title>
   <link href="https://oremacs.com/2016/06/06/counsel-set-variable/"/>
   <updated>2016-06-06T00:00:00+02:00</updated>
   <id>https://oremacs.com/2016/06/06/counsel-set-variable</id>
   <content type="html">&lt;p&gt;I&amp;#39;d like to show off a certain Elisp productivity booster that I&amp;#39;ve
had in an unfinished state for a while and finished just today.  &lt;/p&gt;

&lt;p&gt;A large part of tweaking Elisp is simply setting variables. The new
command, &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;counsel-set-variable&lt;/a&gt;,
allows to set them quite a bit faster.&lt;/p&gt;

&lt;h2 id=&quot;completion-stage-1&quot;&gt;Completion stage 1:&lt;/h2&gt;

&lt;p&gt;First of all, you get completion for all variables that you have defined:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-set-variable-1.png&quot; alt=&quot;counsel-set-variable-1.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;completion-stage-2&quot;&gt;Completion stage 2:&lt;/h2&gt;

&lt;p&gt;Once a symbol is selected, the code checks whether the symbol is a
&lt;code&gt;defcustom&lt;/code&gt; with type &lt;code&gt;&amp;#39;boolean&lt;/code&gt; or &lt;code&gt;&amp;#39;radio&lt;/code&gt;. Since then it is
possible to offer all values that the symbol is allowed to become for
completion.&lt;/p&gt;

&lt;p&gt;For example, here&amp;#39;s a typical &lt;code&gt;&amp;#39;radio&lt;/code&gt;-type definition:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-style&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;at-full&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;The default method of displaying the overlays.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Use &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`avy-styles-alist&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; to customize this per-command.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;choice&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Pre&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pre&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;At&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;At Full&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;at-full&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Post&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;De Bruijn&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;de-bruijn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here&amp;#39;s a completion screen offered for this variable:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-set-variable-2.png&quot; alt=&quot;counsel-set-variable-2.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;It is worth noting that the current value of the variable is
pre-selected, to give a nice reference point for the new setting.&lt;/p&gt;

&lt;h3 id=&quot;in-case-the-symbol-isnt-a-boolean-or-a-radio&quot;&gt;In case the symbol isn&amp;#39;t a boolean or a radio&lt;/h3&gt;

&lt;p&gt;Then you get a completion session similar to &lt;kbd&gt;M-x&lt;/kbd&gt;
&lt;code&gt;read-expression&lt;/code&gt;, but with the initial contents already filled
in. For example:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-set-variable-3.png&quot; alt=&quot;counsel-set-variable-3.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;read-expression&lt;/code&gt; part combines well with this setting in my config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;conditionally-enable-lispy&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;this-command&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;eval-expression&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;minibuffer-setup-hook&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;conditionally-enable-lispy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s a series of commands using
&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy-mode&lt;/a&gt; that I would typically
use for the screenshot above, to set &lt;code&gt;ivy-re-builders-alist&lt;/code&gt; to a new
value:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;kbd&gt;C-f&lt;/kbd&gt; (&lt;code&gt;forward-char&lt;/code&gt;) to get into special.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;-e&lt;/kbd&gt; (&lt;code&gt;lispy-ace-subword&lt;/code&gt;) to mark the &lt;code&gt;plus&lt;/code&gt; part of the code.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-d&lt;/kbd&gt; (&lt;code&gt;lispy-delete&lt;/code&gt;) to delete the active region.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After the &lt;kbd&gt;C-f -e C-d&lt;/kbd&gt; chain of bindings, the minibuffer contents become:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-re-builders-alist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--regex-|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I press &lt;kbd&gt;C-M-i&lt;/kbd&gt; (&lt;code&gt;completion-at-point&lt;/code&gt;) to get completion for
all symbols that start with &lt;code&gt;ivy--regex-&lt;/code&gt;. Since I have &lt;code&gt;ivy-mode&lt;/code&gt; on,
&lt;kbd&gt;C-M-i&lt;/kbd&gt; starts a recursive completion session. I highly
recommend adding these settings to your config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;; Allow to read from minibuffer while in minibuffer.&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;enable-recursive-minibuffers&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;; Show the minibuffer depth (when larger than 1)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;minibuffer-depth-indicate-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally, I would e.g. select e.g. &lt;code&gt;ivy--regex-fuzzy&lt;/code&gt; and &lt;kbd&gt;RET
RET&lt;/kbd&gt; to finalize the eval. The first &lt;kbd&gt;RET&lt;/kbd&gt; exits from
&lt;code&gt;completion-at-point&lt;/code&gt; and the second &lt;kbd&gt;RET&lt;/kbd&gt; exits from
&lt;code&gt;counsel-set-variable&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I think this command, especially the newly added &lt;code&gt;read-expression&lt;/code&gt;
part, is quite a bit faster than what I did before. That is switching
to &lt;code&gt;*scratch*&lt;/code&gt; and typing in the &lt;code&gt;setq&lt;/code&gt; manually and evaluating with
&lt;kbd&gt;C-j&lt;/kbd&gt;. Here&amp;#39;s my binding for the new command:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f2&amp;gt; j&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-set-variable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It&amp;#39;s not very mnemonic, but it&amp;#39;s really fast. Just a suggestion, in
case you don&amp;#39;t know where to bind it. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy 0.8.0 is out</title>
   <link href="https://oremacs.com/2016/04/26/ivy-0.8.0/"/>
   <updated>2016-04-26T00:00:00+02:00</updated>
   <id>https://oremacs.com/2016/04/26/ivy-0.8.0</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Ivy&lt;/a&gt; is a completion method that&amp;#39;s
similar to &lt;code&gt;Ido&lt;/code&gt;, but with emphasis on simplicity and customizability.&lt;/p&gt;

&lt;h2 id=&quot;new-package-names&quot;&gt;New package names&lt;/h2&gt;

&lt;h3 id=&quot;changes-on-melpa&quot;&gt;Changes on MELPA&lt;/h3&gt;

&lt;p&gt;Due to multiple requests, in an attempt to simplify things a new
package &lt;code&gt;ivy&lt;/code&gt; has been released on MELPA. The old package &lt;code&gt;swiper&lt;/code&gt;,
which used to provide most of the &lt;code&gt;ivy&lt;/code&gt; features, now only provides
&lt;code&gt;swiper.el&lt;/code&gt; and depends on &lt;code&gt;ivy&lt;/code&gt;. The third package &lt;code&gt;counsel&lt;/code&gt;, which
provides most of the goodies using &lt;code&gt;ivy&lt;/code&gt; hasn&amp;#39;t been changed and is
still on MELPA. All three packages have the version &lt;code&gt;0.8.0&lt;/code&gt; currently.&lt;/p&gt;

&lt;p&gt;To reiterate the dependencies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ivy&lt;/code&gt; depends on Emacs version larger than 24.1, preferably at least 24.3 (the most common one bundled currently with Linux distributions).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swiper&lt;/code&gt; depends on &lt;code&gt;ivy&lt;/code&gt; and provides basically 3 commands: &lt;code&gt;swiper&lt;/code&gt;, &lt;code&gt;swiper-multi&lt;/code&gt; and &lt;code&gt;swiper-all&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel&lt;/code&gt; depends on &lt;code&gt;swiper&lt;/code&gt; and provides around 50 commands for all kinds of stuff. My favorites are &lt;code&gt;counsel-M-x&lt;/code&gt;, &lt;code&gt;counsel-git-grep&lt;/code&gt;, &lt;code&gt;counsel-rhythmbox&lt;/code&gt; and &lt;code&gt;counsel-grep-or-swiper&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;changes-on-gnu-elpa&quot;&gt;Changes on GNU ELPA&lt;/h3&gt;

&lt;p&gt;On &lt;a href=&quot;http://elpa.gnu.org/packages/&quot;&gt;GNU ELPA&lt;/a&gt;, a single package
&lt;code&gt;ivy-0.8.0&lt;/code&gt; has replaced the previous stable version &lt;code&gt;swiper-0.7.0&lt;/code&gt;.
This package provides all the files combined of the three separate
MELPA packages.&lt;/p&gt;

&lt;h2 id=&quot;release-summary&quot;&gt;Release summary&lt;/h2&gt;

&lt;p&gt;The release consists of 282 commits over 5 months by 15 authors. The
detailed Changelog is available
&lt;a href=&quot;http://oremacs.com/swiper/Changelog.html#0.8.0&quot;&gt;here&lt;/a&gt;, thanks to the
ever useful Org mode export. The raw Org file is in
&lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/doc/Changelog.org#080&quot;&gt;doc/Changelog.org&lt;/a&gt;
in the main repository.&lt;/p&gt;

&lt;p&gt;The detailed documentation is available as an &lt;code&gt;(ivy)&lt;/code&gt; Info node and
also in HTML form &lt;a href=&quot;http://oremacs.com/swiper/&quot;&gt;here&lt;/a&gt;. If anyone wants
to document something that&amp;#39;s missing there, I&amp;#39;d appreciate the help:
simply edit
&lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/doc/ivy.org&quot;&gt;doc/ivy.org&lt;/a&gt;
and send me a PR.&lt;/p&gt;

&lt;h2 id=&quot;release-highlights&quot;&gt;Release highlights&lt;/h2&gt;

&lt;p&gt;Below, I&amp;#39;ll highlight some of the new features.&lt;/p&gt;

&lt;h3 id=&quot;allow-to-compose-collections&quot;&gt;Allow to compose collections&lt;/h3&gt;

&lt;p&gt;For example, to stack the top 10 elements of &lt;code&gt;recentf&lt;/code&gt; on top of &lt;code&gt;counsel-locate&lt;/code&gt;, use this code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;small-test&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cl-subseq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;recentf-list&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-sources&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-locate&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;small-test&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;original-source&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;(original-source)&lt;/code&gt; represents the async candidates of
counsel-locate. All extra sources are static - each function is called
once to generate a list of strings, which will be filtered later.&lt;/p&gt;

&lt;p&gt;See &lt;a href=&quot;https://github.com/abo-abo/swiper/issues/373&quot;&gt;#373&lt;/a&gt; for more info.&lt;/p&gt;

&lt;h3 id=&quot;improved-documentation&quot;&gt;Improved documentation&lt;/h3&gt;

&lt;p&gt;If you&amp;#39;re not yet familiar with Ivy, you can get a quick reference
card by pressing &lt;kbd&gt;C-h m&lt;/kbd&gt; during any completion session.  It
will pop up an Org-mode buffer that describes most of the minibuffer
key bindings.&lt;/p&gt;

&lt;p&gt;Additionally, &lt;kbd&gt;C-o&lt;/kbd&gt; (&lt;code&gt;hydra-ivy/body&lt;/code&gt;), which serves a quick
reference as well, received a small restructuring and a new
binding. Press &lt;kbd&gt;D&lt;/kbd&gt; to go to the definition of this
hydra. This is useful to see what each key does, you might even want
to customize some of it.&lt;/p&gt;

&lt;h3 id=&quot;completion-in-region&quot;&gt;Completion in region&lt;/h3&gt;

&lt;p&gt;From now on, &lt;code&gt;ivy-mode&lt;/code&gt; will also set
&lt;code&gt;completion-in-region-function&lt;/code&gt;. This means that functions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-M-i&lt;/kbd&gt; &lt;code&gt;complete-symbol&lt;/code&gt; in many major modes, &lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;TAB&lt;/kbd&gt; while in the &lt;kbd&gt;M-:&lt;/kbd&gt; (&lt;code&gt;eval-expression&lt;/code&gt;) minibuffer,&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;TAB&lt;/kbd&gt; in a &lt;code&gt;shell&lt;/code&gt; buffer,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;will use &lt;code&gt;ivy&lt;/code&gt; for completion.&lt;/p&gt;

&lt;h3 id=&quot;many-improvements-to-ivy-occur-mode&quot;&gt;Many improvements to &lt;code&gt;ivy-occur-mode&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;You can &amp;quot;permanently&amp;quot; save any completion session by pressing &lt;kbd&gt;C-c
C-o&lt;/kbd&gt; (&lt;code&gt;ivy-occur&lt;/code&gt;).  This will generate a new buffer in
&lt;code&gt;ivy-occur-mode&lt;/code&gt; with all your current candidates inserted there.
Clicking or pressing &lt;kbd&gt;f&lt;/kbd&gt; on any of the candidates in that
buffer will result in the appropriate action being called with that
candidate.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-occur-mode.png&quot; alt=&quot;ivy-occur-mode.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;*ivy-occur ...*&lt;/code&gt; buffers can actually be customized per
collection type. Specifically for &lt;code&gt;swiper&lt;/code&gt;, &lt;code&gt;counsel-git-grep&lt;/code&gt;,
&lt;code&gt;counsel-grep&lt;/code&gt; and &lt;code&gt;counsel-ag&lt;/code&gt;, the customizations are already in
place that allow you to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Edit the buffer with &lt;code&gt;wgrep&lt;/code&gt; by pressing &lt;kbd&gt;C-x C-q&lt;/kbd&gt;
(&lt;code&gt;ivy-wgrep-change-to-wgrep-mode&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Refresh the buffer due to the original files being changed by pressing &lt;kbd&gt;g&lt;/kbd&gt; (&lt;code&gt;ivy-occur-revert-buffer&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The second feature is often useful to me when I want to somehow change
a symbol throughout the project. First I make a list of all
occurrences via e.g. &lt;code&gt;swiper&lt;/code&gt; and &lt;code&gt;ivy-occur&lt;/code&gt;. After I went through
some of the occurrences, I can press &lt;kbd&gt;g&lt;/kbd&gt; to refresh the
search for the same symbol and see how many I still have left.&lt;/p&gt;

&lt;p&gt;Yet another cool feature is to press &lt;kbd&gt;c&lt;/kbd&gt;
(&lt;code&gt;ivy-occur-toggle-calling&lt;/code&gt;) to toggle calling the action after each
line movement and cycle through candidates by holding either
&lt;kbd&gt;j&lt;/kbd&gt; (&lt;code&gt;ivy-occur-next-line&lt;/code&gt;) or &lt;kbd&gt;k&lt;/kbd&gt;
(&lt;code&gt;ivy-occur-previous-line&lt;/code&gt;).&lt;/p&gt;

&lt;h3 id=&quot;ivy-set-action-can-work-on-all-commands&quot;&gt;&lt;code&gt;ivy-set-action&lt;/code&gt; can work on all commands&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s the code I&amp;#39;m using currently in my config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-insert-action&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with-ivy-window&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-actions&lt;/span&gt;
 &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;I&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-insert-action&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;insert&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This allows me to press &lt;kbd&gt;M-o I&lt;/kbd&gt; to insert the current
candidate into the buffer. For instance, if I want to quote an Emacs
command, I can &lt;kbd&gt;M-x&lt;/kbd&gt; (&lt;code&gt;counsel-M-x&lt;/code&gt;), select the command I
want and press &lt;kbd&gt;M-o I&lt;/kbd&gt; to insert it instead of calling it.&lt;/p&gt;

&lt;h3 id=&quot;virtual-views-in-ivy-switch-buffer&quot;&gt;Virtual views in &lt;code&gt;ivy-switch-buffer&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Here, &amp;quot;virtual&amp;quot; buffer means something that&amp;#39;s close to a buffer but
not an actual buffer. If you were using the setting
&lt;code&gt;ivy-use-virtual-buffers&lt;/code&gt;, you&amp;#39;d have your bookmarks and &lt;code&gt;recentf&lt;/code&gt;
items available to you as virtual buffers.&lt;/p&gt;

&lt;p&gt;The new feature allows to select a whole window configuration with
many buffers inside nested horizontal and vertical splits from
&lt;code&gt;ivy-switch-buffer&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To use it, set &lt;code&gt;ivy-views&lt;/code&gt;, since it&amp;#39;s nil by default. For instance,
here&amp;#39;s what I have in my config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-views&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dutch + notes {}&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;vert&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;dutch.org&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;notes&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ivy {}&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;horz&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ivy.el&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*scratch*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For a more elaborate and detailed use, see
&lt;a href=&quot;http://informatica.boccaperta.com/m-x-emacs-piu-rapidi-con-ivy-views/&quot;&gt;this post&lt;/a&gt;
by Manuel Uberti.&lt;/p&gt;

&lt;h3 id=&quot;magic-slash-in-file-name-completion&quot;&gt;Magic slash in file name completion&lt;/h3&gt;

&lt;p&gt;From now on, if you want to enter a directory, simply select a
candidate which is a directory and press &lt;kbd&gt;/&lt;/kbd&gt;. You can still
use the old binding &lt;kbd&gt;C-j&lt;/kbd&gt; (&lt;code&gt;ivy-alt-done&lt;/code&gt;), but &lt;kbd&gt;/&lt;/kbd&gt;
is shorter and easier to get used to if you&amp;#39;re switching from Ido.&lt;/p&gt;

&lt;p&gt;Note that this does not prevent the use of old functionality like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;//&lt;/kbd&gt; to enter the root directory,&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/ssh:&lt;/code&gt; &lt;kbd&gt;RET&lt;/kbd&gt; to connect via TRAMP.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;a-better-way-to-search-with-counsel-grep-or-swiper&quot;&gt;A better way to search with &lt;code&gt;counsel-grep-or-swiper&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;If you&amp;#39;ve ever been annoyed with the long start-up time of &lt;code&gt;swiper&lt;/code&gt; in
huge buffers, switch to this setting:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\C-s&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-grep-or-swiper&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command will use &lt;code&gt;swiper&lt;/code&gt; for small buffers, and &lt;code&gt;counsel-grep&lt;/code&gt; for large buffers.&lt;/p&gt;

&lt;p&gt;Something very similar to this command was highlighted in
&lt;a href=&quot;http://karl-voit.at/2016/04/09/chosing-emacs-search-method/&quot;&gt;this post&lt;/a&gt;
by Karl Voit.&lt;/p&gt;

&lt;p&gt;Just to give you an idea of how fast &lt;code&gt;counsel-grep&lt;/code&gt; is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It has 0s start-up time, since it&amp;#39;s async.&lt;/li&gt;
&lt;li&gt;For a two million line file weighing 50MB produced by copying
&lt;code&gt;org.el&lt;/code&gt; a few times, it takes 0.2s to find the 17,664 occurrences
of the word &lt;code&gt;hook&lt;/code&gt;. It still takes 7.5s to search for &lt;code&gt;org&lt;/code&gt; in that
file, simply because there are 500,000 candidates and it takes time
for Emacs to simply receive that input.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;a-list-of-all-new-commands&quot;&gt;A list of all new commands&lt;/h3&gt;

&lt;p&gt;The new commands since &lt;code&gt;0.7.0&lt;/code&gt; are: &lt;code&gt;counsel-tmm&lt;/code&gt;, &lt;code&gt;counsel-imenu&lt;/code&gt;,
&lt;code&gt;counsel-decbinds&lt;/code&gt;, &lt;code&gt;counsel-list-processes&lt;/code&gt;,
&lt;code&gt;ivy-switch-buffer-other-window&lt;/code&gt;, &lt;code&gt;counsel-git-stash&lt;/code&gt;,
&lt;code&gt;counsel-git-log&lt;/code&gt;, &lt;code&gt;counsel-pt&lt;/code&gt;, &lt;code&gt;counsel-linux-app&lt;/code&gt;,
&lt;code&gt;counsel-ace-link&lt;/code&gt;, &lt;code&gt;counsel-esh-history&lt;/code&gt;, &lt;code&gt;counsel-shell-history&lt;/code&gt;,
&lt;code&gt;counsel-grep-or-swiper&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If any of those sound interesting, go ahead and try them out.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Thanks to all the contributors. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Extended syntax for hydra docstrings</title>
   <link href="https://oremacs.com/2016/04/04/hydra-doc-syntax/"/>
   <updated>2016-04-04T00:00:00+02:00</updated>
   <id>https://oremacs.com/2016/04/04/hydra-doc-syntax</id>
   <content type="html">&lt;p&gt;I&amp;#39;ve been getting more and more organized in tracking my tasks and
time with Org-mode. Still using the usual suspects, of course: GTD and
Pomodoro, I&amp;#39;m just getting more diligent with them than in the
previous years.&lt;/p&gt;

&lt;p&gt;So today I wanted to prettify the good old
&lt;code&gt;org-agenda-view-mode-dispatch&lt;/code&gt;, which is bound to &lt;kbd&gt;v&lt;/kbd&gt; in
&lt;code&gt;org-agenda-mode&lt;/code&gt;. Currently, it&amp;#39;s just a boring static &lt;code&gt;message&lt;/code&gt; and
&lt;code&gt;read-char&lt;/code&gt; combination. Why not do it with a
&lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt; instead?&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the current full code, that uses the newly extended doc syntax:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-mode-map&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-org-agenda-view/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-cts&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;args&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-text-property&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;min&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;&amp;#39;org-last-args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nth&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-org-agenda-view&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_d_: ?d? day        _g_: time grid=?g? _a_: arch-trees&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_w_: ?w? week       _[_: inactive      _A_: arch-files&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_t_: ?t? fortnight  _f_: follow=?f?    _r_: report=?r?&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_m_: ?m? month      _e_: entry =?e?    _D_: diary=?D?&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_y_: ?y? year       _q_: quit          _L__l__c_: ?l?&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;SPC&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-reset-view&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-day-view&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;day&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-cts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;s&quot;&gt;&amp;quot;[x]&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[ ]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-week-view&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;week&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-cts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;s&quot;&gt;&amp;quot;[x]&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[ ]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-fortnight-view&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;fortnight&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-cts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;s&quot;&gt;&amp;quot;[x]&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[ ]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-month-view&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;month&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-cts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[x]&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[ ]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;y&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-year-view&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;year&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-cts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[x]&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[ ]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-log-mode&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;% -3S&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-show-log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;L&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-log-mode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-log-mode&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;clockcheck&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-follow-mode&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;% -3S&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-follow-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-archives-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-archives-mode&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-clockreport-mode&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;% -3S&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-clockreport-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-entry-text-mode&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;% -3S&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-entry-text-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-toggle-time-grid&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;% -3S&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-use-time-grid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;D&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-toggle-diary&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;% -3S&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-include-diary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;!&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-agenda-toggle-deadlines&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;[&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-include-inactive-timestamps&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-check-type&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;timeline&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;agenda&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-agenda-redo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Abort&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here&amp;#39;s how it looks like in action, I simply pressed &lt;kbd&gt;v&lt;/kbd&gt; while in the agenda:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-sexp-docstring.png&quot; alt=&quot;hydra-sexp-docstring.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Since many functions that &lt;code&gt;org-agenda-view-mode-dispatch&lt;/code&gt; calls are
toggles, it makes sense for &lt;code&gt;hydra-org-agenda-view&lt;/code&gt; to display the
status of these toggles.&lt;/p&gt;

&lt;p&gt;And it&amp;#39;s actually convenient to toggle a whole lot of things at once,
and the default red hydra keys really come in handy here.&lt;/p&gt;

&lt;h2 id=&quot;quick-explanation-of-the-syntax&quot;&gt;Quick explanation of the syntax&lt;/h2&gt;

&lt;p&gt;Each head of a hydra looks like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;(key cmd &amp;amp;optional doc &amp;amp;rest plist)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The fairly new bit that I&amp;#39;m using here is the ability to use a sexp
instead of a plain string in the &lt;code&gt;doc&lt;/code&gt; part.  This sexp will be
evaluated each time the doc is re-displayed. This means that it can
represent a changing variable, for instance the state of a minor mode
or a variable.&lt;/p&gt;

&lt;p&gt;And here&amp;#39;s the best part: the doc of each head can be quoted in the
hydra&amp;#39;s docstring by using the corresponding key, e.g. &lt;code&gt;?g?&lt;/code&gt;.  This
allows to have very complex docstrings while keeping them easily
aligned in a tabular format.&lt;/p&gt;

&lt;p&gt;Here is only the hydra&amp;#39;s docstring, copied from the above code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;_d_: ?d? day        _g_: time grid=?g? _a_: arch-trees
_w_: ?w? week       _[_: inactive      _A_: arch-files
_t_: ?t? fortnight  _f_: follow=?f?    _r_: report=?r?
_m_: ?m? month      _e_: entry =?e?    _D_: diary=?D?
_y_: ?y? year       _q_: quit          _L__l__c_: ?l?
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Doesn&amp;#39;t that look simple?&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Emacs completion for launching Linux desktop apps.</title>
   <link href="https://oremacs.com/2016/03/16/counsel-linux-app/"/>
   <updated>2016-03-16T00:00:00+01:00</updated>
   <id>https://oremacs.com/2016/03/16/counsel-linux-app</id>
   <content type="html">&lt;p&gt;I&amp;#39;d like to highlight the new command &lt;code&gt;counsel-linux-app&lt;/code&gt; that I
recently added to the &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;counsel&lt;/a&gt;
package:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-linux-app-1.png&quot; alt=&quot;counsel-linux-app-1.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;This command looks through your &lt;code&gt;/usr/share/applications/*.desktop&lt;/code&gt;
and offers to launch them, just like the launcher that you normally
get when you press the super key. My current system is Ubuntu, and the
launcher here is really horrible, so I&amp;#39;m glad to have a much faster
and reliable replacement.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s another screenshot, I open the keyboard settings quite often:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-linux-app-2.png&quot; alt=&quot;counsel-linux-app-2.png&quot;&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Using rsync in dired</title>
   <link href="https://oremacs.com/2016/02/24/dired-rsync/"/>
   <updated>2016-02-24T00:00:00+01:00</updated>
   <id>https://oremacs.com/2016/02/24/dired-rsync</id>
   <content type="html">&lt;p&gt;Here&amp;#39;s a code snippet I&amp;#39;ve found long ago on the internet (the source
seems to be no longer accessible), that has proven valuable time and
time again:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-dired-rsync&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;expand-file-name&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;read-file-name&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;&amp;quot;Rsync to:&amp;quot;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-dwim-target-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; store all selected files into &amp;quot;files&amp;quot; list&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-get-marked-files&lt;/span&gt;
                &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;current-prefix-arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;;; the rsync command&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tmtxt/rsync-command&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;rsync -arvz --progress &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; add all selected file names as arguments&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; to the rsync command&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dolist&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tmtxt/rsync-command&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tmtxt/rsync-command&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;shell-quote-argument&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                    &lt;span class=&quot;s&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; append the destination&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tmtxt/rsync-command&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tmtxt/rsync-command&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;shell-quote-argument&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; run the async shell command&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;async-shell-command&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tmtxt/rsync-command&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*rsync*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; finally, switch to that window&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;other-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Y&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ora-dired-rsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Lets you copy huge files and directories without Emacs freezing up and
with convenient progress bar updates. That is all.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;code&gt;tmtxt&lt;/code&gt;, the mysterious hacker-person from whom the snippet
likely originated .  Good luck with getting your blog back up.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Visiting URLs and issues with counsel-find-file</title>
   <link href="https://oremacs.com/2016/02/15/counsel-ffap/"/>
   <updated>2016-02-15T00:00:00+01:00</updated>
   <id>https://oremacs.com/2016/02/15/counsel-ffap</id>
   <content type="html">&lt;p&gt;Many experienced Emacs users are aware of &lt;code&gt;ffap&lt;/code&gt; command:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Find FILENAME, guessing a default from text around point.
If &lt;code&gt;ffap-url-regexp&lt;/code&gt; is not nil, the FILENAME may also be an URL.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It&amp;#39;s a great way to open an link, if you plan things in advance. But
for me it was usually &lt;kbd&gt;C-x C-f&lt;/kbd&gt; (annoyed grunt) &lt;kbd&gt;C-g M-x
ffap RET&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Now, thanks to &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;counsel-find-file&lt;/a&gt;,
it&amp;#39;s &lt;kbd&gt;C-x C-f&lt;/kbd&gt; (anticipated annoyance, followed by a sigh of
relief) &lt;kbd&gt;M-n&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;With Ivy completion, &lt;kbd&gt;M-n&lt;/kbd&gt; calls &lt;code&gt;ivy-next-history-element&lt;/code&gt;,
which tries to&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://endlessparentheses.com/predicting-the-future-with-the-m-n-key.html&quot;&gt;predict the history element&lt;/a&gt;
in case you&amp;#39;ve reached history&amp;#39;s edge. The prediction usually simply
inserts thing-at-point into the minibuffer. My favorite applications
of this are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-s M-n&lt;/kbd&gt; - &lt;code&gt;swiper&lt;/code&gt; thing-at-point, to get the occurrences
of the current symbol in the current file.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-c j M-n&lt;/kbd&gt; - &lt;code&gt;counsel-git-grep&lt;/code&gt; thing-at-point, to get the
mentions within the current project.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-c g M-n&lt;/kbd&gt; - &lt;code&gt;counsel-git&lt;/code&gt; thing-at-point to open a file
to which the current symbol links.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One thing I&amp;#39;ve recently added is the &lt;code&gt;\_&amp;lt;...\_&amp;gt;&lt;/code&gt; wrapper for when
&lt;code&gt;major-mode&lt;/code&gt; derives from &lt;code&gt;prog-mode&lt;/code&gt;. Since the &lt;code&gt;\_&amp;lt;&lt;/code&gt; regex matches
the symbol start, and &lt;code&gt;\_&amp;gt;&lt;/code&gt; matches the symbol end, there&amp;#39;s no chance
of getting partial matches. You can call &lt;code&gt;undo&lt;/code&gt; or press
&lt;kbd&gt;M-n&lt;/kbd&gt; again in case the symbol bounds aren&amp;#39;t useful.&lt;/p&gt;

&lt;p&gt;Finally, &lt;kbd&gt;C-x C-f M-n&lt;/kbd&gt; can be used to open URLs. Recently,
I&amp;#39;ve added functionality to &lt;code&gt;counsel-find-file&lt;/code&gt; that allows me to also
visit Github issues by simply pointing at the plain issue number,
e.g. &lt;code&gt;#123&lt;/code&gt; in either a version-controlled file or in a Magit buffer.
The command will query:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;$ git remote get-url origin
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and fill in all the details. So I no longer bother with
&lt;code&gt;bug-reference-url-format&lt;/code&gt; and &lt;code&gt;bug-reference-mode&lt;/code&gt; - now it&amp;#39;s all
automatic.&lt;/p&gt;

&lt;p&gt;It&amp;#39;s also possible to make it work for places other than Github, for
instance this code (already included in
&lt;a href=&quot;http://melpa.org/#/counsel&quot;&gt;counsel&lt;/a&gt;) makes it work for the Emacs Git
repository:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-emacs-url-p&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Return a Debbugs issue URL at point.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;looking-at&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#[0-9]+&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;vc-backend&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-file-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;Git&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;memq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;major-mode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;magit-commit-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string-no-properties&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;origin&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;shell-command-to-string&lt;/span&gt;
                   &lt;span class=&quot;s&quot;&gt;&amp;quot;git remote get-url origin&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;git.sv.gnu.org:/srv/git/emacs.git&amp;quot;&lt;/span&gt;
                          &lt;span class=&quot;nv&quot;&gt;origin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;http://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s&amp;quot;&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;substring&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-ffap-url-functions&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-emacs-url-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>avy 0.4.0 is out</title>
   <link href="https://oremacs.com/2016/01/23/avy-0.4.0/"/>
   <updated>2016-01-23T00:00:00+01:00</updated>
   <id>https://oremacs.com/2016/01/23/avy-0.4.0</id>
   <content type="html">&lt;p&gt;This release consists of 77 commits done over the course of the last 7
months by me and many
&lt;a href=&quot;https://github.com/abo-abo/avy/graphs/contributors&quot;&gt;contributors&lt;/a&gt;. Similarly
to the &lt;code&gt;0.3.0&lt;/code&gt; release, the release notes are in
&lt;a href=&quot;https://github.com/abo-abo/avy/blob/master/doc/Changelog.org&quot;&gt;Changelog.org&lt;/a&gt;.
You can read them either at
&lt;a href=&quot;https://github.com/abo-abo/avy/releases/tag/0.4.0&quot;&gt;github&lt;/a&gt; or
&lt;a href=&quot;https://raw.githubusercontent.com/abo-abo/avy/master/doc/Changelog.org&quot;&gt;inside Emacs&lt;/a&gt;.
Big thanks to all contributors.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/wiki/abo-abo/avy/images/avy-avatar-1.png&quot; alt=&quot;avy.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;highlights&quot;&gt;Highlights&lt;/h2&gt;

&lt;p&gt;A lot of new code is just straight upgrades, you don&amp;#39;t need to do
anything extra to use them. Below, I&amp;#39;ll describe the other part of the
new code, which is new commands and custom vars.&lt;/p&gt;

&lt;h3 id=&quot;avy-goto-char-timer&quot;&gt;&lt;code&gt;avy-goto-char-timer&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This command now allows as many characters as you like, which makes it
similar to a &lt;code&gt;isearch&lt;/code&gt; + &lt;code&gt;avy-isearch&lt;/code&gt; combination.  As you type, you
get an &lt;code&gt;isearch&lt;/code&gt;-like highlight, then after a short delay you
automatically get the &lt;code&gt;avy&lt;/code&gt; selection.&lt;/p&gt;

&lt;h3 id=&quot;switch-the-action-midway-from-goto-to-kill-mark-copy&quot;&gt;Switch the action midway from goto to kill/mark/copy&lt;/h3&gt;

&lt;p&gt;This is similar to the cool feature of
&lt;a href=&quot;http://oremacs.com/2015/05/13/ace-window-0.9.0/&quot;&gt;ace-window&lt;/a&gt; that
allows you to switch the action after you get the avy prompt.&lt;/p&gt;

&lt;p&gt;For example, suppose you have:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-t&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avy-goto-word-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s what you can do now to a word that starts with a &amp;quot;w&amp;quot; and is
select-able with &amp;quot;a&amp;quot;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To jump there: &lt;kbd&gt;M-t w a&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;To copy the word instead of jumping to it: &lt;kbd&gt;M-t w na&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;To mark the word after jumping to it: &lt;kbd&gt;M-t w ma&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;To kill the word after jumping to it: &lt;kbd&gt;M-t w xa&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can customize &lt;code&gt;avy-dispatch-alist&lt;/code&gt; to modify these actions, and
also ensure that it plays nicely with your &lt;code&gt;avy-keys&lt;/code&gt;, if you
customized them.  By default, it works fine, since &lt;code&gt;avy-keys&lt;/code&gt; is &lt;code&gt;&amp;#39;(?a
?s ?d ?f ?g ?h ?j ?k ?l)&lt;/code&gt; and the keys on &lt;code&gt;avy-dispatch-alist&lt;/code&gt; are
&lt;code&gt;&amp;#39;(?x ?m ?n)&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;avy-pop-mark&quot;&gt;&lt;code&gt;avy-pop-mark&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This command reverses &lt;code&gt;avy-push-mark&lt;/code&gt; which most of avy commands call.
It has its own history and works across multiple windows and frames.
I&amp;#39;m using it currently as an upgrade to my old &lt;code&gt;(set-mark-command 4)&lt;/code&gt;
lambda:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-p&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avy-pop-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s a line to make &lt;code&gt;avy-pop-mark&lt;/code&gt; work also for &lt;code&gt;swiper&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;advice-add&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;swiper&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:before&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avy-push-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Using Emacs as system-wide Rhythmbox interface</title>
   <link href="https://oremacs.com/2016/01/18/emacs-rhythmbox/"/>
   <updated>2016-01-18T00:00:00+01:00</updated>
   <id>https://oremacs.com/2016/01/18/emacs-rhythmbox</id>
   <content type="html">&lt;p&gt;In an
&lt;a href=&quot;http://oremacs.com/2015/07/09/counsel-rhythmbox/&quot;&gt;earlier post&lt;/a&gt;, I
described how I&amp;#39;ve been managing Rhythmbox from Emacs. I&amp;#39;ve bound the
entry point to &lt;kbd&gt;C-S-o&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-S-o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-rhythmbox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Obviously, this entry point won&amp;#39;t work while outside Emacs. Today,
I&amp;#39;ll describe how I&amp;#39;ve made it work everywhere. Everywhere on Ubuntu
14.04, that is, although a similar approach should work for other
distributions.&lt;/p&gt;

&lt;h2 id=&quot;step-1-make-sure-the-emacs-server-is-running&quot;&gt;Step 1: Make sure the Emacs server is running&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s the relevant part of my &lt;a href=&quot;https://github.com/abo-abo/oremacs/blob/github/init.el&quot;&gt;init.el&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;server-running-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;server-start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Using &lt;code&gt;emacsclient&lt;/code&gt; is essential to avoiding the extra startup time:
even a startup time of one second feels sluggish when all I need is to
open a menu with a song playlist.&lt;/p&gt;

&lt;h2 id=&quot;step-2-install-the-relevant-x-window-tool&quot;&gt;Step 2: Install the relevant X window tool&lt;/h2&gt;

&lt;p&gt;Initially, I only wrote a call to &lt;code&gt;emacsclient&lt;/code&gt;, which resulted in the
Emacs window gaining focus in the end.  Then I thought it would be
nice to give the focus back the original window after the end of
selection, and raise it as well.&lt;/p&gt;

&lt;p&gt;I wanted to do something with &lt;code&gt;wmctrl&lt;/code&gt;, but I found that
&lt;a href=&quot;http://superuser.com/questions/382616/detecting-currently-active-window&quot;&gt;xdotool&lt;/a&gt;
can do what I want in a simple way.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;sudo apt-get install xdotool
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;step-3-write-a-shell-script&quot;&gt;Step 3: Write a shell script&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;wnd_id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;xdotool getwindowfocus&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;&lt;/span&gt;
emacsclient --eval &lt;span class=&quot;s2&quot;&gt;&amp;quot;(progn (x-focus-frame nil) (counsel-rhythmbox))&amp;quot;&lt;/span&gt;
xdotool windowfocus &lt;span class=&quot;nv&quot;&gt;$wnd_id&lt;/span&gt;
xdotool windowraise &lt;span class=&quot;nv&quot;&gt;$wnd_id&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;(x-focus-frame nil)&lt;/code&gt; will raise the Emacs window and give the
keyboard input focus.  &lt;code&gt;emacsclient&lt;/code&gt; will return as soon as I select
something or press &lt;kbd&gt;C-g&lt;/kbd&gt;. At that point the keyboard focus
will be returned to whatever window had it when the script was
invoked.&lt;/p&gt;

&lt;p&gt;By the way, here&amp;#39;s a cool configuration that automatically makes a
file executable if it starts with &lt;code&gt;#!&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;after-save-hook&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;executable-make-buffer-file-executable-if-script-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;step-4-bind-the-shell-script-to-a-key&quot;&gt;Step 4: Bind the shell script to a key&lt;/h2&gt;

&lt;p&gt;Open this (possibly using &lt;code&gt;gnome-control-center&lt;/code&gt; instead, if applicable):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;unity-control-center keyboard
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And add a new shortcut in &lt;code&gt;Shortcuts&lt;/code&gt;/&lt;code&gt;Custom Shortcuts&lt;/code&gt;. I&amp;#39;ve bound
that one to &lt;kbd&gt;C-S-o&lt;/kbd&gt; as well.&lt;/p&gt;

&lt;h2 id=&quot;the-final-result&quot;&gt;The final result&lt;/h2&gt;

&lt;p&gt;It&amp;#39;s pretty convenient: as I&amp;#39;m scrolling something I&amp;#39;m reading in
Firefox with &lt;kbd&gt;j&lt;/kbd&gt; (via
&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/firemacs/&quot;&gt;Firemacs&lt;/a&gt;),
I can seamlessly press &lt;kbd&gt;C-S-o moo RET&lt;/kbd&gt; to play &amp;quot;Sisters of
the Moon&amp;quot;, and continue scrolling the web page with &lt;kbd&gt;j&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;What&amp;#39;s more, Emacs has very nice support for input methods with
&lt;kbd&gt;C-\&lt;/kbd&gt; (&lt;code&gt;toggle-input-method&lt;/code&gt;), so I can also quickly select
Ukrainian-titled songs, while still keeping shortcuts like
&lt;kbd&gt;C-n&lt;/kbd&gt; and &lt;kbd&gt;C-m&lt;/kbd&gt; (&lt;em&gt;without&lt;/em&gt; having to switch the
input method back).&lt;/p&gt;

&lt;p&gt;The whole experience is similar to &lt;code&gt;gnome-do&lt;/code&gt;/&lt;code&gt;synapse&lt;/code&gt;, which I was
using a few years back, except better because now it&amp;#39;s in Emacs.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Better fuzzy matching support in Ivy</title>
   <link href="https://oremacs.com/2016/01/06/ivy-flx/"/>
   <updated>2016-01-06T00:00:00+01:00</updated>
   <id>https://oremacs.com/2016/01/06/ivy-flx</id>
   <content type="html">&lt;p&gt;Recently, I wrote some code to add better highlighting for
&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Ivy&lt;/a&gt;&amp;#39;s fuzzy matcher. Here&amp;#39;s a
quick step-by-step to get an equivalent of
&lt;a href=&quot;https://github.com/lewang/flx&quot;&gt;flx-ido-mode&lt;/a&gt; working with Ivy.&lt;/p&gt;

&lt;h2 id=&quot;step-1-install-the-packages&quot;&gt;Step 1: install the packages&lt;/h2&gt;

&lt;p&gt;&lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;package-install&lt;/code&gt; - &lt;code&gt;counsel&lt;/code&gt; and &lt;code&gt;flx&lt;/code&gt; (MELPA should be configured).&lt;/p&gt;

&lt;h2 id=&quot;step-2-configure-ivy-re-builders-alist&quot;&gt;Step 2: configure &lt;code&gt;ivy-re-builders-alist&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s the default setting:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-re-builders-alist&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--regex-plus&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The default matcher will use a &lt;code&gt;.*&lt;/code&gt; regex wild card in place of each
single space in the input.  If you want to use the fuzzy matcher,
which instead uses a &lt;code&gt;.*&lt;/code&gt; regex wild card between each input letter,
write this in your config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-re-builders-alist&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--regex-fuzzy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can also mix the two regex builders, for example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-re-builders-alist&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-switch-buffer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--regex-plus&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--regex-fuzzy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;t&lt;/code&gt; key is used for all fall-through cases, otherwise the key is
the command or collection name.&lt;/p&gt;

&lt;p&gt;The fuzzy matcher often results in substantially more matching
candidates than the regular one for similar input. That&amp;#39;s why some
kind of sorting is important to bring the more relevant matching
candidates to the start of the list. Luckily, that&amp;#39;s already been
figured out in &lt;code&gt;flx&lt;/code&gt;, so to have it working just make sure that the
&lt;code&gt;flx&lt;/code&gt; package is installed.&lt;/p&gt;

&lt;h2 id=&quot;step-3-optionally-configure-ivy-initial-inputs-alist&quot;&gt;Step 3: optionally configure &lt;code&gt;ivy-initial-inputs-alist&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;ivy-initial-inputs-alist&lt;/code&gt; variable is pretty useful in
conjunction with the default matcher. It&amp;#39;s usually used to insert &lt;code&gt;^&lt;/code&gt;
into the input area for certain commands.&lt;/p&gt;

&lt;p&gt;If you&amp;#39;re going fuzzy all the way, you can do without the initial &lt;code&gt;^&lt;/code&gt;,
and simply let &lt;code&gt;flx&lt;/code&gt; (hopefully) sort the matches in a nice way:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-initial-inputs-alist&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;the-result&quot;&gt;The result&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s how &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;counsel-M-x&lt;/code&gt; looks like now:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-flx-highlight.png&quot; alt=&quot;ivy-flx-highlight.png&quot;&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy-mode 0.7.0 is out</title>
   <link href="https://oremacs.com/2015/12/07/ivy-0.7.0/"/>
   <updated>2015-12-07T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/12/07/ivy-0.7.0</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Ivy-mode&lt;/a&gt; is a completion method
that&amp;#39;s similar to &lt;code&gt;Ido&lt;/code&gt;, but with emphasis on simplicity and
customizability.  Currently, there are two related packages on MELPA:
&lt;code&gt;swiper&lt;/code&gt; and &lt;code&gt;counsel&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;swiper&lt;/code&gt; provides an &lt;code&gt;isearch&lt;/code&gt; replacement, using &lt;code&gt;ivy-read&lt;/code&gt; for
completion, as well as the basic &lt;code&gt;ivy-mode&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel&lt;/code&gt; provides some extra commands that use &lt;code&gt;ivy-read&lt;/code&gt;, like &lt;code&gt;-M-x&lt;/code&gt;, &lt;code&gt;-ag&lt;/code&gt;,
&lt;code&gt;-load-theme&lt;/code&gt; etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;release-notes&quot;&gt;Release Notes&lt;/h2&gt;

&lt;p&gt;The release notes are available at the
&lt;a href=&quot;https://github.com/abo-abo/swiper/releases/tag/0.7.0&quot;&gt;homepage&lt;/a&gt; as usual.
There are 220 commits since the last release, which was on Aug 5, roughly
4 months ago.  Slowly but surely, the
&lt;a href=&quot;https://github.com/abo-abo/swiper/graphs/contributors&quot;&gt;contributors list&lt;/a&gt;
has grown to 20 people, besides me. A few people even got their Emacs
Copyright Assignment just to make large contributions. Statistically,
Org-mode is probably the prime package that leads to the most CA, but
I&amp;#39;m glad that Ivy is there as well, contributing in a small way.&lt;/p&gt;

&lt;p&gt;The release notes are made in
&lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/doc/Changelog.org#070&quot;&gt;Org-mode&lt;/a&gt;,
each new version is a level 1 heading.  With time, hopefully, their
parts will make their way into the
&lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/doc/ivy.org&quot;&gt;manual&lt;/a&gt;,
which is also in Org-mode.&lt;/p&gt;

&lt;p&gt;In addition, I also export each new release notes to
&lt;a href=&quot;https://github.com/abo-abo/swiper/releases/tag/0.7.0&quot;&gt;Markdown&lt;/a&gt; using
&lt;a href=&quot;http://pandoc.org/&quot;&gt;pandoc&lt;/a&gt;, since that&amp;#39;s what Github prefers.&lt;/p&gt;

&lt;h2 id=&quot;release-process&quot;&gt;Release Process&lt;/h2&gt;

&lt;p&gt;Since the release notes for &lt;code&gt;0.7.0&lt;/code&gt; are huge, I don&amp;#39;t embed them into
the post, they&amp;#39;re listed separately.  You can go through them at your
own pace, or wait until I make some highlights for each piece either
or the blog or in the manual. The manual, by the way, is a work in
progress but is already distributed in MELPA. Use &lt;kbd&gt;C-h i&lt;/kbd&gt;
followed by &lt;kbd&gt;g&lt;/kbd&gt; &lt;code&gt;(ivy)&lt;/code&gt; to read it. If you&amp;#39;re new to reading
the info pages, there&amp;#39;s info on info in info format: use &lt;kbd&gt;dg&lt;/kbd&gt;
&lt;code&gt;(info)&lt;/code&gt; to access it.&lt;/p&gt;

&lt;p&gt;Today, I&amp;#39;ll describe some cool stuff that I used to generate the
Markdown notes from &lt;code&gt;Changelog.org&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;org-modes-org-narrow-to-subtree&quot;&gt;Org-mode&amp;#39;s &lt;code&gt;org-narrow-to-subtree&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Since &lt;code&gt;Changelog.org&lt;/code&gt; already has a &lt;code&gt;0.6.0&lt;/code&gt; branch that I didn&amp;#39;t want
to see, I&amp;#39;ve narrowed the buffer to only the &lt;code&gt;0.7.0&lt;/code&gt; branch.  This is
possible to do thanks to Emacs&amp;#39; narrowing feature and
&lt;code&gt;org-narrow-to-subtree&lt;/code&gt;.  After this command, the buffer behaves as if
the &lt;code&gt;0.6.0&lt;/code&gt; branch isn&amp;#39;t there and the only content is &lt;code&gt;0.7.0&lt;/code&gt; branch.
But if I perform any edits and save the file, everything that was
hidden is still there.&lt;/p&gt;

&lt;p&gt;As a shortcut, I&amp;#39;m using my &lt;a href=&quot;https://github.com/abo-abo/worf&quot;&gt;worf&lt;/a&gt; to narrow faster.
Pressing &lt;kbd&gt;[&lt;/kbd&gt; while &lt;code&gt;worf-mode&lt;/code&gt; is active goes back to the current heading start.
While at heading start, pressing alphanumeric keys calls commands instead of self-inserting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;N&lt;/kbd&gt; calls &lt;code&gt;org-narrow-to-subtree&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;W&lt;/kbd&gt; calls &lt;code&gt;widen&lt;/code&gt;, which turns narrowing off.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are, of course, many more commands and bindings in &lt;code&gt;worf&lt;/code&gt;. Check
it out if you like Org&amp;#39;s Speed Keys feature, but feel like it could
use more structure.&lt;/p&gt;

&lt;h3 id=&quot;pandoc-mode&quot;&gt;&lt;code&gt;pandoc-mode&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/joostkremers/pandoc-mode&quot;&gt;pandoc-mode&lt;/a&gt; is an Emacs
interface to &lt;a href=&quot;http://pandoc.org/&quot;&gt;pandoc&lt;/a&gt; - a tool that allows to
export documents from one format to another.
The Elisp package is available in MELPA.
And I installed &lt;a href=&quot;https://github.com/jgm/pandoc/releases/download/1.15.2/pandoc-1.15.2-1-amd64.deb&quot;&gt;pandoc-1.15.2-1-amd64.deb&lt;/a&gt; from
its &lt;a href=&quot;https://github.com/jgm/pandoc/releases/tag/1.15.2&quot;&gt;homepage&lt;/a&gt; with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;sudo dpkg -i pandoc-1.15.2-1-amd64.deb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that, &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;pandoc-mode&lt;/code&gt; and I&amp;#39;m on easy street: &lt;kbd&gt;C-c /&lt;/kbd&gt; calls &lt;code&gt;pandoc-main-hydra/body&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set the output format to Github-flavored Markdown with &lt;kbd&gt;OG&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;Set the input format to Org-mode with &lt;kbd&gt;bIo&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;Export with &lt;kbd&gt;C-c / r&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;View the resulting buffer with &lt;kbd&gt;C-c / V&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;add-table-of-contents-to-markdown&quot;&gt;Add table of contents to Markdown&lt;/h3&gt;

&lt;p&gt;I used &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;markdown-toc/generate-toc&lt;/code&gt; for this. The MELPA
package &lt;a href=&quot;https://github.com/ardumont/markdown-toc&quot;&gt;markdown-toc&lt;/a&gt;
provides this function.  The resulting table of contents is a list
with a bunch of links, which turned out to be dead, because of the way
Github renders Markdown for releases.&lt;/p&gt;

&lt;h3 id=&quot;use-swiper-to-replace-each-markdown-link-with-its-title&quot;&gt;Use &lt;code&gt;swiper&lt;/code&gt; to replace each Markdown link with its title&lt;/h3&gt;

&lt;p&gt;Since &lt;code&gt;swiper&lt;/code&gt; works with regexps, here&amp;#39;s what I input to match each link:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;\[\(.*?\)\](.*?)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This matches anything in brackets (non-greedy), followed by anything
in parens; the bracket&amp;#39;s content is captured in a group.&lt;/p&gt;

&lt;p&gt;Then I press &lt;kbd&gt;M-q&lt;/kbd&gt; (&lt;code&gt;swiper-query-replace&lt;/code&gt;) and enter &lt;code&gt;\1&lt;/code&gt; as
replacement - the first captured group. After this, I confirm each
replacement with &lt;kbd&gt;y&lt;/kbd&gt; or confirm them all at once with
&lt;kbd&gt;!&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;use-rectangle-mark-mode-to-promote-toc-one-level&quot;&gt;Use &lt;code&gt;rectangle-mark-mode&lt;/code&gt; to promote TOC one level&lt;/h3&gt;

&lt;p&gt;Since all entries in the TOC were children to a single &lt;code&gt;0.7.0&lt;/code&gt; entry,
I wanted to remove that entry and promote its children one level.
This can be done with &lt;code&gt;rectangle-mark-mode&lt;/code&gt;, bound by default to &lt;kbd&gt;C-x SPC&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;In my config, I use this instead:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-x SPC&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-rectangle/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Where, &lt;code&gt;hydra-rectangle/body&lt;/code&gt; is provided by &lt;code&gt;hydra-examples.el&lt;/code&gt; and
is also described in
&lt;a href=&quot;http://oremacs.com/2015/02/25/rectangle-hydra/&quot;&gt;an earlier post&lt;/a&gt;.  I
really liked the &lt;code&gt;hydra-rectangle/body&lt;/code&gt; idea and use it all the time.
Here&amp;#39;s a key sequence I used to delete a &lt;code&gt;4x95&lt;/code&gt; rectangle in order to
promote the list items: &lt;kbd&gt;C-x SPC 4l95jdo&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;use-basic-elisp-to-turn-each-bug-reference-into-an-org-mode-link&quot;&gt;Use basic Elisp to turn each bug reference into an Org-mode link&lt;/h3&gt;

&lt;p&gt;When copy-pasting from the commit log into &lt;code&gt;Changelog.org&lt;/code&gt;, I quickly
tired of putting the each issue link as
e.g. &lt;code&gt;[[https://github.com/abo-abo/swiper/issues/244][#244]]&lt;/code&gt;.  So I
wrote e.g. &lt;code&gt;#244&lt;/code&gt; instead, and used this code in the end to make the
transformation:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-quote-github-issues&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;base&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;https://github.com/abo-abo/swiper/issues/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\([^[]\\)#\\([0-9]+\\)&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;replace-match&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;%s[[%s%s][#%s]]&amp;quot;&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;nv&quot;&gt;base&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If anyone reading the blog wants to start with some basic Elisp, the
above function is a nice intro to a lot of useful functions.  And I
expect that many people face this sort of automation scenario pretty
often. I&amp;#39;m pretty sure that &lt;kbd&gt;M-%&lt;/kbd&gt; &lt;code&gt;query-replace-regexp&lt;/code&gt;
could work here as well, but it&amp;#39;s easier for me to just write out the
code and save it for later.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Thanks to everyone who contributed issues, code and
documentation. Enjoy the new release.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>I move my s-expressions back and forth</title>
   <link href="https://oremacs.com/2015/11/30/hydra-lispy-move/"/>
   <updated>2015-11-30T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/11/30/hydra-lispy-move</id>
   <content type="html">&lt;p&gt;Some people find &lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt; too weird
and/or complex to try, quite possibly because of it&amp;#39;s sort-of-modal
key binding structure. Which is a shame, since out of 7k lines of
lispy&amp;#39;s code, only 500 lines do key bindings, the rest do all sorts of
useful stuff, like sexp navigation/modification, outlines and REPL
interaction.&lt;/p&gt;

&lt;p&gt;In this post, I&amp;#39;ll show a short example of using lispy&amp;#39;s functions
outside of &lt;code&gt;lispy-mode&lt;/code&gt;, and compare it with the default approach.&lt;/p&gt;

&lt;h2 id=&quot;moving-s-expressions-while-the-point-is-anywhere&quot;&gt;Moving s-expressions while the point is anywhere&lt;/h2&gt;

&lt;p&gt;Using this simple &lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt;, and the
key sequence &lt;kbd&gt;C-c m sss www&lt;/kbd&gt; I got the following GIF:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-lispy-move-1.gif&quot; alt=&quot;hydra-lispy-move-1.gif&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;doing-the-same-lispy-way&quot;&gt;Doing the same lispy-way&lt;/h2&gt;

&lt;p&gt;To do it the lispy-way, I move the point before the list that I wish
to operate on (with
&lt;kbd&gt;[&lt;/kbd&gt; key), and press &lt;kbd&gt;sss www&lt;/kbd&gt; to get the following GIF:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-lispy-move-2.gif&quot; alt=&quot;hydra-lispy-move-2.gif&quot;&gt;&lt;/p&gt;

&lt;p&gt;The difference here is that no hydra is necessary in the second case,
the key bindings come only from &lt;code&gt;lispy-mode&lt;/code&gt;.  But the first case will
also work if &lt;code&gt;lispy-mode&lt;/code&gt; is off.&lt;/p&gt;

&lt;h2 id=&quot;which-way-is-better&quot;&gt;Which way is better?&lt;/h2&gt;

&lt;p&gt;I think the second way is better, since it&amp;#39;s faster and more clear,
but you can decide for yourself. By the way, you can also move
symbols, comments and sub-words (if that makes sense) with
&lt;kbd&gt;w&lt;/kbd&gt; and &lt;kbd&gt;s&lt;/kbd&gt;, provided you mark them with a region
first.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New feature in Ivy - ivy-occur</title>
   <link href="https://oremacs.com/2015/11/04/ivy-occur/"/>
   <updated>2015-11-04T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/11/04/ivy-occur</id>
   <content type="html">&lt;p&gt;I&amp;#39;ve had an idea with this feature for quite some time, and only
recently got to finally implement it.  So here it goes: with
&lt;code&gt;ivy-occur&lt;/code&gt;, bound to &lt;kbd&gt;C-c C-o&lt;/kbd&gt; while in the minibuffer, you
can store almost &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Ivy&lt;/a&gt; any
completion session in progress, and you can have as many of them as
you like.&lt;/p&gt;

&lt;h2 id=&quot;example-1&quot;&gt;Example 1&lt;/h2&gt;

&lt;p&gt;This is where the command name originates from: &lt;code&gt;swiper&lt;/code&gt; + &lt;code&gt;ivy-occur&lt;/code&gt;
= &lt;code&gt;occur&lt;/code&gt;. You can store all of swiper&amp;#39;s matching lines into a
separate buffer. This doesn&amp;#39;t give too much advantage over the
good-old &lt;code&gt;occur&lt;/code&gt;, the only thing is that you can use ivy-style regexps
with wild spaces, and have an interactive preview beforehand. Having
said that, it actually sounds pretty good!&lt;/p&gt;

&lt;h2 id=&quot;example-2&quot;&gt;Example 2&lt;/h2&gt;

&lt;p&gt;I press &lt;kbd&gt;C-S-o&lt;/kbd&gt;, bound to &lt;code&gt;counsel-rhythmbox&lt;/code&gt;, and enter
&lt;code&gt;u2&lt;/code&gt;.  After pressing &lt;kbd&gt;C-c C-o&lt;/kbd&gt;, bound to &lt;code&gt;ivy-occur&lt;/code&gt;, the
completion session is closed (effectively &lt;kbd&gt;C-g&lt;/kbd&gt;), and a new
buffer &lt;code&gt;*ivy-occur counsel-rhythmbox &amp;quot;u2&amp;quot;*&lt;/code&gt; is generated with all
songs that match &lt;code&gt;u2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;As a reminder, &lt;code&gt;counsel-rhythmbox&lt;/code&gt; has two actions: &lt;code&gt;play&lt;/code&gt; (the
default) and &lt;code&gt;enqueue&lt;/code&gt;. In this new buffer, pressing &lt;kbd&gt;RET&lt;/kbd&gt; or
&lt;code&gt;mouse-1&lt;/code&gt; will call the &lt;code&gt;play&lt;/code&gt; action (since it was active at the
moment &lt;code&gt;ivy-occur&lt;/code&gt; was called) for the current candidate. So I&amp;#39;ve
effectively added a playlist functionality to &lt;code&gt;counsel-rhythmbox&lt;/code&gt;
through a generic command.&lt;/p&gt;

&lt;p&gt;Note that it&amp;#39;s very easy to identify a completion session by the
command name and input.  So I can distinguish e.g. &lt;code&gt;*ivy-occur
counsel-rhythmbox &amp;quot;u2&amp;quot;*&lt;/code&gt; and &lt;code&gt;*ivy-occur counsel-rhythmbox &amp;quot;скря&amp;quot;*&lt;/code&gt;,
and quickly select them with &lt;code&gt;ivy-switch-buffer&lt;/code&gt;: just input &lt;code&gt;rhy&lt;/code&gt;,
usually only these two and similar buffers will match.&lt;/p&gt;

&lt;h2 id=&quot;example-3&quot;&gt;Example 3&lt;/h2&gt;

&lt;p&gt;Suppose I want to go through the documentation of all variables that
end in &lt;code&gt;-function&lt;/code&gt;.  Easy:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;kbd&gt;&amp;lt;f1&amp;gt; v&lt;/kbd&gt; (&lt;code&gt;counsel-describe-variable&lt;/code&gt;) with input
&lt;code&gt;function$&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-c C-o&lt;/kbd&gt; (&lt;code&gt;ivy-occur&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I get a new buffer named &lt;code&gt;*ivy-occur cousnel-describe-variable
&amp;quot;function$*&amp;quot;&lt;/code&gt; with 346 candidates. I can go through them at my own
pace, possibly doing other completion stuff in between without
disturbing my process. It&amp;#39;s also convenient to navigate these buffers
with &lt;code&gt;swiper&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;example-4&quot;&gt;Example 4&lt;/h2&gt;

&lt;p&gt;Let&amp;#39;s tweak the previous one. After inputting &lt;code&gt;function$&lt;/code&gt; I can press
&lt;kbd&gt;C-M-a&lt;/kbd&gt; (&lt;code&gt;ivy-read-action&lt;/code&gt;) followed by &lt;kbd&gt;d&lt;/kbd&gt; to
select the &lt;code&gt;definition&lt;/code&gt; action. Then again &lt;kbd&gt;C-c C-o&lt;/kbd&gt;
(&lt;code&gt;ivy-occur&lt;/code&gt;).  Pressing &lt;kbd&gt;RET&lt;/kbd&gt; in the resulting buffer will
take me to that variable&amp;#39;s definition, instead of describing it as
before. A similar thing could be done for &lt;code&gt;counsel-rhythmbox&lt;/code&gt; to get
the &lt;code&gt;enqueue&lt;/code&gt; action in &lt;code&gt;*ivy-occur*&lt;/code&gt; buffer, instead of &lt;code&gt;play&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;example-5&quot;&gt;Example 5&lt;/h2&gt;

&lt;p&gt;This is an improvement to my workflow for quickly looking at a new
package&amp;#39;s features.  This can be done with &lt;kbd&gt;oge&lt;/kbd&gt;
(&lt;code&gt;lispy-goto-elisp-commands&lt;/code&gt;) from
&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;, which scans the source for
&lt;code&gt;(interactive)&lt;/code&gt; tags and allows to jump to their definition.&lt;/p&gt;

&lt;p&gt;It&amp;#39;s a pretty cool optimization, compared to looking at all tags. For
example, &lt;a href=&quot;https://github.com/bbatsov/projectile&quot;&gt;projectile&lt;/a&gt; currently
has 375 top-level tags (functions and variables).  But with
&lt;code&gt;lispy-goto-elisp-commands&lt;/code&gt; I only get 48 tags. And now I can have
them in a convenient permanent list too.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-occur-1.png&quot; alt=&quot;ivy-occur-1.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Alternatively, if &lt;code&gt;projectile&lt;/code&gt; is already loaded, I can use
&lt;code&gt;counsel-M-x&lt;/code&gt; with input &lt;code&gt;projectile-&lt;/code&gt;, followed by &lt;kbd&gt;C-M-a d&lt;/kbd&gt;
to select the &lt;code&gt;definition&lt;/code&gt; action, followed by &lt;kbd&gt;C-c C-o&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;As a reminder of how it works, &lt;code&gt;counsel-M-x&lt;/code&gt; is defined with a single
action that calls the selected command. But then, I&amp;#39;ve also added this
statement at top-level of counsel.el:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-actions&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-M-x&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel--find-symbol&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;definition&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This means that you can add as many actions as you like to &lt;code&gt;ivy-read&lt;/code&gt;
commands. And of course customize the binding and the hint, which are
in this case &lt;kbd&gt;d&lt;/kbd&gt; and &lt;code&gt;definition&lt;/code&gt; respectively.&lt;/p&gt;

&lt;h2 id=&quot;limitations&quot;&gt;Limitations&lt;/h2&gt;

&lt;p&gt;Unfortunately, since the &lt;code&gt;*ivy-occur*&lt;/code&gt; buffer needs to know the action
to execute, it only works for commands that explicitly pass &lt;code&gt;:action&lt;/code&gt;
to &lt;code&gt;ivy-read&lt;/code&gt;. For instance, it won&amp;#39;t work for &lt;code&gt;package-install&lt;/code&gt; with
&lt;code&gt;ivy-mode&lt;/code&gt; on: the buffer will be properly generated, but pressing
&lt;kbd&gt;RET&lt;/kbd&gt; won&amp;#39;t install a package.&lt;/p&gt;

&lt;p&gt;Fortunately, it&amp;#39;s not hard to write a version that works:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-package-install&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Install package: &amp;quot;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delq&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;elt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package-installed-p&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;elt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;symbol-name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;elt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
                          &lt;span class=&quot;nv&quot;&gt;package-archive-contents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:action&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package-install&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;intern&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:caller&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-package-install&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s a buffer with a list of packages matching &amp;quot;ga&amp;quot;; pressing
&lt;kbd&gt;RET&lt;/kbd&gt; will install the selected package:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-occur-2.png&quot; alt=&quot;ivy-occur-2.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;small-note-on-key-bindings&quot;&gt;Small note on key bindings&lt;/h2&gt;

&lt;p&gt;In the initial post, I wanted to bind &lt;code&gt;ivy-occur&lt;/code&gt; to &lt;kbd&gt;C-c o&lt;/kbd&gt;
instead of &lt;kbd&gt;C-c C-o&lt;/kbd&gt;. But I was reminded that &lt;kbd&gt;C-c LETTER&lt;/kbd&gt; are
&lt;a href=&quot;http://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html&quot;&gt;reserved&lt;/a&gt;.
I still think it&amp;#39;s a better binding. If you agree, you can add it to your config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-minibuffer-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-occur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Additionally, &lt;code&gt;ivy-occur&lt;/code&gt; is also available on &lt;kbd&gt;C-o u&lt;/kbd&gt;,
through the &lt;kbd&gt;C-o&lt;/kbd&gt; hydra.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I think &lt;code&gt;ivy-occur&lt;/code&gt; is a very powerful command that shouldn&amp;#39;t be
overlooked.  Just as &lt;code&gt;ivy-resume&lt;/code&gt; implements a sort of &lt;kbd&gt;DEL&lt;/kbd&gt;
or &lt;kbd&gt;C-u&lt;/kbd&gt; key for completion, &lt;code&gt;ivy-occur&lt;/code&gt; implements a
convenient way to switch and store the completion context, a sort of
&lt;kbd&gt;C-x o&lt;/kbd&gt; or &lt;kbd&gt;C-x b&lt;/kbd&gt; for completion.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New in Emacs 25 - convenient compression/decompression in Dired</title>
   <link href="https://oremacs.com/2015/10/23/dired-compress/"/>
   <updated>2015-10-23T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/10/23/dired-compress</id>
   <content type="html">&lt;p&gt;Today I&amp;#39;ll describe my past and current workflows for compressing
files and directories in Dired.  In my opinion, Dired is one of the
best features of Emacs - a great abstraction of &lt;code&gt;cd&lt;/code&gt;+&lt;code&gt;ls&lt;/code&gt; that lets
you get things done much faster. The default binding for &lt;code&gt;dired&lt;/code&gt; is
&lt;kbd&gt;C-x d&lt;/kbd&gt; (I bind it to &lt;kbd&gt;C-;-d&lt;/kbd&gt; though, see my
&lt;a href=&quot;http://oremacs.com/2015/02/14/semi-xmodmap/&quot;&gt;xmodmap post&lt;/a&gt;).&lt;/p&gt;

&lt;h2 id=&quot;my-previous-workflow&quot;&gt;My previous workflow&lt;/h2&gt;

&lt;p&gt;To compress several files in Dired, first I compile a list of files to
work on by marking them with &lt;kbd&gt;m&lt;/kbd&gt; (&lt;code&gt;dired-mark&lt;/code&gt;), navigating
to ones that you want with &lt;kbd&gt;n&lt;/kbd&gt; (&lt;code&gt;dired-next-line&lt;/code&gt;) and
&lt;kbd&gt;p&lt;/kbd&gt; (&lt;code&gt;dired-previous-line&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Once a list is ready, I press &lt;kbd&gt;&amp;amp;&lt;/kbd&gt; (&lt;code&gt;dired-do-async-shell-command&lt;/code&gt;), which allows me to run an arbitrary shell command.
I enter:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;tar -czf ~/tmp/path/foo.tar.gz *
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;into the minibuffer, press &lt;kbd&gt;RET&lt;/kbd&gt; and I&amp;#39;m done. It&amp;#39;s a
standard shell command with 2 advantages:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I get &lt;kbd&gt;TAB&lt;/kbd&gt; completion for the directory of the created archive.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;*&lt;/code&gt; means the selected file list, so I don&amp;#39;t enter them by hand.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;my-current-workflow&quot;&gt;My current workflow&lt;/h2&gt;

&lt;p&gt;Since I often forget the command for &lt;code&gt;tar&lt;/code&gt;, and I really don&amp;#39;t want to
remember the commands for &lt;code&gt;zip&lt;/code&gt; etc, I&amp;#39;ve implemented a more convenient approach:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-do-compress-to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This new command &lt;code&gt;dired-do-compress-to&lt;/code&gt;, bound to &lt;kbd&gt;c&lt;/kbd&gt;, will
prompt me for a file name of the output archive. So now it&amp;#39;s easier to
type in that file name, if you use &lt;code&gt;ido-mode&lt;/code&gt; / &lt;code&gt;ivy-mode&lt;/code&gt; /
&lt;code&gt;helm-mode&lt;/code&gt;. What&amp;#39;s more, the command will be automatically determined
from the archive extension and executed. Here&amp;#39;s the corresponding
customization variable:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-compress-files-alist&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.tar\\.gz\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;tar -c %i | gzip -c9 &amp;gt; %o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.zip\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;zip %o -r --filesync %i&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Control the compression shell command for &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`dired-do-compress-to&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;Each element is (REGEXP . CMD), where REGEXP is the name of the&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;archive to which you want to compress, and CMD the the&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;corresponding command.&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;Within CMD, %i denotes the input file(s), and %o denotes the&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;output file. %i path(s) are relative, while %o is absolute.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This thing is pretty self-explanatory. It currently only supports
&lt;code&gt;*.tar.gz&lt;/code&gt; and &lt;code&gt;*.zip&lt;/code&gt;, use &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;report-emacs-bug&lt;/code&gt; if you
want to add more options.&lt;/p&gt;

&lt;h2 id=&quot;other-improvements-in-compression-decompression&quot;&gt;Other improvements in compression/decompression&lt;/h2&gt;

&lt;p&gt;I improved the good-old &lt;kbd&gt;Z&lt;/kbd&gt; (&lt;code&gt;dired-do-compress&lt;/code&gt;) as
well. Now it can compress directories to &lt;code&gt;*.tar.gz&lt;/code&gt;, as well as
decompress &lt;code&gt;*.tar.gz&lt;/code&gt; and &lt;code&gt;*.zip&lt;/code&gt; to directories.  It&amp;#39;s all automatic,
you only have to press &lt;kbd&gt;Z&lt;/kbd&gt;, either on an archive to
decompress, or on a directory to compress.&lt;/p&gt;

&lt;h2 id=&quot;easy-way-to-have-a-bleeding-edge-emacs&quot;&gt;Easy way to have a bleeding edge Emacs&lt;/h2&gt;

&lt;p&gt;If you want to get these improvements right now and are on a Debian
type system (I use Ubuntu), you can use:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;sudo apt-add-repository ppa:ubuntu-elisp/ppa
sudo apt-get update
sudo apt-get install emacs-snapshot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then just use &lt;code&gt;emacs-snapshot&lt;/code&gt; executable. It updates every few days.&lt;/p&gt;

&lt;p&gt;Myself, I track the Emacs master from
&lt;a href=&quot;http://savannah.gnu.org/projects/emacs&quot;&gt;git&lt;/a&gt;. But &lt;code&gt;emacs-snapshot&lt;/code&gt; is
very useful for CI tests, and can also be used by people who don&amp;#39;t
want to build the executable from git.&lt;/p&gt;

&lt;h2 id=&quot;how-to-get-your-improvements-into-emacs&quot;&gt;How to get your improvements into Emacs&lt;/h2&gt;

&lt;p&gt;If you&amp;#39;d like to contribute code to the Emacs core yourself, it takes
two steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Sign the Copyright Assignment
(&lt;a href=&quot;http://orgmode.org/w/org-mode.git?p=org-mode.git;a=blob_plain;f=request-assign-future.txt;hb=HEAD&quot;&gt;CA&lt;/a&gt;).
This gives the Copyright for your changes to Emacs to the Free
Software Foundation. This is useful so that the FSF can defend your
rights in court, in case the GPL regarding your contribution is broken
by someone.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;report-emacs-bug&lt;/code&gt; and attach a patch.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It seems that some people could have a moral objection to the CA. I
see no reason for it whatsoever.  Since Elisp libraries make calls to
GPL code and are GPL themselves, you have to publish Elisp code under
GPL, there&amp;#39;s no choice there.  GPL means basically that, while you&amp;#39;re
still acknowledged as the author, everyone else has about as much
right to your code as you do. No one can hide or restrict access to
it, but neither can you. The CA is a further step, which makes the FSF
own the Copyright to your &lt;em&gt;changes&lt;/em&gt; to Emacs. You submit these changes
yourself, and the Copyright over these changes isn&amp;#39;t really that
useful: they&amp;#39;re only changes - they do nothing on their own, outside
of Emacs. Besides, with the FSF owning the Copyright, the range of
things that you can do to your code stays exactly the same as if you
owned the Copyright, as long as you publish under GPL.&lt;/p&gt;

&lt;p&gt;To illustrate, the FSF CA is very polite and benign, compared to the
CA that I have to give to Elsevier when I publish an article.  That CA
means that a multi-billion dollar corporation owns the right to my
paper until the end of time, and can charge people to view it
(including myself and my peers) as much as they see fit (currently,
$30). Of course, I don&amp;#39;t receive a dime of that money, but hey - I get
published, and at least I can share my article &lt;em&gt;for free&lt;/em&gt; for the
first 50 days of the publish date. And if that one doesn&amp;#39;t seem
draconian enough for you, just think of the NDAs in commercial
companies: out there, you can&amp;#39;t even publish or mention anything
related to your work. So please, if you&amp;#39;re hating on the FSF, do
reconsider, they&amp;#39;re the good guys in my book.&lt;/p&gt;

&lt;p&gt;Eventually, after a few submitted patches, you&amp;#39;ll be granted commit
access. This is a great way to implement small improvements faster.
However, the larger issues that aren&amp;#39;t simple improvements still need
to be discussed with other developers, either on debbugs or on
emacs-devel. For example, initially I went with the &lt;code&gt;tar -czf&lt;/code&gt;
command. But it turns out that it can&amp;#39;t be used on Solaris 10 or AIX
7.1. Whatever those things are, people still use Emacs on them, and
it&amp;#39;s important that the core features are usable on all supported
systems.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>A simple multiple-cursors extension to swiper</title>
   <link href="https://oremacs.com/2015/10/14/swiper-mc/"/>
   <updated>2015-10-14T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/10/14/swiper-mc</id>
   <content type="html">&lt;p&gt;When using Emacs, it happens sometimes that I accumulate too many
buffers. The usual next action is to close the buffers for the project
that I&amp;#39;m not currently working on. Previously, I marked those buffers
in &lt;code&gt;*Buffer List*&lt;/code&gt; by hand with &lt;kbd&gt;d&lt;/kbd&gt; and
&lt;kbd&gt;C-n&lt;/kbd&gt;. Today, I&amp;#39;ll show a faster way.&lt;/p&gt;

&lt;p&gt;It&amp;#39;s very easy to select these buffers in &lt;code&gt;*Buffer List*&lt;/code&gt; with
&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt;: just type a part the
shared directory name. Another example is to select all &lt;code&gt;dired&lt;/code&gt;
buffers: a &amp;quot;dired by&amp;quot; input will usually match all of them, since they
all have &lt;code&gt;Dired by name&lt;/code&gt; in their line.&lt;/p&gt;

&lt;p&gt;Afterwards, I want to open
&lt;a href=&quot;https://github.com/magnars/multiple-cursors.el&quot;&gt;multiple-cursors&lt;/a&gt; for
each matched line. I&amp;#39;ve bound this action to &lt;kbd&gt;C-7&lt;/kbd&gt;. Here&amp;#39;s
the very simple code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;swiper-mc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;multiple-cursors&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;multiple-cursors isn&amp;#39;t installed&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cands&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nreverse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--old-cands&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-text&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-action&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cand&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pop&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cands&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;swiper--action&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cands&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mc/create-fake-cursor-at-point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mc/maybe-multiple-cursors-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-exit&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;done&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;exit-minibuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After &lt;kbd&gt;C-7&lt;/kbd&gt;, here&amp;#39;s the sequence to delete the selected buffers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;d&lt;/kbd&gt; (&lt;code&gt;Buffer-menu-delete&lt;/code&gt;) to mark each item for deletion.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-g&lt;/kbd&gt; (&lt;code&gt;keyboard-quit&lt;/code&gt;) to exit &lt;code&gt;multiple-cursors&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;x&lt;/kbd&gt; (&lt;code&gt;Buffer-menu-execute&lt;/code&gt;) to execute the deletions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that&amp;#39;s it: all selected buffers are now deleted.  To summarize,
&lt;kbd&gt;C-s&lt;/kbd&gt; &lt;code&gt;dired by&lt;/code&gt; &lt;kbd&gt;C-7 d C-g x&lt;/kbd&gt; will close all
&lt;code&gt;dired&lt;/code&gt; buffers from your &lt;code&gt;*Buffer List*&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Other interesting applications are also possible, like mass renames in
&lt;code&gt;wdired&lt;/code&gt;, or un-commenting everything in a function.  For example,
suppose that you have this code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; (check-1)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; (check-2)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; (check-3)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;baz&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If it&amp;#39;s a part of a larger buffer, you can narrow with &lt;kbd&gt;C-x nd&lt;/kbd&gt; (&lt;code&gt;narrow-to-defun&lt;/code&gt;)
or &lt;kbd&gt;C-x nn&lt;/kbd&gt; (&lt;code&gt;narrow-to-region&lt;/code&gt;).  Then &lt;kbd&gt;C-s ;; C-7 DEL DEL C-d C-g&lt;/kbd&gt; to
remove all comments.&lt;/p&gt;

&lt;p&gt;I have to say that the functionality intersects a bit with
&lt;code&gt;mc/mark-all-like-this&lt;/code&gt;. Except you know the result ahead of time
(number and position of matches), and you can use a regex instead of a
literal string.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Swiper and visual-line-mode</title>
   <link href="https://oremacs.com/2015/10/02/swiper-visual-line/"/>
   <updated>2015-10-02T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/10/02/swiper-visual-line</id>
   <content type="html">&lt;p&gt;In case you encounter files with very long lines, the built-in
&lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;visual-line-mode&lt;/code&gt; might come in handy.  Although 1MB
long one-line files are a disaster for Emacs, there&amp;#39;s no problem
handling smaller files with long lines that result from bad markdown
renderers (notably Github).  They way &lt;code&gt;visual-line-mode&lt;/code&gt; works, is it
inserts virtual newlines in appropriate positions, so that no line is
truncated.  The advantage is that these newlines aren&amp;#39;t written to the
file when the buffer is saved (otherwise, a simple &lt;kbd&gt;M-q&lt;/kbd&gt;
(&lt;code&gt;fill-paragraph&lt;/code&gt;) would work too).&lt;/p&gt;

&lt;p&gt;Today I&amp;#39;ve added &lt;code&gt;visual-line-mode&lt;/code&gt; support to
&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt;, so handling these files
should be even easier now. The change was surprisingly simple: just
two checks for &lt;code&gt;visual-line-mode&lt;/code&gt; variable and these basic
replacements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;forward-line&lt;/code&gt; -&amp;gt; &lt;code&gt;line-move&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;&lt;code&gt;line-beginning-position&lt;/code&gt; -&amp;gt; &lt;code&gt;beginning-of-visual-line&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;&lt;code&gt;line-end-position&lt;/code&gt; -&amp;gt; &lt;code&gt;end-of-visual-line&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By the way, &lt;code&gt;visual-line-mode&lt;/code&gt; is one of the small number of commands
that I call by name instead of by key chord. But thanks to
&lt;code&gt;counsel-M-x&lt;/code&gt; and &lt;code&gt;smex&lt;/code&gt; calling this command by name is as short as
&lt;kbd&gt;C-t v RET&lt;/kbd&gt;.  To explain a bit more, here&amp;#39;s my setup:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;; make sure to install smex&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-t&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-M-x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The default command bound to &lt;kbd&gt;C-t&lt;/kbd&gt; is &lt;code&gt;transpose-chars&lt;/code&gt; - a
highly situational and ultimately counter-productive command
(&lt;kbd&gt;M-DEL&lt;/kbd&gt; and re-typing the word is faster than surgically
navigating to the transpose point and calling &lt;code&gt;transpose-chars&lt;/code&gt;, plus
it trains the hands to type the word correctly next time).  Anyway,
&lt;kbd&gt;C-t&lt;/kbd&gt; is a prime binding for launching interactive commands.
And since &lt;code&gt;smex&lt;/code&gt; is installed it remembers that my most used command
that starts with &amp;quot;v&amp;quot; is &lt;code&gt;visual-line-mode&lt;/code&gt; - so it&amp;#39;s the first one
that gets selected after &lt;kbd&gt;C-t v&lt;/kbd&gt;. This means that I can just
press &lt;kbd&gt;RET&lt;/kbd&gt; and be done with it.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/swiper-visual-line-mode.png&quot; alt=&quot;swiper-visual-line-mode.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Finally, related to &lt;code&gt;visual-line-mode&lt;/code&gt;, here&amp;#39;s a command I use to
negate &lt;kbd&gt;M-q&lt;/kbd&gt; (&lt;code&gt;fill-paragraph&lt;/code&gt;) (&lt;a href=&quot;http://www.emacswiki.org/emacs/UnfillParagraph&quot;&gt;source&lt;/a&gt;):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-q&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ora-unfill-paragraph&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-unfill-paragraph&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Transform a paragraph into a single line.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fill-column&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fill-paragraph&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Thanks to &lt;a href=&quot;https://github.com/joostkremers&quot;&gt;@joostkremers&lt;/a&gt; for the
suggestion in &lt;a href=&quot;https://github.com/abo-abo/swiper/issues/227&quot;&gt;#227&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>More tweaks to Ivy minibuffer faces</title>
   <link href="https://oremacs.com/2015/09/29/tweak-ivy-faces/"/>
   <updated>2015-09-29T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/09/29/tweak-ivy-faces</id>
   <content type="html">&lt;p&gt;This is a continuation of the thought that I started in the
&lt;a href=&quot;http://oremacs.com/2015/09/04/ivy-fancy-minibuffer/&quot;&gt;last post&lt;/a&gt; a few
weeks ago.  I don&amp;#39;t fancy myself a graphical designer, but I kind of
have a feeling of what I like - I certainly know it when I see it.&lt;/p&gt;

&lt;p&gt;I wasn&amp;#39;t quite happy with the color of the current selection in the
minibuffer.  Then it hit me that I like the way the Firefox address
bar does it: invert the selected text foreground to white and add a
flashy background. After that, it was only a matter of going though a
few random color permutations in the GIMP color selector to arrive to
a nice state:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-M-x.png&quot; alt=&quot;counsel-M-x.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;I did add something similar for dark background themes, although I
rarely use them myself, since they contrast too much with Firefox,
with most websites having a light background:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defface&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-current-match&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;background&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;light&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
     &lt;span class=&quot;nb&quot;&gt;:background&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#1a4b77&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:foreground&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;white&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;background&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
     &lt;span class=&quot;nb&quot;&gt;:background&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#65a7e2&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:foreground&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;black&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Face used by Ivy for highlighting first match.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Of course, the standard recommendation follows to use
&lt;a href=&quot;https://elpa.gnu.org/packages/rainbow-mode.html&quot;&gt;rainbow-mode&lt;/a&gt; in
buffers that deal with colors - it&amp;#39;s great.&lt;/p&gt;

&lt;p&gt;Finally, &lt;code&gt;counsel-git-grep&lt;/code&gt; and &lt;code&gt;counsel-ag&lt;/code&gt; now also add the proper
minibuffer coloring if you have it turned on:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-display-style&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;fancy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;/download/counsel-ag.png&quot; alt=&quot;counsel-ag&quot;&gt;&lt;/p&gt;

&lt;p&gt;If you&amp;#39;re interested in how the face backgrounds are combined, you can
read my older article on
&lt;a href=&quot;http://oremacs.com/2015/04/28/blending-faces/&quot;&gt;color blending in Elisp&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Fancy minibuffer faces for Ivy completion</title>
   <link href="https://oremacs.com/2015/09/04/ivy-fancy-minibuffer/"/>
   <updated>2015-09-04T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/09/04/ivy-fancy-minibuffer</id>
   <content type="html">&lt;p&gt;Today, I&amp;#39;ll describe a recent improvement to the display of Ivy completion.
To use it, add this code to your configuration:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-display-style&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;fancy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After this, &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt; will look like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-display-style-1.png&quot; alt=&quot;ivy-display-style-1.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;And &lt;code&gt;counsel-M-x&lt;/code&gt; will look like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-display-style-2.png&quot; alt=&quot;ivy-display-style-2.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;If you haven&amp;#39;t used it before, &lt;code&gt;counsel-M-x&lt;/code&gt; is part the counsel
package on MELPA, or part of swiper package if you&amp;#39;re installing from
GNU ELPA. Basically, it&amp;#39;s a &lt;kbd&gt;M-x&lt;/kbd&gt; replacement (that I like to
bind to &lt;kbd&gt;C-t&lt;/kbd&gt; for efficiency reasons), that doubles as
&lt;code&gt;find-function&lt;/code&gt; (just press &lt;kbd&gt;C-.&lt;/kbd&gt; instead of &lt;kbd&gt;RET&lt;/kbd&gt;
to find the function instead of calling it). If you&amp;#39;re using
&lt;code&gt;counsel-M-x&lt;/code&gt; I highly recommend to also install &lt;code&gt;smex&lt;/code&gt;, since then
&lt;code&gt;counsel-M-x&lt;/code&gt; will use &lt;code&gt;smex&lt;/code&gt; for sorting the matched commands.&lt;/p&gt;

&lt;p&gt;The update will propertize the minibuffer contents with a new set of faces:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;swiper-minibuffer-faces&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;swiper-minibuffer-match-face-1&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;swiper-minibuffer-match-face-2&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;swiper-minibuffer-match-face-3&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;swiper-minibuffer-match-face-4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;List of &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`swiper&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; faces for minibuffer group matches.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Initially, when responding to
&lt;a href=&quot;https://github.com/abo-abo/swiper/issues/212&quot;&gt;#212&lt;/a&gt;, I used the
original swiper faces in the minibuffer as well. But after some use,
their brightness became a bit annoying.  So I introduced a new set of
faces that can be customized separately.&lt;/p&gt;

&lt;p&gt;Here are the settings that I&amp;#39;m currently using:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;custom-set-faces&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;swiper-minibuffer-match-face-1&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:background&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#dddddd&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;swiper-minibuffer-match-face-2&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:background&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#bbbbbb&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:weight&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bold&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;swiper-minibuffer-match-face-3&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:background&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#bbbbff&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:weight&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bold&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;swiper-minibuffer-match-face-4&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:background&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#ffbbff&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:weight&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bold&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It&amp;#39;s similar to what the Firefox address bar uses: gray background and
bold font. Additionally, the matching parts are highlighted with pale
gray, blue and magenta colors. If you like the color scheme, it&amp;#39;s part
of &lt;a href=&quot;https://github.com/abo-abo/eclipse-theme&quot;&gt;eclipse-theme&lt;/a&gt;.  Another
choice, for even less distraction, could be to remove the background
from these faces, only leaving the bold part on the matches.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://github.com/Wilfred&quot;&gt;@Wilfred&lt;/a&gt; for nudging me to
finally implement this feature.  It&amp;#39;s been on my list for a long time,
but I&amp;#39;ve been putting it off.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Complete Python symbols using Ivy</title>
   <link href="https://oremacs.com/2015/08/26/counsel-jedi/"/>
   <updated>2015-08-26T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/08/26/counsel-jedi</id>
   <content type="html">&lt;p&gt;I had a fascination with Python at one point, until I got too annoyed
with the indentation rules.  I still have a few scripts left over, so
I&amp;#39;m sympathetic to Python support in Emacs.  The reason for
today&amp;#39;s post comes from
&lt;a href=&quot;http://emacs.stackexchange.com/questions/15032/insert-parens-while-completing-functions-in-company-mode&quot;&gt;this question&lt;/a&gt;
on Emacs StackExchange. Essentially, the user wants to insert parens
automatically when a function name is completed.&lt;/p&gt;

&lt;p&gt;The completion candidates come from
&lt;a href=&quot;https://github.com/tkf/emacs-jedi&quot;&gt;jedi&lt;/a&gt; plugin.  To quickly see
where the list of strings is coming from, I&amp;#39;ve examined &lt;code&gt;ac-sources&lt;/code&gt;
variable and saw that it contains &lt;code&gt;ac-source-jedi-direct&lt;/code&gt;, which evaluates to:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;jedi:ac-direct-matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;jedi:ac-direct-prefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;init&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;jedi:complete-request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;requires&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This means that &lt;code&gt;jedi:complete-request&lt;/code&gt; has to be called at point,
followed by &lt;code&gt;jedi:ac-direct-matches&lt;/code&gt; to obtain the list of strings. So
basically, this code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;deferred:sync!&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;jedi:complete-request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;jedi:ac-direct-matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note the call to &lt;code&gt;deferred:sync!&lt;/code&gt;. I had to add that one to make sure
that &lt;code&gt;jedi:complete-request&lt;/code&gt; completes before &lt;code&gt;jedi:ac-direct-matches&lt;/code&gt;
is called.&lt;/p&gt;

&lt;p&gt;Testing with some Python code, where &lt;code&gt;|&lt;/code&gt; is the point:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The Elisp code above will return:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;#(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;items&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;summary&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;function: __builtin__.dict.items&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;document&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;items(self)&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;D.items() -&amp;gt; list of D&amp;#39;s (key, value) pairs, as 2-tuples&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;#(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;iteritems&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;summary&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;function: __builtin__.dict.iteritems&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;document&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;iteritems(self)&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;D.iteritems() -&amp;gt; an iterator over the (key, value) items of D&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;#(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;iterkeys&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;summary&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;function: __builtin__.dict.iterkeys&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;document&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;iterkeys(self)&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;D.iterkeys() -&amp;gt; an iterator over the keys of D&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;#(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;itervalues&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;summary&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;&amp;quot;function: __builtin__.dict.itervalues&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;nv&quot;&gt;document&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;&amp;quot;itervalues(self)&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;D.itervalues() -&amp;gt; an iterator over the values of D&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So these strings come with the symbol documentation and symbol type
encoded as string properties. After this, the rest of the Elisp code
follows very easily, you can find it as part of
&lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/counsel.el&quot;&gt;counsel&lt;/a&gt;
package on MELPA:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-jedi&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Python completion at point.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bounds-of-thing-at-point&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-completion-beg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-completion-end&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-completion-beg&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-completion-end&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;deferred:sync!&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;jedi:complete-request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Symbol name: &amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;jedi:ac-direct-matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:action&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;counsel--py-action&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel--py-action&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Insert SYMBOL, erasing the previous one.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringp&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with-ivy-window&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-completion-beg&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete-region&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;counsel-completion-beg&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;counsel-completion-end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-completion-beg&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;move-marker&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make-marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-completion-end&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;move-marker&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make-marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-text-property&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;symbol&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;()&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-completion-end&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;move-marker&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make-marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Essentially, the last interesting part is &lt;code&gt;(equal (get-text-property 0
&amp;#39;symbol symbol) &amp;quot;f&amp;quot;)&lt;/code&gt; which test if the string corresponds to a
function or not. The rest of the code just fiddles with symbol markers
with ensure that the previous symbol is erased before the new symbol
is inserted if you press &lt;kbd&gt;C-M-n&lt;/kbd&gt; (&lt;code&gt;ivy-next-line-and-call&lt;/code&gt;),
or use &lt;code&gt;ivy-resume&lt;/code&gt;. Just to describe how this would be useful for the
Python code above: I call &lt;code&gt;counsel-jedi&lt;/code&gt;, followed by &lt;kbd&gt;C-M-n&lt;/kbd&gt;
to get:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iteritems&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pressing &lt;kbd&gt;C-M-n&lt;/kbd&gt; again will result in:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iterkeys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once I&amp;#39;m satisfied with my selected candidate, I can press either
&lt;kbd&gt;C-m&lt;/kbd&gt; or &lt;kbd&gt;C-j&lt;/kbd&gt; or &lt;kbd&gt;C-g&lt;/kbd&gt;.  Most of the above
code can be used almost verbatim if you&amp;#39;re a Helm fan and want to
implement &lt;code&gt;helm-jedi&lt;/code&gt;. Basically, the approach I described (going
through &lt;code&gt;ac-sources&lt;/code&gt;) can be used to implement alternative completion
in a lot of cases where &lt;code&gt;auto-complete-mode&lt;/code&gt; completion is already
available.&lt;/p&gt;

&lt;p&gt;Finally, if you like the idea of auto-inserting parens with completion
and are using C/C++, have a look at
&lt;a href=&quot;https://github.com/abo-abo/function-args&quot;&gt;function-args&lt;/a&gt; - this
package does that too, with Ivy, Ido and Helm as available back ends.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Store all current ivy candidates into the kill ring</title>
   <link href="https://oremacs.com/2015/08/14/ivy-kill-ring-save/"/>
   <updated>2015-08-14T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/08/14/ivy-kill-ring-save</id>
   <content type="html">&lt;p&gt;I&amp;#39;d like to highlight a new command added to
&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;ivy-mode&lt;/a&gt; today:
&lt;code&gt;ivy-kill-ring-save&lt;/code&gt;.  It allows to store all current candidates to
the kill ring. This could have a number of uses.&lt;/p&gt;

&lt;h2 id=&quot;scenario-1&quot;&gt;Scenario 1&lt;/h2&gt;

&lt;p&gt;Suppose you want to learn some Elisp, specifically all functions that
start with &lt;code&gt;forward-&lt;/code&gt;. Then call &lt;code&gt;counsel-describe-function&lt;/code&gt; with
&amp;quot;forward-&amp;quot; as input and press &lt;kbd&gt;M-w&lt;/kbd&gt;. Then just yank this into
some buffer, &lt;code&gt;org-mode&lt;/code&gt; for instance, and go through the functions
one-by-one takings notes on the way:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;forward-comment
forward-paragraph
forward-thing
forward-symbol
forward-visible-line
forward-word
forward-same-syntax
forward-whitespace
forward-button
forward-line
forward-list
forward-sentence
forward-point
forward-to-indentation
forward-ifdef
forward-char
forward-sexp
forward-page
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;scenario-2&quot;&gt;Scenario 2&lt;/h2&gt;

&lt;p&gt;Suppose you want to store a subset of &lt;code&gt;projectile-find-file&lt;/code&gt; names
that match a pattern.  Just press &lt;kbd&gt;M-w&lt;/kbd&gt; and those file names
will be on the top of the kill ring. Of course, you need to have this setting on:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-completion-system&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This scenario should apply to basically any place where you&amp;#39;re
completing file names, like &lt;code&gt;counsel-locate&lt;/code&gt; or
&lt;code&gt;counsel-find-file&lt;/code&gt;. Also
&lt;a href=&quot;https://github.com/technomancy/find-file-in-project&quot;&gt;find-file-in-project&lt;/a&gt;,
which uses &lt;code&gt;ivy&lt;/code&gt; for completion if it&amp;#39;s installed.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Note also that the command comes for free, since normally nothing is
done by &lt;kbd&gt;M-w&lt;/kbd&gt; when the region isn&amp;#39;t active. When the region
is active, this command will store the selected text instead of
matched candidates.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://github.com/drorbemet&quot;&gt;@drorbemet&lt;/a&gt; for giving me the
idea in &lt;a href=&quot;https://github.com/abo-abo/swiper/issues/197&quot;&gt;#197&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy-mode 0.6.0 is out</title>
   <link href="https://oremacs.com/2015/08/05/swiper-0.6.0/"/>
   <updated>2015-08-05T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/08/05/swiper-0.6.0</id>
   <content type="html">&lt;p&gt;For those who don&amp;#39;t keep up,
&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;ivy-mode&lt;/a&gt; is a completion method
that&amp;#39;s similar to &lt;code&gt;ido&lt;/code&gt;, but with emphasis on simplicity and
customizability.  Currently, there are two related packages on MELPA:
&lt;code&gt;swiper&lt;/code&gt; and &lt;code&gt;counsel&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;swiper&lt;/code&gt; provides an &lt;code&gt;isearch&lt;/code&gt; replacement, using &lt;code&gt;ivy-read&lt;/code&gt; for completion, as well as the basic &lt;code&gt;ivy-mode&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel&lt;/code&gt; provides some extra commands, like &lt;code&gt;-M-x&lt;/code&gt;, &lt;code&gt;-ag&lt;/code&gt;, &lt;code&gt;-load-theme&lt;/code&gt; etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The reasoning behind the split into two packages is that there&amp;#39;s less
update overhead if only one of them is updated.&lt;/p&gt;

&lt;h2 id=&quot;completing-read-function-conundrum&quot;&gt;&lt;code&gt;completing-read-function&lt;/code&gt; conundrum&lt;/h2&gt;

&lt;p&gt;This is to explain a bit the presence of the &lt;code&gt;counsel&lt;/code&gt;
package. Initially, I hoped that &lt;code&gt;ivy-mode&lt;/code&gt; could do most of the work,
via the Emacs&amp;#39; &lt;code&gt;completing-read-function&lt;/code&gt; interface. How it works:
most built-in packages will call &lt;code&gt;completing-read&lt;/code&gt; when they require
completion.  That function will forward the completion to
&lt;code&gt;completing-read-function&lt;/code&gt; if it&amp;#39;s set. This is the way how things
like &lt;code&gt;icomplete-mode&lt;/code&gt; or &lt;code&gt;ivy-mode&lt;/code&gt; or &lt;code&gt;helm-mode&lt;/code&gt; work.&lt;/p&gt;

&lt;p&gt;Unfortunately, the interface rather limits what you can do in
&lt;code&gt;completing-read-function&lt;/code&gt;. Essentially, you&amp;#39;re given a list of
strings and you have to return a string. You have no idea which
function called you, so you can&amp;#39;t do any fancy stuff depending on the
caller, short of examining &lt;code&gt;this-command&lt;/code&gt; which isn&amp;#39;t very reliable.
You have no idea what will be done with the one string that you
return, so you can&amp;#39;t do something fancy like select two or three
strings and perform that action for each of them.&lt;/p&gt;

&lt;p&gt;The result is that sometimes I have to replace the built-in functions,
instead of re-using them. So instead of re-using &lt;code&gt;find-file&lt;/code&gt;, I wrote
my own &lt;code&gt;counsel-find-file&lt;/code&gt; that looks like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-find-file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Forward to &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`find-file&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Find file: &amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;read-file-name-internal&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:matcher&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;counsel--find-file-matcher&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:action&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with-ivy-window&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;expand-file-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:preselect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-find-file-at-point&lt;/span&gt;
                         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ffap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ffap-guesser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:require-match&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;confirm-after-completion&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:history&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;file-name-history&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:keymap&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-find-file-map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It&amp;#39;s still possible to call the original &lt;code&gt;find-file&lt;/code&gt;, and you&amp;#39;ll get
&lt;code&gt;ivy-read&lt;/code&gt; completion for it, but:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ivy-resume&lt;/code&gt; won&amp;#39;t work, since &lt;code&gt;ivy-read&lt;/code&gt; doesn&amp;#39;t know what to do with the string that you select.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-M-n&lt;/kbd&gt; (&lt;code&gt;ivy-next-line-and-call&lt;/code&gt;) won&amp;#39;t work to select another file within the same completion session, for the same reason.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-o&lt;/kbd&gt; (&lt;code&gt;ivy-dispatching-done&lt;/code&gt;) may work with some
customization, but since it dispatches on &lt;code&gt;this-command&lt;/code&gt; to get the
extra actions, it can cause a problem if the command wasn&amp;#39;t called
directly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think it would be cool to extend the built-in
&lt;code&gt;completing-read-function&lt;/code&gt; interface in the future Emacs
versions. Both Ivy and Helm (which uses the same strategy of passing
the action to the completion) would benefit from this.&lt;/p&gt;

&lt;h2 id=&quot;release-summary-and-highlights&quot;&gt;Release summary and highlights&lt;/h2&gt;

&lt;p&gt;It&amp;#39;s been two months and 150 commits since the last version. The full
release notes can be found inside the repository in
&lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/doc/Changelog.org&quot;&gt;Changelog.org&lt;/a&gt;
or at Github&amp;#39;s
&lt;a href=&quot;https://github.com/abo-abo/swiper/releases/tag/0.6.0&quot;&gt;release&lt;/a&gt; tab.&lt;/p&gt;

&lt;p&gt;I recommend to look through the whole list to see if anything catches your attention.
I&amp;#39;ll highlight a few things that I think the users might be interested in most.&lt;/p&gt;

&lt;h3 id=&quot;fuzzy-completion&quot;&gt;Fuzzy completion&lt;/h3&gt;

&lt;p&gt;This is off by default, since I think having less candidates is better than having more.
You can customize this for all commands or per-command. For example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-re-builders-alist&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--regex-fuzzy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;swiper-has-a-case-fold-search-optimization&quot;&gt;&lt;code&gt;swiper&lt;/code&gt; has a &lt;code&gt;case-fold-search&lt;/code&gt; optimization&lt;/h3&gt;

&lt;p&gt;Binds case-fold-search to t when the input is all lower-case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;input &amp;quot;the&amp;quot; matches both &amp;quot;the&amp;quot; and &amp;quot;The&amp;quot;.&lt;/li&gt;
&lt;li&gt;input &amp;quot;The&amp;quot; matches only &amp;quot;The&amp;quot;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;anzu-things&quot;&gt;Anzu things&lt;/h3&gt;

&lt;p&gt;To see not only the number of matched candidates, but also the index of the current one, set this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-count-format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;(%d/%d) &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;customize-additional-exit-points-for-any-command&quot;&gt;Customize additional exit points for any command&lt;/h3&gt;

&lt;p&gt;For any command that uses &lt;code&gt;ivy-read&lt;/code&gt; that is. Example for &lt;code&gt;ivy-switch-to-buffer&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-actions&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-switch-buffer&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;kill-buffer&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy--reset-state&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-last&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;kill&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;ivy--switch-buffer-other-window-action&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;other&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;kbd&gt;M-o k&lt;/kbd&gt; to kill a buffer.&lt;/li&gt;
&lt;li&gt;Use &lt;kbd&gt;M-o j&lt;/kbd&gt; to switch to a buffer in other window.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can always use &lt;kbd&gt;M-o o&lt;/kbd&gt; to access the default action. When there is
only one action, &lt;kbd&gt;M-o&lt;/kbd&gt; does the same as &lt;kbd&gt;C-m&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;more-descriptions-with-a-built-in-hydra&quot;&gt;More descriptions with a built-in Hydra&lt;/h3&gt;

&lt;p&gt;Toggle &lt;kbd&gt;C-o&lt;/kbd&gt; in any completion session to get an overview of
the things that you can do.&lt;/p&gt;

&lt;h3 id=&quot;many-commands-that-interface-with-shell-calls&quot;&gt;Many commands that interface with shell calls&lt;/h3&gt;

&lt;p&gt;The following commands will call the appropriate shell tool to give you a list of candidates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-git-grep&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-ag&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-locate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-recoll&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These commands will refresh after each new letter entered, and they
account for the fact that the shell call will usually take more time
than the time it takes to input a new letter. So the process will be
killed and restarted, resulting in virtually no keyboard delay and no
downtime.&lt;/p&gt;

&lt;h3 id=&quot;many-commands-that-offer-more-options-than-the-built-in-counterparts&quot;&gt;Many commands that offer more options than the built-in counterparts&lt;/h3&gt;

&lt;p&gt;This list includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-find-file&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-M-x&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-load-theme&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-org-tag&lt;/code&gt; and &lt;code&gt;counsel-org-tag-agenda&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most extra things that you can do are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Doing stuff with multiple candidates through &lt;kbd&gt;C-M-n&lt;/kbd&gt; like in &lt;a href=&quot;https://www.youtube.com/watch?v=V_whk214fec&quot;&gt;this video&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;ivy-resume&lt;/code&gt; to resume the last completion session.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Make sure to try &lt;code&gt;counsel-org-tag&lt;/code&gt;, this one is a bit tricky for
completion, since it requires to return multiple candidates at once.
So you can toggle each tag with &lt;kbd&gt;C-M-m&lt;/kbd&gt; (&lt;code&gt;ivy-call&lt;/code&gt;) and then
exit with &lt;kbd&gt;C-m&lt;/kbd&gt; (&lt;code&gt;ivy-done&lt;/code&gt;). The currently selected tags
will be displayed in the prompt.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;A big thanks to all people who contributed code and issues towards
this release.  I&amp;#39;m really happy that you&amp;#39;re helping me to refine this
nice package.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Using Recoll desktop search database with Emacs</title>
   <link href="https://oremacs.com/2015/07/27/counsel-recoll/"/>
   <updated>2015-07-27T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/07/27/counsel-recoll</id>
   <content type="html">&lt;p&gt;I know that most Emacs hackers love the simplicity and usability of
grep, but sometimes it just doesn&amp;#39;t cut it.  A specific use case is my
Org-mode directory, which includes a lot of org files and PDF
files. There are just too many files for grep to be efficient, plus
the structure of PDF doesn&amp;#39;t lend itself to grep, so another tool is
required: a desktop database.&lt;/p&gt;

&lt;p&gt;I got into the topic by reading John Kitchin&amp;#39;s post on
&lt;a href=&quot;http://kitchingroup.cheme.cmu.edu/blog/2015/07/06/Indexing-headlines-in-org-files-with-swish-e-with-laser-sharp-results/&quot;&gt;swish-e&lt;/a&gt;,
however, I just couldn&amp;#39;t get that software to work. But as a reply to
his post, another tool -
&lt;a href=&quot;https://en.wikipedia.org/wiki/Recoll&quot;&gt;recoll&lt;/a&gt; was mentioned on
Org-mode&amp;#39;s mailing list. In this post, I&amp;#39;ll give step-by-step
instructions to make Recoll work with Emacs.&lt;/p&gt;

&lt;h2 id=&quot;building-recoll&quot;&gt;Building Recoll&lt;/h2&gt;

&lt;p&gt;I&amp;#39;m assuming that you&amp;#39;re on a GNU/Linux system, since it&amp;#39;s my
impression is that it&amp;#39;s the easiest system for building (as in &lt;code&gt;make
...&lt;/code&gt;) software. Also, it&amp;#39;s the only system that I&amp;#39;ve got, so it would
be hard for me to explain other systems.&lt;/p&gt;

&lt;p&gt;If you want to toy around with the graphical back end of Recoll, you can install it with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;sudo apt-get install recoll
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Unfortunately, the shell tool &lt;code&gt;recollq&lt;/code&gt; isn&amp;#39;t bundled with that
package, so we need to download
&lt;a href=&quot;http://www.lesbonscomptes.com/recoll/download.html&quot;&gt;the sources&lt;/a&gt;.
The current version is &lt;a href=&quot;http://www.lesbonscomptes.com/recoll/recoll-1.20.6.tar.gz&quot;&gt;1.20.6&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;extract-the-archive&quot;&gt;Extract the archive&lt;/h3&gt;

&lt;p&gt;After downloading the archive, I open &lt;code&gt;~/Downloads&lt;/code&gt; in &lt;code&gt;dired&lt;/code&gt; and
press &lt;kbd&gt;&amp;amp;&lt;/kbd&gt; (&lt;code&gt;dired-do-async-shell-command&lt;/code&gt;).  It guesses from
the tar.gz extension that the command should be &lt;code&gt;tar zxvf&lt;/code&gt;. By
pressing &lt;kbd&gt;RET&lt;/kbd&gt;, I have the archive extracted to the current
directory. I&amp;#39;ve actually allocated &lt;code&gt;~/Software/&lt;/code&gt; for installing stuff
from tarballs, since I don&amp;#39;t want to put too much stuff in &lt;code&gt;~/Downloads&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;open-ansi-term&quot;&gt;Open ansi-term&lt;/h3&gt;

&lt;p&gt;I navigate to the &lt;code&gt;recoll-1.20.6/&lt;/code&gt; directory using &lt;code&gt;dired&lt;/code&gt;, then press
&lt;kbd&gt;&amp;#96;&lt;/kbd&gt; to open an &lt;code&gt;*ansi-term*&lt;/code&gt; buffer for the current
directory.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the setup for that (part of &lt;a href=&quot;https://github.com/abo-abo/oremacs&quot;&gt;my full config&lt;/a&gt;):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-terminal&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Switch to terminal. Launch if nonexistent.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*ansi-term*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;switch-to-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*ansi-term*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ansi-term&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/bin/bash&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-buffer-process&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*ansi-term*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-dired-open-term&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Open an &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ansi-term&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; that corresponds to current directory.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current-dir&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-current-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;term-send-string&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ora-terminal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file-remote-p&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;current-dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tramp-dissect-file-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;current-dir&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ssh %s@%s\n&amp;quot;&lt;/span&gt;
                   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;aref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;aref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cd &amp;#39;%s&amp;#39;\n&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;current-dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;current-dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;`&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ora-dired-open-term&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;configure-and-make&quot;&gt;Configure and make&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s a typical sequence of shell commands. &lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;./configure &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make
sudo make install
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; query &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make
which recoll
sudo cp recollq /usr/local/bin/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I was a total Linux newbie 5 years ago and had no idea about shell
commands. Using only the first two lines, you can build and install a
huge amount of software, so these are a great place to start if you
want to learn these tools. I actually got by using only those two
lines for a year a so.&lt;/p&gt;

&lt;p&gt;After the first run or &lt;code&gt;./configure&lt;/code&gt; it turned out that I was missing
one library, so I had to do this one and redo the &lt;code&gt;./configure&lt;/code&gt; step.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;sudo apt-get install libqt5webkit5-dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I think this one would work as well:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;sudo apt-get build-dep recoll
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;configuring-recoll&quot;&gt;Configuring Recoll&lt;/h2&gt;

&lt;p&gt;I only launched the graphical interface to select the indexing
directory. It&amp;#39;s the home directory by default, I didn&amp;#39;t want that so I
chose &lt;code&gt;~/Dropbox/org/&lt;/code&gt; instead. Apparently, there&amp;#39;s a way to make the
indexing automatic via a cron job; you can even configure it via the
graphical interface: it&amp;#39;s all good.&lt;/p&gt;

&lt;h2 id=&quot;using-recoll-from-emacs&quot;&gt;Using Recoll from Emacs&lt;/h2&gt;

&lt;p&gt;Emacs has great options for processing output from a shell command. So
first I had to figure out how the shell command should look like. This
should be good enough to produce a list of indexed files that contain the word &amp;quot;Haskell&amp;quot;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;recollq -b &lt;span class=&quot;s1&quot;&gt;&amp;#39;haskell&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And there&amp;#39;s how to adapt that command to the asynchronous &lt;code&gt;ivy-read&lt;/code&gt; interface:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-recoll-function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;&amp;amp;rest&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;_unused&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Issue recallq for STRING.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;counsel-more-chars&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;counsel--async-command&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;recollq -b &amp;#39;%s&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-recoll&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;&amp;amp;optional&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;initial-input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Search for a string in the recoll database.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;You&amp;#39;ll be given a list of files that match.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Selecting a file will launch &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`swiper&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; for that file.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;INITIAL-INPUT can be given as the initial minibuffer input.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;recoll: &amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-recoll-function&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:initial-input&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;initial-input&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:dynamic-collection&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:history&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-git-grep-history&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:action&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;file://\\(.*\\)\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file-name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
                          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-file&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pdf$&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;swiper&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The code here is pretty simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I don&amp;#39;t start a search until at least 3 chars are entered, in order to not get too many results.&lt;/li&gt;
&lt;li&gt;I mention &lt;code&gt;:dynamic-collection t&lt;/code&gt; which means that &lt;code&gt;recollq&lt;/code&gt; should be called after each new letter entered.&lt;/li&gt;
&lt;li&gt;In &lt;code&gt;:action&lt;/code&gt;, I specify to open the selected file and start a &lt;code&gt;swiper&lt;/code&gt; with the current input in that file.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope you found this info useful. It&amp;#39;s certainly pretty cool:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ~/Dropbox/org &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; du -hs
&lt;span class=&quot;c1&quot;&gt;# 567M .&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So there&amp;#39;s half of a gigabyte of stuff, all of it indexed, and I&amp;#39;m
getting a file list update after each new key press in Emacs.&lt;/p&gt;

&lt;p&gt;If you know of a better tool than recoll (I&amp;#39;m not too happy that match
context that it gives via the &lt;code&gt;-A&lt;/code&gt; command option), please do share.
Also, I&amp;#39;ve just learned that there&amp;#39;s
&lt;a href=&quot;https://github.com/emacs-helm/helm-recoll&quot;&gt;helm-recoll&lt;/a&gt; out there, so
you can use that if you like Helm.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New Ivy multi-action exit</title>
   <link href="https://oremacs.com/2015/07/23/ivy-multiaction/"/>
   <updated>2015-07-23T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/07/23/ivy-multiaction</id>
   <content type="html">&lt;p&gt;So many Emacs commands and bindings, but little time to learn them
all.  That&amp;#39;s why many-in-one solutions like
&lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt; are often a good deal: you
only remember the base binding, and get more info along the way if you
get lost.&lt;/p&gt;

&lt;p&gt;I&amp;#39;ve wanted to optimize this approach when it comes to completion as
well.  In
&lt;a href=&quot;http://oremacs.com/2015/06/08/describe-variable-tip/&quot;&gt;last month&amp;#39;s post&lt;/a&gt;
I described how you can get help / jump to definition / jump to info
for the current &lt;kbd&gt;F1 v&lt;/kbd&gt; (&lt;code&gt;counsel-describe-variable&lt;/code&gt;)
candidate with &lt;kbd&gt;C-m&lt;/kbd&gt; / &lt;kbd&gt;C-.&lt;/kbd&gt; / &lt;kbd&gt;C-,&lt;/kbd&gt;.
While that approach can be viable, it has a few problems. The first
problem is that it&amp;#39;s not discoverable: you may be using &lt;kbd&gt;C-m&lt;/kbd&gt;
option for ages and not know that &lt;kbd&gt;C-.&lt;/kbd&gt; and &lt;kbd&gt;C-,&lt;/kbd&gt;
exist. The second problem is that it&amp;#39;s not extensible: if you wanted
more actions, there are hardly any good bindings left in the
minibuffer to bind those actions.&lt;/p&gt;

&lt;p&gt;In
&lt;a href=&quot;http://oremacs.com/2015/07/09/counsel-rhythmbox/&quot;&gt;a more recent post&lt;/a&gt;,
I described a solution that alleviates both problems. When you press
&lt;kbd&gt;C-o&lt;/kbd&gt;, you see how many actions are
available, and you can cycle them with &lt;kbd&gt;w&lt;/kbd&gt; and
&lt;kbd&gt;s&lt;/kbd&gt;. However, while discoverable, this approach is cumbersome
if you already know what you want to do. Especially cycling can&amp;#39;t be
great when there are a lot of actions.&lt;/p&gt;

&lt;p&gt;So today I&amp;#39;ve added a new approach in addition to the previous one.
When you press &lt;kbd&gt;M-o&lt;/kbd&gt; (&lt;code&gt;ivy-dispatching-done&lt;/code&gt;), you get a hint
showing you which actions are available.  It&amp;#39;s like &lt;kbd&gt;C-m&lt;/kbd&gt;
(&lt;code&gt;ivy-done&lt;/code&gt;), only allows you to quickly select the
action. Conveniently, the default action is bound to &lt;kbd&gt;o&lt;/kbd&gt;, so
&lt;kbd&gt;M-o o&lt;/kbd&gt; is equivalent to &lt;kbd&gt;C-m&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s how I add one more action to the default one of &lt;code&gt;ivy-switch-buffer&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-actions&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-switch-buffer&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;kill-buffer&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy--reset-state&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-last&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;kill&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-o o&lt;/kbd&gt; will still switch to selected buffer.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-o k&lt;/kbd&gt; will kill the selected buffer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you&amp;#39;re familiar with &lt;code&gt;hydra&lt;/code&gt;, the format is the same: &lt;code&gt;(key cmd
hint)&lt;/code&gt;.  This approach is very extensible: you can add actions and
bindings to commands without changing the code of the original
command. It&amp;#39;s really fast: you&amp;#39;re typing just one extra key to select
an action. And you&amp;#39;ll hardly run out of keys to bind, with 25 lower
case keys at your disposal (other bindings work as well, I just think
that lower case keys are the fastest to press).&lt;/p&gt;

&lt;p&gt;In case you wonder what &lt;code&gt;(ivy--reset-state ivy-last)&lt;/code&gt; does, it&amp;#39;s used
to update the list of buffers, since one of them was deleted. This
way, you can delete e.g. 4 buffers with &lt;kbd&gt;C-x b C-o s gggg&lt;/kbd&gt;,
and have the buffer list update after each &lt;kbd&gt;g&lt;/kbd&gt;.&lt;/p&gt;

&lt;h2 id=&quot;new-functionality-in-action&quot;&gt;New functionality in action&lt;/h2&gt;

&lt;p&gt;Let&amp;#39;s look at one package that has a multitude of actions available
for each candidate - &lt;code&gt;projectile&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-projectile-projects-map&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make-sparse-keymap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set-keymap-parent&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-projectile-define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-d&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-g&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-projectile-vc&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-e&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-projectile-switch-to-eshell&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-find-files-grep&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-c&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-projectile-compile-project&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-t&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-projectile-test-project&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-r&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-projectile-run-project&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-D&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-projectile-remove-known-project&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Mapping for known projectile projects.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s the basic Ivy function for selecting a project:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-switch-project&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;Switch to project: &amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;projectile-project-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;abbreviate-file-name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;projectile-project-root&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;projectile-relevant-known-projects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
     &lt;span class=&quot;nv&quot;&gt;projectile-known-projects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;nb&quot;&gt;:action&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;projectile-switch-project-by-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c m&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-switch-project&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And now let&amp;#39;s add all those actions:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-actions&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-switch-project&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Open Dired in project&amp;#39;s directory&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-projectile-vc&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Open project root in vc-dir or magit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-projectile-switch-to-eshell&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Switch to Eshell&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-do-grep-1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;Grep in projects&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-projectile-compile-project&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Compile project&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-projectile-remove-known-project&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Remove project(s)&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s what I get now after pressing &lt;kbd&gt;M-o&lt;/kbd&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-multiaction.png&quot; alt=&quot;ivy-multiaction.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Looks pretty good, I think. I hope you find the new approach useful.
The multi-action exit is currently enabled by default for
&lt;code&gt;ivy-switch-buffer&lt;/code&gt;, &lt;code&gt;counsel-locate&lt;/code&gt; and &lt;code&gt;counsel-rhythmbox&lt;/code&gt;, but you
can add actions yourself to almost any command that uses &lt;code&gt;ivy-read&lt;/code&gt;.
In the rare case when &lt;code&gt;ivy-read&lt;/code&gt; isn&amp;#39;t in the tail position, you can
use &lt;a href=&quot;http://oremacs.com/2015/07/16/callback-quit/&quot;&gt;ivy-quit-and-run&lt;/a&gt;
inside the added action functions.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Easily arrange hydra into a matrix</title>
   <link href="https://oremacs.com/2015/07/20/hydra-columns/"/>
   <updated>2015-07-20T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/07/20/hydra-columns</id>
   <content type="html">&lt;h2 id=&quot;the-new-columns-option&quot;&gt;The new &lt;code&gt;:columns&lt;/code&gt; option&lt;/h2&gt;

&lt;p&gt;Today I&amp;#39;ll introduce a pretty cool new option that you can use to
quickly create hydra docstrings arranged in a matrix.  This, of
course, was already possible before, but you had to format the matrix
by-hand like this (I cite just bit instead of the
&lt;a href=&quot;https://github.com/abo-abo/hydra/wiki/Projectile&quot;&gt;full code&lt;/a&gt;, it was
cut to fit into the Jekyll code column restriction):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-projectile&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;teal&lt;/span&gt;
                            &lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;     PROJECTILE:&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;     Find File            Search/Tags&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;-----------------------------------------&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_s-f_: file            _a_: ag&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt; _ff_: file dwim       _g_: update gtags&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt; _fd_: file curr dir   _o_: multi-occur&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt; &amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s-f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-find-file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-ag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ff&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-find-file-dwim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fd&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-find-file-in-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ggtags-update-tags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-multi-occur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The syntax above is still very useful if you want to arrange every
detail perfectly or need Ruby-style quoting.  But here&amp;#39;s the new
syntax that allows to get almost the
&lt;a href=&quot;https://github.com/abo-abo/hydra/wiki/Projectile&quot;&gt;same docstring&lt;/a&gt;
much easier:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-projectile&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;
                            &lt;span class=&quot;nb&quot;&gt;:columns&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Projectile&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-ag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ag&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-switch-to-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;switch to buffer&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-invalidate-cache&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cache clear&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-find-dir&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;dir&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s-f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-find-file&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;file&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ff&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-find-file-dwim&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;file dwim&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fd&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-find-file-in-directory&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;file curr dir&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ggtags-update-tags&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;update gtags&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-ibuffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Ibuffer&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;K&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-kill-buffers&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Kill all buffers&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-multi-occur&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;multi-occur&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-switch-project&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;switch&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-recentf&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;recent file&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;x&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-remove-known-project&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;remove known&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;X&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-cleanup-known-projects&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cleanup non-existing&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;z&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-cache-current-file&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cache current&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It still looks pretty good, in my opinion:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-columns-projectile.png&quot; alt=&quot;hydra-columns-projectile.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Note how all redundant information has been removed. Another advantage
is the you can easily:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add/remove heads.&lt;/li&gt;
&lt;li&gt;Update head hints.&lt;/li&gt;
&lt;li&gt;Change the number of columns.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;a-bit-of-customization&quot;&gt;A bit of customization&lt;/h2&gt;

&lt;p&gt;After each change, just re-eval the &lt;code&gt;defhydra&lt;/code&gt; and you&amp;#39;re done - no
need to manually re-arrange the docstring.  Since there already is an
interface that allows you to customize the docstring very precisely, I
tried to make the new interface as automatic as possible: just specify
the number of columns and you&amp;#39;re done. But if you want just a little
bit more customization, look at this code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-key-doc-function&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-key-doc-function-default&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;The function for formatting key-doc pairs.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-key-doc-function-default&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key-width&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;doc&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;doc-width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;%%%ds: %%%ds&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key-width&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;doc-width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;doc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So if you want to add a little space here and there, or e.g. wrap key
bindings in brackets, just clone &lt;code&gt;hydra-key-doc-function-default&lt;/code&gt;,
customize it a bit and set &lt;code&gt;hydra-key-doc-function&lt;/code&gt; to the new
function.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;If you&amp;#39;ve been using just the plain style before and felt that you
can&amp;#39;t fit your docstring on one line, try the new style: it&amp;#39;s just one
line of change with respect to your old code.  And if you&amp;#39;ve been
building the docstring by-hand, see if it&amp;#39;s possible to transform it
to the new style: adding and removing new heads will become easier.
Thanks to &lt;a href=&quot;https://github.com/Fuco1&quot;&gt;@Fuco1&lt;/a&gt; for the suggestion in
&lt;a href=&quot;https://github.com/abo-abo/hydra/issues/140&quot;&gt;#140&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Quitting to command loop in Elisp</title>
   <link href="https://oremacs.com/2015/07/16/callback-quit/"/>
   <updated>2015-07-16T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/07/16/callback-quit</id>
   <content type="html">&lt;p&gt;Today I&amp;#39;d like to share an interesting bit of Elisp that comes up
every now and then for me.  Imagine that you have this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;useful-command&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;do-thing-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;do-thing-2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;funcall&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;callback-function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;do-thing-3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Sometimes, when you are in &lt;code&gt;callback-function&lt;/code&gt;, you might want to
abandon the function that called you, &lt;code&gt;useful-command&lt;/code&gt; in this case,
and call a different function, with the current context.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s what I&amp;#39;ve come up with to do just that:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defmacro&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-quit-and-run&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;&amp;amp;rest&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Quit the minibuffer and run BODY afterwards.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;put&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;quit&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;error-message&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;run-at-time&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;put&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;quit&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;error-message&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                    &lt;span class=&quot;o&quot;&gt;,@&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;minibuffer-keyboard-quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To break it up into parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;minibuffer-keyboard-quit&lt;/code&gt; will unwind the call stack all the way to
the command loop, preventing e.g.  &lt;code&gt;do-thing-3&lt;/code&gt; from being
called. Note that the call stack can be as deep as you like, e.g.
&lt;code&gt;useful-command&lt;/code&gt; might be called by &lt;code&gt;utility-command&lt;/code&gt; etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;run-at-time&lt;/code&gt; with the argument &lt;code&gt;nil&lt;/code&gt; will run the code as soon as
possible, which is almost exactly after we&amp;#39;re back into the command
loop.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The final trick is to prevent &lt;code&gt;Quit&lt;/code&gt; from being displayed in the minibuffer.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;sample-application&quot;&gt;Sample application&lt;/h2&gt;

&lt;p&gt;Suppose that I&amp;#39;ve called &lt;code&gt;find-file&lt;/code&gt; when &lt;code&gt;ivy-mode&lt;/code&gt; is
active. Typically, I&amp;#39;d select a file and press &lt;kbd&gt;C-m&lt;/kbd&gt; to open
it. However, sometimes I just want to see the selected file in &lt;code&gt;dired&lt;/code&gt;
instead of opening it. This code is from before
&lt;a href=&quot;http://oremacs.com/2015/07/09/counsel-rhythmbox/&quot;&gt;ivy multi-action interface&lt;/a&gt;,
it plainly binds a command in &lt;code&gt;ivy-minibuffer-map&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-minibuffer-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-dired&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-dired&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--directory&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-quit-and-run&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;regexp-quote&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;substring&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--current&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-beginning&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;user-error&lt;/span&gt;
     &lt;span class=&quot;s&quot;&gt;&amp;quot;Not completing files currently&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So at the moment when &lt;kbd&gt;C-:&lt;/kbd&gt; is pressed, the call stack is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-x C-f&lt;/kbd&gt; called &lt;code&gt;find-file&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;find-file&lt;/code&gt; called &lt;code&gt;completion-read-function&lt;/code&gt; which is set to &lt;code&gt;ivy-completing-read&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-completing-read&lt;/code&gt; called &lt;code&gt;ivy-read&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-read&lt;/code&gt; called &lt;code&gt;read-from-minibuffer&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks to the new macro, I can unwind all of that stuff, making sure
nothing extra will be executed that was supposed to be executed after
&lt;code&gt;read-from-minibuffer&lt;/code&gt; had returned. In other words, the file will not
be opened.  Instead, a &lt;code&gt;dired&lt;/code&gt; buffer will be opened, centered on the
selected candidate.&lt;/p&gt;

&lt;p&gt;What I described above can actually be a pretty common scenario, you
could adapt it to &lt;code&gt;helm&lt;/code&gt; or &lt;code&gt;avy&lt;/code&gt; or &lt;code&gt;projectile&lt;/code&gt;.  Basically to
anything that includes some form of completion (i.e. commands that
wait for input) and offers you a customizable keymap. Small
disclaimer: the above code falls into the quick-and-dirty category, I
don&amp;#39;t recommend it if you can do something smarter instead. But if you
can&amp;#39;t do anything smarter due to being constrained by an interface you
don&amp;#39;t control, this macro could help you out.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Command Rhythmbox from Emacs</title>
   <link href="https://oremacs.com/2015/07/09/counsel-rhythmbox/"/>
   <updated>2015-07-09T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/07/09/counsel-rhythmbox</id>
   <content type="html">&lt;p&gt;I might have mentioned before that I&amp;#39;m using GNU/Linux on all of my
computers.  The particular flavor is Ubuntu, although it shouldn&amp;#39;t
matter much, since I can count the graphical applications that I use
at all, besides Emacs, on one hand. They are: Firefox, Evince,
Rhythmbox and VLC. Of course, as most true Emacs-ers, I strive to
reduce this number to zero. So I got quite excited when I saw
&lt;a href=&quot;https://github.com/mrBliss/helm-rhythmbox&quot;&gt;helm-rhythmbox&lt;/a&gt; show up in
my package list. It works great: you can play and enqueue tracks with
completion without leaving Emacs. Big thanks to
&lt;a href=&quot;https://github.com/mrBliss&quot;&gt;@mrBliss&lt;/a&gt;, and, of course, the authors
for &lt;code&gt;dbus.el&lt;/code&gt; which makes interaction with D-Bus possible through
Elisp.&lt;/p&gt;

&lt;p&gt;I&amp;#39;m not as big a fan of Helm as I used to be, so I quickly implemented an Ivy equivalent:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-rhythmbox-enqueue-song&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;song&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Let Rhythmbox enqueue SONG.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;org.gnome.Rhythmbox3&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/org/gnome/Rhythmbox3/PlayQueue&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;org.gnome.Rhythmbox3.PlayQueue&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dbus-call-method&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:session&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;interface&lt;/span&gt;
                      &lt;span class=&quot;s&quot;&gt;&amp;quot;AddToQueue&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rhythmbox-song-uri&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;song&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-rhythmbox&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Choose a song from the Rhythmbox library to play or enqueue.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;helm-rhythmbox&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Please install &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`helm-rhythmbox&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;rhythmbox-library&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rhythmbox-load-library&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;rhythmbox-library&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sit-for&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Rhythmbox: &amp;quot;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-rhythmbox-candidates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:action&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Play song&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-rhythmbox-play-song&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Enqueue song&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-rhythmbox-enqueue-song&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I listed the whole code just to show how easy it is to interact with
D-Bus, and also to show-off the shiny new multi-action interface of
&lt;code&gt;ivy-read&lt;/code&gt;.  Besides being discoverable via &lt;kbd&gt;C-o&lt;/kbd&gt;, the
multi-action interface is extensible as well. Here&amp;#39;s how to add a
&amp;quot;Dequeue&amp;quot; action without touching the original code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-rhythmbox-dequeue-song&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;song&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Let Rhythmbox dequeue SONG.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;org.gnome.Rhythmbox3&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/org/gnome/Rhythmbox3/PlayQueue&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;org.gnome.Rhythmbox3.PlayQueue&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dbus-call-method&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:session&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;interface&lt;/span&gt;
                      &lt;span class=&quot;s&quot;&gt;&amp;quot;RemoveFromQueue&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rhythmbox-song-uri&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;song&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-actions&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-rhythmbox&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Dequeue song&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-rhythmbox-dequeue-song&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Very simple, &lt;code&gt;counsel-rhythmbox-dequeue-song&lt;/code&gt; is a clone of
&lt;code&gt;counsel-rhythmbox-enqueue-song&lt;/code&gt; with only the method change from
&lt;code&gt;AddToQueue&lt;/code&gt; to &lt;code&gt;RemoveFromQueue&lt;/code&gt; (I blind-guessed the name, but there
should be a reference somewhere).  If you got tired of having a whole
three actions to choose from, you can revert to the initial two with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-set-actions&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-rhythmbox&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here&amp;#39;s how the updated &lt;kbd&gt;C-o&lt;/kbd&gt; option panel now looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-rhythmbox.png&quot; alt=&quot;counsel-rhythmbox.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;A bit of descriptions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;j&lt;/kbd&gt; moves to the next one of the 18 current candidates.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;k&lt;/kbd&gt; moves to the previous candidate.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;h&lt;/kbd&gt; moves to the first candidate.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;l&lt;/kbd&gt; moves to the last candidate.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;g&lt;/kbd&gt; calls the current action without exiting.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;d&lt;/kbd&gt; calls the current action and exits.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;s&lt;/kbd&gt; moves to the next action.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;w&lt;/kbd&gt; moves to the previous action.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;i&lt;/kbd&gt; and &lt;kbd&gt;C-o&lt;/kbd&gt; close the options panel without exiting.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;o&lt;/kbd&gt; closes the panel and exits.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Similarly to &lt;code&gt;hydra&lt;/code&gt;, each action has a short docstring, like &lt;code&gt;&amp;quot;Play
song&amp;quot;&lt;/code&gt; that should describe what it does.  Here are a few usage
scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If I wanted to play the first song and enqueue the third and the
sixth and exit the minibuffer, I would press &lt;kbd&gt;gsjjgjjjd&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;If I wanted to play the third and enqueue all the following, I would
press &lt;kbd&gt;jjgsjcjjjjjjjjjjjo&lt;/kbd&gt;. The many &lt;kbd&gt;j&lt;/kbd&gt; is just
me holding &lt;kbd&gt;j&lt;/kbd&gt; until the selection reaches the end, then I
simply exit without doing anything else by pressing &lt;kbd&gt;o&lt;/kbd&gt;.
The way &lt;kbd&gt;c&lt;/kbd&gt; works is that it toggles the &amp;quot;calling&amp;quot; state -
a state where the current action is called whenever a different
candidate is selected.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Almost forgot, if this little intro got you excited, the packages that you should install from MELPA are: &lt;code&gt;helm-rhythmbox&lt;/code&gt; and &lt;code&gt;counsel&lt;/code&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Pause or resume the current Hydra</title>
   <link href="https://oremacs.com/2015/07/07/hydra-resume/"/>
   <updated>2015-07-07T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/07/07/hydra-resume</id>
   <content type="html">&lt;p&gt;Today I&amp;#39;d like to highlight a generic command recently added to
&lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt;.  It&amp;#39;s kind of cute, and
maybe something that you didn&amp;#39;t even know you wanted.  Basically, the
&lt;code&gt;hydra-pause-resume&lt;/code&gt; command allows to pause and resume the current
hydra with one key. And it works for all hydras at once, without any
extra configuration. All you have to do is to bind it globally to
whatever you like, for example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-k&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-pause-resume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If a hydra is active, deactivate and push it on the stack.&lt;/li&gt;
&lt;li&gt;If no hydra is active, pop one from the stack and call it.&lt;/li&gt;
&lt;li&gt;If the stack is empty, call the last hydra.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Personally, I haven&amp;#39;t found too much use from the stack - resuming the
last one is enough for me. But the stack comes at no extra cost, and
might be useful to someone.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If, for example, you have 2 hydras on the stack, how to resume the
older one?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The way stacks work, you simply have to go through all elements one by one. So that&amp;#39;s:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;kbd&gt;C-M-k&lt;/kbd&gt; to resume the newer one.&lt;/li&gt;
&lt;li&gt;Quit the current one with the appropriate shortcut, only not with &lt;kbd&gt;C-M-k&lt;/kbd&gt;, since that would just put it back on the stack.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-M-k&lt;/kbd&gt; to resume the only one remaining on the stack - the older one.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://github.com/QiangF&quot;&gt;@QiangF&lt;/a&gt; for the suggestion in &lt;a href=&quot;https://github.com/abo-abo/hydra/issues/135&quot;&gt;#135&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Power up your locate command</title>
   <link href="https://oremacs.com/2015/07/02/counsel-locate/"/>
   <updated>2015-07-02T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/07/02/counsel-locate</id>
   <content type="html">&lt;h2 id=&quot;locate&quot;&gt;&lt;code&gt;locate&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;I&amp;#39;m sure many people know that Emacs comes with a &lt;code&gt;locate&lt;/code&gt;
command. This command, if you&amp;#39;re on a Linux system, will find all
files on your system that match a particular pattern. The advantage of
&lt;code&gt;locate&lt;/code&gt; over &lt;code&gt;find&lt;/code&gt; when searching the whole system, is that it is
much faster, since it uses a pre-computed database.  This database is
updated periodically, you can force an update with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;sudo updatedb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Of course &lt;code&gt;find&lt;/code&gt; is faster if you need to search only a specific
directory instead of the whole system, but sometimes you just don&amp;#39;t
know that directory.&lt;/p&gt;

&lt;h2 id=&quot;counsel-locate&quot;&gt;&lt;code&gt;counsel-locate&lt;/code&gt;&lt;/h2&gt;

&lt;h3 id=&quot;dynamic&quot;&gt;Dynamic&lt;/h3&gt;

&lt;p&gt;The way &lt;code&gt;locate&lt;/code&gt; works it that it asks you for a query, which is
glob-based instead of regex-based, and then prints the results to a
static buffer.&lt;/p&gt;

&lt;p&gt;On the other hand, &lt;code&gt;counsel-locate&lt;/code&gt; is dynamic: each time you input a
new character a new &lt;code&gt;locate&lt;/code&gt; query is ran, and the old one is
terminated.  On my system, it takes around 2 seconds for a query to
complete, so it requires a bit of patience.&lt;/p&gt;

&lt;h3 id=&quot;regex-based&quot;&gt;Regex-based&lt;/h3&gt;

&lt;p&gt;I like regex way more than globs for some reason. Here&amp;#39;s the command
called for the input &lt;code&gt;mp3$&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;locate -i --regex mp3$
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Of course, the standard &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;ivy-mode&lt;/a&gt;
method is used to build the regex from a list of space separated
words.  So the input &lt;code&gt;fleet mp3$&lt;/code&gt; will result in:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;locate -i --regex \\(fleet\\).*?\\(mp3$\\)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You could go your own way and update the regex matcher to be
&lt;code&gt;ivy--regex-fuzzy&lt;/code&gt;, which results in:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;locate -i --regex f.*l.*e.*e.*t.* .*m.*p.*3$
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But I think less matches is usually better than more matches.&lt;/p&gt;

&lt;h3 id=&quot;multi-exit&quot;&gt;Multi-exit&lt;/h3&gt;

&lt;p&gt;This is just the coolest feature. Basically, for each file you locate, you can easily:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open it in Emacs (default).&lt;/li&gt;
&lt;li&gt;Open it with &lt;code&gt;xdg-open&lt;/code&gt;, so that PDF files are forwarded to &lt;code&gt;evince&lt;/code&gt;
and MP3 files are forwarded to &lt;code&gt;rhythmbox&lt;/code&gt; etc.&lt;/li&gt;
&lt;li&gt;Open it in &lt;code&gt;dired&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here&amp;#39;s an example of how to do it. First I call &lt;code&gt;counsel-locate&lt;/code&gt;,
which I like to bind to &lt;kbd&gt;C-x l&lt;/kbd&gt;.  Then I enter &lt;code&gt;emacs pdf$&lt;/code&gt;
and wait around 2 seconds for the 248 results to come up. Then I
scroll to the 18th result and press &lt;kbd&gt;C-o&lt;/kbd&gt; to open up the
&lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt;-based option panel:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-locate-1.png&quot; alt=&quot;counsel-locate-1.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;The last column (Action) is newer than others. As you can see, it has
3 exit points, which I can scroll with &lt;kbd&gt;w&lt;/kbd&gt; and &lt;kbd&gt;s&lt;/kbd&gt;.
And currently I&amp;#39;m on the default exit point, which would open the file
in Emacs.&lt;/p&gt;

&lt;p&gt;For the next screenshot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I pressed &lt;kbd&gt;s&lt;/kbd&gt; twice to change the action to &lt;code&gt;dired&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I pressed &lt;kbd&gt;c&lt;/kbd&gt; to make the current action execute each time a new candidate is selected.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-locate-2.png&quot; alt=&quot;counsel-locate-2.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;So now, I could just scroll through all my directories on my system
that contain PDF files related to Emacs by just holding &lt;kbd&gt;j&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;A similar thing can be done for music tracks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-x l&lt;/kbd&gt; &lt;code&gt;dire mp3$&lt;/code&gt; to get the list of all Dire Straits tracks on my system.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-o s&lt;/kbd&gt; to switch the action from &amp;quot;open in Emacs&amp;quot; to &amp;quot;xdg-open&amp;quot;.&lt;/li&gt;
&lt;li&gt;From here, I could open one track after another by pressing &lt;kbd&gt;C-M-n&lt;/kbd&gt; repeatedly. Or I can press &lt;kbd&gt;c&lt;/kbd&gt; and then &lt;kbd&gt;j&lt;/kbd&gt; repeatedly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I&amp;#39;ve been experimenting with opening EPS and PDF files in quick
succession. It&amp;#39;s still a work in progress, since I need to use a special
&lt;code&gt;wmctrl&lt;/code&gt; script to prevent the Emacs window from losing focus each
time a new Evince instance is opened.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;You can check out the new feature by installing &lt;code&gt;counsel&lt;/code&gt; from
MELPA. It will automatically fetch &lt;code&gt;ivy-mode&lt;/code&gt; as well. When you enable
&lt;code&gt;ivy-mode&lt;/code&gt;, besides doing all your completion, it will also remap
&lt;code&gt;switch-to-buffer&lt;/code&gt; to &lt;code&gt;ivy-switch-buffer&lt;/code&gt;.  That command also has a
multi-exit: pressing &lt;kbd&gt;C-o sd&lt;/kbd&gt; instead of &lt;kbd&gt;C-m&lt;/kbd&gt; will
kill the selected buffer instead of switching to it.  It&amp;#39;s a very
minor optimization: instead of &lt;kbd&gt;C-m C-x k&lt;/kbd&gt; you press &lt;kbd&gt;C-o
sd&lt;/kbd&gt;, however you could e.g.  use &lt;kbd&gt;C-o scjjjj&lt;/kbd&gt; to kill
five buffers at once.&lt;/p&gt;

&lt;p&gt;While the idea of multi-exits is powerful, it&amp;#39;s hard to find places to
use it efficiently. I think &lt;code&gt;counsel-locate&lt;/code&gt; is a nice place for it,
although it could work without it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find file in Emacs with &lt;kbd&gt;C-m&lt;/kbd&gt; in the completion interface.&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;dired-jump&lt;/code&gt; with &lt;kbd&gt;C-x C-j&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;Type &lt;kbd&gt;!&lt;/kbd&gt; and &lt;code&gt;xdg-open&lt;/code&gt; &lt;kbd&gt;RET&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;Select and kill the unneeded file with &lt;kbd&gt;C-x k&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope you see now why I prefer &lt;kbd&gt;C-o sd&lt;/kbd&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Context aware hydra</title>
   <link href="https://oremacs.com/2015/06/30/context-aware-hydra/"/>
   <updated>2015-06-30T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/06/30/context-aware-hydra</id>
   <content type="html">&lt;p&gt;In this post, I&amp;#39;ll demonstrate a snippet that came up this week in a
conversation over John Kitchin&amp;#39;s
&lt;a href=&quot;http://kitchingroup.cheme.cmu.edu/blog/2015/06/24/Conditional-hydra-menus/&quot;&gt;post&lt;/a&gt;.
While the following snippet isn&amp;#39;t inherently useful, it might help a creative
user to understand Hydra a bit more and accomplish more advanced
things.&lt;/p&gt;

&lt;p&gt;This hydra demonstrates that the hint and even the key bindings aren&amp;#39;t
set in stone: you can modify them depending on the current state of
your Emacs, in this case the current line number.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;vi&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;n&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/hint&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;evenp&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;line-number-at-pos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;prog1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eval&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra--format&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                           &lt;span class=&quot;s&quot;&gt;&amp;quot;\neven: _j_ _k_\n&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/heads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/keymap&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;n&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/keymap&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/keymap&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-vi/next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/keymap&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-vi/previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;prog1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eval&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra--format&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                           &lt;span class=&quot;s&quot;&gt;&amp;quot;\nodd: _n_ _p_\n&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/heads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/keymap&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/keymap&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/keymap&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;n&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-vi/next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/keymap&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-vi/previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The first statement is one of the most elementary &lt;code&gt;defhydra&lt;/code&gt;
calls. The only extra thing is that it sets the &lt;code&gt;:hint&lt;/code&gt; to nil.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;defhydra&lt;/code&gt; statement generates a bunch of function and variable
definitions. You can examine them closely by evaluating:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;macroexpand&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;vi&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;n&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Just paste that code into &lt;code&gt;*scratch*&lt;/code&gt;, and press &lt;kbd&gt;C-j&lt;/kbd&gt;. If
you want pretty output (153 lines of code instead of 26), turn on
&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy-mode&lt;/a&gt; and press &lt;kbd&gt;E&lt;/kbd&gt;
instead of &lt;kbd&gt;C-j&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Anyway, among these defined variables is &lt;code&gt;hydra-vi/hint&lt;/code&gt; which is
evaluated each time to display the hint. So now we can just redefine
&lt;code&gt;hydra-vi/hint&lt;/code&gt; to make it so that on even lines &lt;kbd&gt;n&lt;/kbd&gt; calls
&lt;code&gt;next-line&lt;/code&gt;, while on odd lines it&amp;#39;s &lt;kbd&gt;j&lt;/kbd&gt;, with the
appropriate changes in the doc. The change in bindings, modifying
&lt;code&gt;hydra-vi/keymap&lt;/code&gt; - also one of the defined variables, needs to be a
side-effect, since &lt;code&gt;hydra-vi/hint&lt;/code&gt; is expected to evaluate to a
string.&lt;/p&gt;

&lt;p&gt;Just to give you some idea of how it could be used: you can have a
context-aware &amp;quot;open&amp;quot; command that, for instance, delegates to
&lt;code&gt;open-in-pdf-tools&lt;/code&gt; or &lt;code&gt;open-in-firefox&lt;/code&gt; or &lt;code&gt;open-in-emacs&lt;/code&gt; when it
detects that the point is on a link. And of course all these commands
would have their own key binding that works only if the command makes
sense.&lt;/p&gt;

&lt;p&gt;This approach is described on
&lt;a href=&quot;https://github.com/abo-abo/hydra/wiki/Conditional-Hydra&quot;&gt;the wiki&lt;/a&gt;,
in case you read this post much later and want to see an up-to-date
code, or even update it yourself. In case something cool comes out of
this snippet, I can try to implement a more palatable API for
&lt;code&gt;defhydra&lt;/code&gt;, most likely an option to supply a function name in the
&lt;code&gt;docstring&lt;/code&gt; argument position.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New video demo - counsel-load-theme</title>
   <link href="https://oremacs.com/2015/06/23/counsel-load-theme/"/>
   <updated>2015-06-23T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/06/23/counsel-load-theme</id>
   <content type="html">&lt;p&gt;Without further ado, here&amp;#39;s the &lt;a href=&quot;https://youtu.be/V_whk214fec&quot;&gt;video link&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-code&quot;&gt;The code&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel--load-theme-action&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Disable current themes and load theme X.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;condition-case&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapc&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;disable-theme&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;custom-enabled-themes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;load-theme&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;intern&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fboundp&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;powerline-reset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;powerline-reset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Problem loading theme %s&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-load-theme&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Forward to &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`load-theme&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Usable with &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ivy-resume&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ivy-next-line-and-call&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; and&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;`ivy-previous-line-and-call&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Load custom theme: &amp;quot;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;symbol-name&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;custom-available-themes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;:action&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;counsel--load-theme-action&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It looks almost trivial, the main idea is to disable all current
themes and load the new one. Additionally, try to reset the
&lt;code&gt;powerline&lt;/code&gt;, since it has to match the &lt;code&gt;mode-line&lt;/code&gt; face, which most
themes customize.&lt;/p&gt;

&lt;h2 id=&quot;the-interface&quot;&gt;The Interface&lt;/h2&gt;

&lt;p&gt;The interface of &lt;code&gt;ivy-read&lt;/code&gt; is the same as the built-in
&lt;code&gt;completing-read&lt;/code&gt; in first two arguments. The difference is that it
also accepts a callback through the &lt;code&gt;:action&lt;/code&gt; argument.  This callback
will make the completion engine aware of what needs to be done with
the completion result. The presence of the callback allows these completion engine features to work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ivy-resume&lt;/code&gt; will resume the last completion. Very useful if you
change your mind on the candidate, or want to examine a related
candidate.&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-next-line-and-call&lt;/code&gt; selects the next matching candidate and executes the callback for it.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-previous-line-and-call&lt;/code&gt; selects the previous matching candidate and executes the callback for it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I like to think of &lt;code&gt;ivy-resume&lt;/code&gt; as a &lt;kbd&gt;DEL&lt;/kbd&gt; or
&lt;kbd&gt;&amp;lt;left&amp;gt;&lt;/kbd&gt; for completion. As you can erase or go back
one character with the same &lt;kbd&gt;DEL&lt;/kbd&gt; binding, regardless of the
last character inputted (&lt;kbd&gt;a&lt;/kbd&gt; or &lt;kbd&gt;B&lt;/kbd&gt; etc), in the
same way you can call the completion again with the same
&lt;kbd&gt;&amp;lt;f6&amp;gt;&lt;/kbd&gt; binding, regardless of the command that required
completion (&lt;code&gt;counsel-git-grep&lt;/code&gt; or &lt;code&gt;counsel-load-theme&lt;/code&gt; or
&lt;code&gt;counsel-load-library&lt;/code&gt; etc). &lt;code&gt;ivy-resume&lt;/code&gt; isn&amp;#39;t bound by default,
since it needs to be a global binding. I just use this in my config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-resume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For the functions that execute the callback while changing the
candidate, the idea is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-M-n&lt;/kbd&gt; (&lt;code&gt;ivy-next-line-and-call&lt;/code&gt;) corresponds to &lt;kbd&gt;C-n&lt;/kbd&gt; (&lt;code&gt;ivy-next-line&lt;/code&gt;),&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-M-p&lt;/kbd&gt; (&lt;code&gt;ivy-previous-line-and-call&lt;/code&gt;) corresponds to &lt;kbd&gt;C-n&lt;/kbd&gt; (&lt;code&gt;ivy-previous-line&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I&amp;#39;ve also showed off a generic &lt;code&gt;ivy&lt;/code&gt; feature: &lt;kbd&gt;M-j&lt;/kbd&gt; will yank
the word at point into the minibuffer.  Think of it as the mirror of
&lt;kbd&gt;C-w&lt;/kbd&gt; in &lt;code&gt;isearch&lt;/code&gt;. It could not be &lt;kbd&gt;C-w&lt;/kbd&gt;, since I
like &lt;kbd&gt;C-w&lt;/kbd&gt; being bound to &lt;code&gt;kill-region&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-command-insert-mode-split&quot;&gt;The command/insert mode split&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-load-theme.png&quot; alt=&quot;counsel-load-theme.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Finally, I show off the equivalent
&lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt;-based modal selection
method.  So instead of pressing &lt;kbd&gt;C-M-n C-M-n C-M-n C-M-p
C-M-p&lt;/kbd&gt;, you can press the equivalent &lt;kbd&gt;C-o c jjjkk&lt;/kbd&gt;.
Luckily, you don&amp;#39;t need to remember a lot of bindings for this &lt;code&gt;hydra&lt;/code&gt;
mode: just press &lt;kbd&gt;C-o&lt;/kbd&gt; and read the hints. I&amp;#39;ll just list the
exit points, since that&amp;#39;s usually the more important stuff:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To exit the &amp;quot;command-mode&amp;quot; completely, press &lt;kbd&gt;o&lt;/kbd&gt; or the standard &lt;kbd&gt;C-g&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;To exit the &amp;quot;command-mode&amp;quot; with the current candidate, press &lt;kbd&gt;f&lt;/kbd&gt; or &lt;kbd&gt;d&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;To exit the &amp;quot;command-mode&amp;quot; and once again edit the minibuffer, press &lt;kbd&gt;i&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You might ask why &lt;kbd&gt;f&lt;/kbd&gt; and &lt;kbd&gt;d&lt;/kbd&gt; do the same. They
actually mirror &lt;kbd&gt;C-j&lt;/kbd&gt; (&lt;code&gt;ivy-alt-done&lt;/code&gt;) and &lt;kbd&gt;C-m&lt;/kbd&gt;
(&lt;code&gt;ivy-done&lt;/code&gt;). And if you ask what the difference between those two is,
the answer is that &lt;code&gt;ivy-alt-done&lt;/code&gt; will not exit the completion when
selecting directories during file name completion. It may be possible
to extend this to other types of completion where it makes sense to
select something but not to exit the minibuffer.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;If you&amp;#39;re using &lt;code&gt;ivy-mode&lt;/code&gt;, make sure to try the new features: the
action-using commands should work for any command that starts with
&lt;code&gt;counsel-&lt;/code&gt;. For other commands, like &lt;code&gt;package-install&lt;/code&gt;, you can only
select one candidate with &lt;kbd&gt;C-m&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Also do try &lt;kbd&gt;C-M-n&lt;/kbd&gt; with &lt;code&gt;counsel-find-file&lt;/code&gt;: you&amp;#39;ll be able
to cycle through all files in a directory without exiting the
completion. Same goes for &lt;code&gt;ivy-switch-buffer&lt;/code&gt;, which should probably
be renamed to &lt;code&gt;counsel-switch-buffer&lt;/code&gt; for consistency.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Debug Clojure with CIDER and lispy</title>
   <link href="https://oremacs.com/2015/06/22/debug-clojure/"/>
   <updated>2015-06-22T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/06/22/debug-clojure</id>
   <content type="html">&lt;p&gt;To commemorate the release of &lt;a href=&quot;http://batsov.com/articles/2015/06/16/cider-0-dot-9/&quot;&gt;CIDER 0.9.0&lt;/a&gt;, I&amp;#39;ve just
added the ability to debug-step-in Clojure expressions to &lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This ability was present for Elisp for a very long time, and it&amp;#39;s
instrumental to
&lt;a href=&quot;https://github.com/abo-abo?tab=repositories&quot;&gt;my Elisp output&lt;/a&gt;. So now
I&amp;#39;ve added exactly the same thing to Clojure.&lt;/p&gt;

&lt;h2 id=&quot;how-it-works&quot;&gt;How it works&lt;/h2&gt;

&lt;p&gt;Suppose that you have this function (borrowed from &lt;a href=&quot;http://www.manning.com/fogus2/&quot;&gt;The Joy of Clojure&lt;/a&gt;):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;defn &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;l-&amp;gt;rfix&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;op&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;op&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;op1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;op2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;op2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;op1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;op1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;op2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;op3&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;op3&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;d&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;op2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;op1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;An important thing is that the function needs to be loaded (probably
with &lt;code&gt;cider-load-file&lt;/code&gt;), in order for Clojure to know its location. If
you only evaluate the function with &lt;kbd&gt;C-x C-e&lt;/kbd&gt;, it won&amp;#39;t
work. Actually, the same applies to Elisp.&lt;/p&gt;

&lt;p&gt;And then you have the corresponding function call (&lt;code&gt;|&lt;/code&gt; is the point, as usual):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;l-&amp;gt;rfix&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;* &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;+ &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you press &lt;kbd&gt;xj&lt;/kbd&gt; (&lt;code&gt;lispy-debug-step-in&lt;/code&gt;), the following code is evaluated on the Clojure side:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;op1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;op2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;At the same time, you are taken to the second branch of the body of
&lt;code&gt;l-&amp;gt;rfix&lt;/code&gt; - exactly the one that corresponds to 5 arguments.  And
that&amp;#39;s it: you now have &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;op1&lt;/code&gt; etc defined to their proper
values. You can now continue within the function body with many
possible follow-ups. I&amp;#39;ll just list the eval-related ones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;kbd&gt;e&lt;/kbd&gt; to evaluate expression at point.&lt;/li&gt;
&lt;li&gt;If you want to evaluate a symbol, mark it with &lt;kbd&gt;M-m&lt;/kbd&gt;, end
evaluate with &lt;kbd&gt;e&lt;/kbd&gt;. Actually, I prefer to mark stuff with
&lt;kbd&gt;m&lt;/kbd&gt; and &lt;kbd&gt;hjkl&lt;/kbd&gt; arrows, using &lt;kbd&gt;i&lt;/kbd&gt; to mark
the first element of the region. It&amp;#39;s also possible to mark with
&lt;kbd&gt;a&lt;/kbd&gt;, and &lt;kbd&gt;2m&lt;/kbd&gt;, &lt;kbd&gt;3m&lt;/kbd&gt; etc.&lt;/li&gt;
&lt;li&gt;If you want to bind a symbol in a &lt;code&gt;let&lt;/code&gt; binding, mark both the
symbol and its value, and press &lt;kbd&gt;e&lt;/kbd&gt;. If there are many
&lt;code&gt;let&lt;/code&gt; bindings, you can navigate to the next one with either
&lt;kbd&gt;jj&lt;/kbd&gt; or &lt;kbd&gt;2j&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;You can debug-step-in again if needed with &lt;kbd&gt;xj&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;You can flatten a function or a macro call with &lt;kbd&gt;xf&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;You can eval-and-insert with &lt;kbd&gt;E&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;You can eval-and-commented-insert with &lt;kbd&gt;2e&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Just to add, any of these will work properly and switch to an appropriate body branch:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;l-&amp;gt;rfix&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;* &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;+ &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;l-&amp;gt;rfix&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;+ &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;l-&amp;gt;rfix&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;+ &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;+ &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;+ &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;l-&amp;gt;rfix&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;+ &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Enjoy the new code, but be mindful that it&amp;#39;s really fresh, so it will
certainly have some quirks.  For instance, function arguments as a map
won&amp;#39;t work since I haven&amp;#39;t programmed for that yet.  Big thanks to
&lt;a href=&quot;https://github.com/bbatsov&quot;&gt;@bbatsov&lt;/a&gt; and all CIDER contributors.&lt;/p&gt;

&lt;p&gt;A really cool thing that I hope to get in the future, is to make
&lt;kbd&gt;Z&lt;/kbd&gt; (&lt;code&gt;lispy-edebug-stop&lt;/code&gt;) also work in Clojure.  What it does
currently for Elisp, is to use &lt;code&gt;edebug&lt;/code&gt; to setup the function
arguments. It may be possible to use
&lt;a href=&quot;https://github.com/Malabarba&quot;&gt;@Malabarba&lt;/a&gt;&amp;#39;s new debugger
implementation for the same thing.&lt;/p&gt;

&lt;p&gt;The advantages of using &lt;code&gt;lispy&lt;/code&gt;-style debugger are the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can navigate your code the way you want, not just in a way that
the debugger allows you to.&lt;/li&gt;
&lt;li&gt;You can multi-debug, and have sessions last for days.&lt;/li&gt;
&lt;li&gt;You can edit the code as you debug. For this new code, I started
debugging when there was only a function name.  I added the body code
expression-by-expression, simultaneously debugging it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The disadvantage is a bit of namespace pollution, but I think it&amp;#39;s
more or less acceptable.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>avy 0.3.0 is out</title>
   <link href="https://oremacs.com/2015/06/19/avy-0.3.0/"/>
   <updated>2015-06-19T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/06/19/avy-0.3.0</id>
   <content type="html">&lt;p&gt;This is a feature-packed release consisting of 57 commits done over
the course of the last month by me and many
&lt;a href=&quot;https://github.com/abo-abo/avy/graphs/contributors&quot;&gt;contributors&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I&amp;#39;m trying something different this time with the
&lt;a href=&quot;https://github.com/abo-abo/avy/releases/tag/0.3.0&quot;&gt;release-notes&lt;/a&gt;:
I&amp;#39;ve started a
&lt;a href=&quot;https://github.com/abo-abo/avy/blob/master/doc/Changelog.org&quot;&gt;Changlelog.org&lt;/a&gt;
in the repository, which is much more pleasant to read (and write) in &lt;a href=&quot;https://raw.githubusercontent.com/abo-abo/avy/master/doc/Changelog.org&quot;&gt;&lt;code&gt;org-mode&lt;/code&gt; form&lt;/a&gt; inside Emacs:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avy-changelog-org.png&quot; alt=&quot;avy-changelog-org.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Then I used &lt;a href=&quot;http://pandoc.org/&quot;&gt;pandoc&lt;/a&gt; to convert the Org file to Markdown. Too bad, the &lt;code&gt;pandoc&lt;/code&gt; install-able through &lt;code&gt;apt-get&lt;/code&gt; knows nothing of Org mode,
so I had to&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;cabal install pandoc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and let &lt;code&gt;cabal&lt;/code&gt; do its thing for like 30 minutes. The exported
Markdown wasn&amp;#39;t too bad, just had to reformat most things to one line,
since Github&amp;#39;s &lt;code&gt;fill-column&lt;/code&gt; is like 150 chars instead of the
usual 80.  If someone has more experience of exporting Org to
Markdown, please do share: maybe there&amp;#39;s a better way to do this.&lt;/p&gt;

&lt;p&gt;Anyway, read the release notes either at &lt;a href=&quot;https://github.com/abo-abo/avy/releases/tag/0.3.0&quot;&gt;github&lt;/a&gt; or &lt;a href=&quot;https://raw.githubusercontent.com/abo-abo/avy/master/doc/Changelog.org&quot;&gt;inside Emacs&lt;/a&gt; and enjoy the cool new stuff.  Big thanks to all contributors.&lt;/p&gt;

&lt;p&gt;Also check out the &lt;a href=&quot;https://github.com/abo-abo/avy/wiki/defcustom&quot;&gt;wiki page on customization&lt;/a&gt; and other pages.
I think it would be cool to have a separate page for e.g. &lt;code&gt;avy-goto-char&lt;/code&gt; with the screenshots (or gifs) for all values of &lt;code&gt;avy-style&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pre&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;post&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;at&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;at-full&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;de-bruijn&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if anyone is willing to contribute (and check out those overlay
styles in the process), please go ahead: you can either clone the wiki
with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;git clone https://github.com/abo-abo/avy.wiki.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and push, or just &lt;a href=&quot;https://github.com/abo-abo/avy/wiki/_new&quot;&gt;edit&lt;/a&gt; it using Github&amp;#39;s widgets.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Transform a LISP case into a cond with lispy</title>
   <link href="https://oremacs.com/2015/06/09/lispy-case-to-cond/"/>
   <updated>2015-06-09T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/06/09/lispy-case-to-cond</id>
   <content type="html">&lt;p&gt;Just a little extension to the old &lt;kbd&gt;xc&lt;/kbd&gt; (&lt;code&gt;lispy-to-cond&lt;/code&gt;)
command that I&amp;#39;ve added today to &lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lispy-case-to-cond.png&quot; alt=&quot;lispy-case-to-cond.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Previously, &lt;kbd&gt;xc&lt;/kbd&gt; could only transform a series of nested &lt;code&gt;if&lt;/code&gt;
into a &lt;code&gt;cond&lt;/code&gt;.  You can even chain &lt;kbd&gt;xcxi&lt;/kbd&gt; to transform a
&lt;code&gt;case&lt;/code&gt; statement into equivalent &lt;code&gt;if&lt;/code&gt; statements.&lt;/p&gt;

&lt;p&gt;Note also that unwanted whitespace is properly removed. What you see
in the picture is actually an
&lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/ert/&quot;&gt;ERT&lt;/a&gt; test
that&amp;#39;s being run each time I commit new stuff. It makes sure that
starting in the first buffer state and pressing &lt;kbd&gt;xc&lt;/kbd&gt; really
results in the second buffer state. With this test, it&amp;#39;s reasonable to
believe that &lt;kbd&gt;xc&lt;/kbd&gt; will actually work the same way in an
interactive scenario. Right now, there are 599 of these type of tests
in lispy-test.el.  To view them like in the screenshot, you can press
&lt;kbd&gt;xv&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Final note, I realize that it should be &lt;code&gt;eql&lt;/code&gt; instead of &lt;code&gt;eq&lt;/code&gt;, but I
like &lt;code&gt;eq&lt;/code&gt; more: it&amp;#39;s 33% more efficient.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>More productive describe-variable</title>
   <link href="https://oremacs.com/2015/06/08/describe-variable-tip/"/>
   <updated>2015-06-08T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/06/08/describe-variable-tip</id>
   <content type="html">&lt;p&gt;I refer to &lt;code&gt;counsel-describe-variable&lt;/code&gt; here, which you can get from
the MELPA &lt;code&gt;counsel&lt;/code&gt; package, or from
&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;Github&lt;/a&gt;. If you&amp;#39;re not familiar, &lt;code&gt;counsel&lt;/code&gt; contains specialized functions using &lt;code&gt;ivy-mode&lt;/code&gt; completion. Being specialized means that you can do more than usual, for instance here are the exit points of &lt;code&gt;counsel-describe-variable&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;RET&lt;/kbd&gt; calls &lt;code&gt;describe-variable&lt;/code&gt;: a plain &lt;code&gt;describe-variable&lt;/code&gt; with &lt;code&gt;ivy-mode&lt;/code&gt; on
looks like &lt;code&gt;counsel-describe-variable&lt;/code&gt;, but has only this exit point.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-.&lt;/kbd&gt; calls &lt;code&gt;counsel-find-symbol&lt;/code&gt;: jump to symbol declaration.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-,&lt;/kbd&gt; calls &lt;code&gt;counsel--info-lookup-symbol&lt;/code&gt;: jump to symbol reference in &lt;code&gt;*Info*&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These can also be extended by binding new commands in &lt;code&gt;counsel-describe-map&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I&amp;#39;ll just describe one useful scenario that happened just now. I was working on &lt;a href=&quot;http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20754&quot;&gt;a &lt;code&gt;checkdoc.el&lt;/code&gt; change&lt;/a&gt;
and was testing it with &lt;code&gt;avy.el&lt;/code&gt;. And I got a few style warnings for this code, which I got from a &lt;a href=&quot;https://github.com/abo-abo/avy/pull/59&quot;&gt;contributor&lt;/a&gt; (thanks for the code btw):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-translate-char-function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;identity&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Function to translate user input key. This can be useful for&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;adding mirror key. E.g. one can make SPACE an alternative of &amp;#39;a&amp;#39;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;by adding:&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;\(setq avy-translate-char-function&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;      (lambda (c) (if (= c 32) ?a c)))&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;to allow typing SPACE instead of character &amp;#39;a&amp;#39; to jump to the location&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;highlighted by &amp;#39;a&amp;#39;.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;One of the warnings that &lt;code&gt;avy-translate-char-function&lt;/code&gt; should be quoted while inside the docstring like so:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`avy-translate-char-function&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Of course that wouldn&amp;#39;t play well with &lt;code&gt;setq&lt;/code&gt;, so I wanted to see if
any other variables that end in &lt;code&gt;-function&lt;/code&gt; provide an example of use
like here, and, if so, how they quote.&lt;/p&gt;

&lt;p&gt;This is my &lt;a href=&quot;https://github.com/abo-abo/oremacs/blob/github/oleh/keys.el&quot;&gt;personal configuration&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f1&amp;gt; v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-describe-variable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So I did &lt;kbd&gt;&amp;lt;f1&amp;gt; v&lt;/kbd&gt; &lt;code&gt;function$&lt;/code&gt; to describe a variable that ends with &lt;code&gt;function&lt;/code&gt;.
Here, &lt;code&gt;$&lt;/code&gt; is a part of &lt;a href=&quot;http://www.emacswiki.org/emacs/RegularExpression&quot;&gt;a regular expression&lt;/a&gt;, which should be a priority to learn if you want to be a (not just) Emacs Power User.&lt;/p&gt;

&lt;p&gt;And now the key part: instead of pressing &lt;kbd&gt;RET&lt;/kbd&gt; to describe just the current candidate, I repeatedly press &lt;kbd&gt;C-M-n&lt;/kbd&gt; (&lt;code&gt;ivy-next-line-and-call&lt;/code&gt;). After each &lt;kbd&gt;C-M-n&lt;/kbd&gt;, the next candidate will be selected and the &lt;code&gt;*Help*&lt;/code&gt; window will be updated.&lt;/p&gt;

&lt;p&gt;With this trick I was able to skim through the 346 matches in seconds. The conclusion was that an example isn&amp;#39;t usually provided, with &lt;code&gt;nnmail-expiry-wait-function&lt;/code&gt; being an exemption.
In the end, I decided not to provide such an explicit example and shorten the doc to this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-translate-char-function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;identity&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Function to translate user input key into another key.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;For example, to make SPC do the same as ?a, use&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;\(lambda (c) (if (= c 32) ?a c)).&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>counsel-git-grep, in async</title>
   <link href="https://oremacs.com/2015/06/04/git-grep-ivy-2/"/>
   <updated>2015-06-04T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/06/04/git-grep-ivy-2</id>
   <content type="html">&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;

&lt;p&gt;It took me quite a while to figure out, but finally
&lt;code&gt;counsel-git-grep&lt;/code&gt;, which I&amp;#39;ve described
&lt;a href=&quot;http://oremacs.com/2015/04/19/git-grep-ivy/&quot;&gt;before&lt;/a&gt; works completely
asynchronously, which means it&amp;#39;s very fast and smooth even for huge
repositories.&lt;/p&gt;

&lt;p&gt;If you don&amp;#39;t know what &lt;code&gt;git grep&lt;/code&gt; is: it allows you to search for a
regular expression in your Git repository. In a way, it&amp;#39;s just a
&lt;code&gt;find&lt;/code&gt; / &lt;code&gt;grep&lt;/code&gt; combo, but very concise and fast.  It&amp;#39;s particularly
great for finding all uses and references to a symbol.&lt;/p&gt;

&lt;p&gt;It can be useful even for non-programmers. One great application is to
stick all your org-mode files into a Git repository. Then you can
search all your files at once very fast: all my org stuff takes more
than 1000,000 lines and there&amp;#39;s no lag while searching. I really
should remove some pdfs from the repository at some point.&lt;/p&gt;

&lt;h2 id=&quot;the-video-demo&quot;&gt;The Video Demo&lt;/h2&gt;

&lt;p&gt;Check out the speed and the various command in this &lt;a href=&quot;https://www.youtube.com/watch?v=OEmXQNS7ofo&quot;&gt;Video Demo&lt;/a&gt;. Each key stroke starts two asynchronous shell calls, while canceling the current ones if they are still running.  Here are the example calls:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;$ git --no-pager grep --full-name -n --no-color &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    -i -e &lt;span class=&quot;s2&quot;&gt;&amp;quot;forward-line 1&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; head -n &lt;span class=&quot;m&quot;&gt;200&lt;/span&gt;
$ git grep -i -c &lt;span class=&quot;s1&quot;&gt;&amp;#39;forward-line 1&amp;#39;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; sed &lt;span class=&quot;s1&quot;&gt;&amp;#39;s/.*:\\(.*\\)/\\1/g&amp;#39;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; awk &lt;span class=&quot;s1&quot;&gt;&amp;#39;{s+=$1} END {print s}&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;the-elisp-side&quot;&gt;The Elisp side&lt;/h2&gt;

&lt;p&gt;I figure since I was interested in this topic, probably a few more people are as well.
So I&amp;#39;ll explain below how async processing is done (in this case):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel--gg-count&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;regex&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;&amp;amp;optional&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;no-async&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Quickly count the amount of git grep REGEX matches.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;When NO-ASYNC is non-nil, do it synchronously.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel--git-grep-dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cmd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;git grep -i -c &amp;#39;%s&amp;#39;&amp;quot;&lt;/span&gt;
                             &lt;span class=&quot;nv&quot;&gt;regex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot; | sed &amp;#39;s/.*:\\(.*\\)/\\1/g&amp;#39;&amp;quot;&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot; | awk &amp;#39;{s+=$1} END {print s}&amp;#39;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;counsel-ggc-process&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; *counsel-gg-count*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;no-async&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-to-number&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;shell-command-to-string&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-process&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-ggc-process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;buff&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-buffer&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-ggc-process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete-process&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;buff&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;kill-buffer&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;buff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;start-process-shell-command&lt;/span&gt;
                    &lt;span class=&quot;nv&quot;&gt;counsel-ggc-process&lt;/span&gt;
                    &lt;span class=&quot;nv&quot;&gt;counsel-ggc-process&lt;/span&gt;
                    &lt;span class=&quot;nv&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set-process-sentinel&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt;
         &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;process&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;event&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;finished\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;with-current-buffer&lt;/span&gt;
                   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;process-buffer&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--full-length&lt;/span&gt;
                       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-to-number&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy--insert-minibuffer&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy--format&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--all-candidates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Since we&amp;#39;re calling a shell command, it&amp;#39;s important to set &lt;code&gt;default-directory&lt;/code&gt; to a proper value: the shell command will be run there.&lt;/li&gt;
&lt;li&gt;The output from the process will be channeled into a buffer. I start the buffer name with a space to make it hidden: it will not be shown in the buffer list and &lt;code&gt;switch-to-buffer&lt;/code&gt; completion.&lt;/li&gt;
&lt;li&gt;I leave the sync option and use &lt;code&gt;shell-command-to-string&lt;/code&gt; for that. Sometimes it&amp;#39;s necessary to know the amount of candidates without a delay.&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;get-process&lt;/code&gt; and &lt;code&gt;get-buffer&lt;/code&gt; return something it means that the shell command is still running from the previous input. But the input has changed and that data has become useless, so I kill both the process and the buffer.&lt;/li&gt;
&lt;li&gt;Then I start a new process with &lt;code&gt;start-process-shell-command&lt;/code&gt;- a convenience wrapper around the basic &lt;code&gt;start-process&lt;/code&gt; that&amp;#39;s useful for passing a full shell command with arguments.&lt;/li&gt;
&lt;li&gt;Finally, I let &lt;code&gt;counsel--gg-count&lt;/code&gt; return without waiting for &lt;code&gt;git grep&lt;/code&gt; to finish. But something needs to be done when it finishes, so I use &lt;code&gt;set-process-sentinel&lt;/code&gt;. Emacs will call my lambda when there&amp;#39;s a new event from the process.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;To check out the new stuff, just install or upgrade &lt;code&gt;counsel&lt;/code&gt; from MELPA. Or clone &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;the source&lt;/a&gt;. I hope that my Elisp explanations were useful, async stuff is awesome, and I hope to see more of it in future Emacs packages.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>lispy 0.26.0 is out</title>
   <link href="https://oremacs.com/2015/05/29/lispy-0.26.0/"/>
   <updated>2015-05-29T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/05/29/lispy-0.26.0</id>
   <content type="html">&lt;p&gt;Lispy 0.25.0 came out 2 months ago; 177 commits later, comes version
0.26.0.  The release notes are stored
&lt;a href=&quot;https://github.com/abo-abo/lispy/releases/tag/0.26.0&quot;&gt;at Github&lt;/a&gt;, and
I&amp;#39;ll post them here as well.&lt;/p&gt;

&lt;p&gt;The coolest changes are the new reader-based &lt;kbd&gt;M&lt;/kbd&gt;, which:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gives out very pretty output, with minor diffs for actual code,
which is quite impressive considering all newline information is
discarded and then reconstructed.&lt;/li&gt;
&lt;li&gt;Works for things that Elisp can&amp;#39;t read, like &lt;code&gt;#&amp;lt;marker ...&amp;gt;&lt;/code&gt; etc, very useful for debugging.&lt;/li&gt;
&lt;li&gt;Customizable rule sets; rules for Elisp and Clojure come with the package.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The improvements to &lt;kbd&gt;g&lt;/kbd&gt; and &lt;kbd&gt;G&lt;/kbd&gt; also great:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Because of caching, the prettified tags can be displayed in less
than &lt;code&gt;0.15s&lt;/code&gt; on Emacs&amp;#39; &lt;code&gt;lisp/&lt;/code&gt; directory, which has 21256 tags in 252 files.&lt;/li&gt;
&lt;li&gt;The tags collector looks at file modification time, so you get the updated tags right after you save.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The details for these and other features follow below.&lt;/p&gt;

&lt;h2 id=&quot;fixes&quot;&gt;Fixes&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-k&lt;/kbd&gt; should delete the whole multi-line string.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;y&lt;/kbd&gt; should work for all parens, not just &lt;code&gt;(&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;p&lt;/kbd&gt; should actually eval in other window for &lt;code&gt;dolist&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Prevent pairs inserting an extra space when at minibuffer start.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;ol&lt;/kbd&gt; works properly for active region.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New Features&lt;/h2&gt;

&lt;h3 id=&quot;misc&quot;&gt;Misc&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;xf&lt;/kbd&gt; will pretty-print the macros for Elisp.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-m&lt;/kbd&gt; works better when before &lt;code&gt;)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Fix &lt;kbd&gt;&amp;#39;&lt;/kbd&gt;, &lt;kbd&gt;^&lt;/kbd&gt; after a &lt;code&gt;,&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Improve &lt;kbd&gt;/&lt;/kbd&gt; (splice) for quoted regions.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Z&lt;/kbd&gt; works with &lt;code&gt;&amp;amp;key&lt;/code&gt; arguments.&lt;/li&gt;
&lt;li&gt;The new &lt;kbd&gt;M&lt;/kbd&gt; is used in &lt;kbd&gt;xf&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;Allow to flatten Elisp &lt;code&gt;defsubst&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;c&lt;/kbd&gt; should insert an extra newline for top-level sexps.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;paredit-key-bindings&quot;&gt;Paredit key bindings&lt;/h3&gt;

&lt;p&gt;You can have only Paredit + special key bindings by using this composition of key themes:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-set-key-theme&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;special&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;paredit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The default setting is:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-set-key-theme&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;special&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c-digits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;new-algorithm-for-multi-lining&quot;&gt;New algorithm for multi-lining&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;M&lt;/kbd&gt; is now bound to &lt;code&gt;lispy-alt-multiline&lt;/code&gt; instead of
&lt;code&gt;lispy-multiline&lt;/code&gt;.  It has a much better and more customizable
algorithm.&lt;/p&gt;

&lt;p&gt;See these variables for customization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lispy-multiline-threshold&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lispy--multiline-take-3&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lispy--multiline-take-3-arg&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lispy--multiline-take-2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lispy--multiline-take-2-arg&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They are set to reasonable defaults. But you can customize them if you feel that a particular form should be multi-lined in a different way.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lispy-multiline-threshold&lt;/code&gt; is a bit of ad-hoc to make things nice. Set this to nil if you want a completely rigorous multi-line. With the default setting of 32, expressions shorter than this won&amp;#39;t be multi-lined. This makes 95% of the code look really good.&lt;/p&gt;

&lt;p&gt;The algorithm has a safety check implemented for Elisp: if &lt;code&gt;read&lt;/code&gt; on the transformed expression returns something different than &lt;code&gt;read&lt;/code&gt; on the original expression, an error will be signaled and no change will be made. For expressions that can&amp;#39;t be &lt;code&gt;read&lt;/code&gt;, like buffers/markers/windows/cyclic lists/overlays, only a warning will be issued (&lt;code&gt;lispy&lt;/code&gt; can read them, unlike &lt;code&gt;read&lt;/code&gt;).&lt;/p&gt;

&lt;h3 id=&quot;d-and-give-priority-to-lispy-right&quot;&gt;&lt;kbd&gt;d&lt;/kbd&gt; and &lt;kbd&gt;&amp;gt;&lt;/kbd&gt; give priority to &lt;code&gt;lispy-right&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;For the expression &lt;code&gt;(a)|(b)&lt;/code&gt;, &lt;code&gt;(a)&lt;/code&gt; will be considered the sexp at point, instead of &lt;code&gt;(b)&lt;/code&gt;. This is consistent with &lt;code&gt;show-paren-mode&lt;/code&gt;.  If a space is present, all ambiguities are resolved anyway.&lt;/p&gt;

&lt;h3 id=&quot;b-works-fine-even-if-the-buffer-changes&quot;&gt;&lt;kbd&gt;b&lt;/kbd&gt; works fine even if the buffer changes&lt;/h3&gt;

&lt;p&gt;I&amp;#39;ve switched the point and mark history to markers instead of points. When the buffer is changed, the markers are updated, so &lt;kbd&gt;b&lt;/kbd&gt; will work fine.&lt;/p&gt;

&lt;h3 id=&quot;extend-clojure-reader&quot;&gt;Extend Clojure reader&lt;/h3&gt;

&lt;p&gt;In order for &lt;kbd&gt;i&lt;/kbd&gt; (prettify code) to work for Clojure, it must be able to read the current expression. I&amp;#39;ve been extending the Elisp reader to understand Clojure.  In the past commits, support was added for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;empty sets&lt;/li&gt;
&lt;li&gt;commas&lt;/li&gt;
&lt;li&gt;auto-symbols, like &lt;code&gt;p1__7041#&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;extend-elisp-reader&quot;&gt;Extend Elisp reader&lt;/h3&gt;

&lt;p&gt;It should be possible to read any &lt;code&gt;#&amp;lt;...&amp;gt;&lt;/code&gt; form, as well as &lt;code&gt;#1&lt;/code&gt;-type forms.&lt;/p&gt;

&lt;h3 id=&quot;g-and-g-get-a-persistent-action-for-ivy&quot;&gt;&lt;kbd&gt;g&lt;/kbd&gt; and &lt;kbd&gt;G&lt;/kbd&gt; get a persistent action for &lt;code&gt;ivy&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is a powerful feature that the &lt;code&gt;helm&lt;/code&gt; back end has had for a long time.  When you press &lt;kbd&gt;g&lt;/kbd&gt;, &lt;kbd&gt;C-n&lt;/kbd&gt; and &lt;kbd&gt;C-p&lt;/kbd&gt; will change the current selection.  But &lt;kbd&gt;C-M-n&lt;/kbd&gt; and &lt;kbd&gt;C-M-p&lt;/kbd&gt; will change the current selection &lt;em&gt;and&lt;/em&gt; move there, without exiting the completion.&lt;/p&gt;

&lt;p&gt;This also means that you can call &lt;code&gt;ivy-resume&lt;/code&gt; to resume either &lt;kbd&gt;g&lt;/kbd&gt; (&lt;code&gt;lispy-goto&lt;/code&gt;) or
&lt;kbd&gt;G&lt;/kbd&gt; (&lt;code&gt;lispy-goto-local&lt;/code&gt;).&lt;/p&gt;

&lt;h3 id=&quot;e-works-with-defvar-local&quot;&gt;&lt;kbd&gt;e&lt;/kbd&gt; works with &lt;code&gt;defvar-local&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;As you might know, the regular &lt;kbd&gt;C-x C-e&lt;/kbd&gt; or &lt;code&gt;eval-buffer&lt;/code&gt; will not reset the values of &lt;code&gt;defvar&lt;/code&gt;, &lt;code&gt;defcustom&lt;/code&gt; and such (you need &lt;kbd&gt;C-M-x&lt;/kbd&gt; instead). But &lt;kbd&gt;e&lt;/kbd&gt; does it, now also for &lt;code&gt;defvar-local&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;improve-faces-for-dark-backgrounds&quot;&gt;Improve faces for dark backgrounds&lt;/h3&gt;

&lt;p&gt;I normally use a light background, so I didn&amp;#39;t notice before that the faces looked horrible with a dark background.&lt;/p&gt;

&lt;h3 id=&quot;the-will-quote-the-region&quot;&gt;The &lt;kbd&gt;&amp;#96;&lt;/kbd&gt; will quote the region&lt;/h3&gt;

&lt;p&gt;If you have a region selected, pressing &lt;kbd&gt;&amp;#96;&lt;/kbd&gt; will result in:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;`symbol&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;customize-the-file-selection-back-end-for-v&quot;&gt;Customize the file selection back end for &lt;kbd&gt;V&lt;/kbd&gt;&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;V&lt;/kbd&gt; (&lt;code&gt;lispy-visit&lt;/code&gt;) allows to open a file in current project. Previously, it used &lt;code&gt;projectile&lt;/code&gt;.
Now it uses &lt;code&gt;find-file-in-project&lt;/code&gt; by default, with the option to customize to &lt;code&gt;projectile&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;fixup-calls-to-looking-back&quot;&gt;Fixup calls to &lt;code&gt;looking-back&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Apparently, &lt;code&gt;looking-back&lt;/code&gt; isn&amp;#39;t very efficient, so it&amp;#39;s preferable to avoid it or at least add a search bound to improve efficiency. Also the bound became mandatory in 25, while it was optional before.&lt;/p&gt;

&lt;h3 id=&quot;m-m-will-work-better-in-strings-and-comments&quot;&gt;&lt;kbd&gt;M-m&lt;/kbd&gt; will work better in strings and comments.&lt;/h3&gt;

&lt;p&gt;See the relevant test:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-with&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;See &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`plu|mage&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.\&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-m&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;See ~&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`plumage&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;|.\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Thanks to this, to e.g. get the value of a quoted var in a docstring or a comment, or jump to its definition, you can &lt;kbd&gt;M-m&lt;/kbd&gt;. Then, you can step-in with &lt;kbd&gt;i&lt;/kbd&gt; to select the symbol without quotes.&lt;/p&gt;

&lt;h3 id=&quot;update-the-tags-strategy&quot;&gt;Update the tags strategy&lt;/h3&gt;

&lt;p&gt;A much better algorithm with caching an examining of file modification time is used now.  This means that the tags should be up-to-date 99% of the time, even immediately after a save, and no necessary re-parsing will be done. And it all works fine with the &lt;code&gt;lispy-tag-arity&lt;/code&gt; modifications.&lt;/p&gt;

&lt;p&gt;1% of the time, &lt;code&gt;lispy-tag-arity&lt;/code&gt; stops working, I don&amp;#39;t know why, since it&amp;#39;s hard to reproduce. You can then pass a prefix arg to refresh tags bypassing the cache, e.g &lt;kbd&gt;2g&lt;/kbd&gt; or &lt;kbd&gt;2G&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Also a bug is fixed in Clojure tag navigation, where the tag start positions were off by one char.&lt;/p&gt;

&lt;p&gt;The fetched tags retrieval is fast: less than &lt;code&gt;0.15s&lt;/code&gt; on Emacs&amp;#39;
&lt;code&gt;lisp/&lt;/code&gt; directory to retrieve 21256 tags from 252 files.  Which means
it&amp;#39;s lightning fast on smaller code bases (&lt;code&gt;lispy&lt;/code&gt; has only 651 tags).&lt;/p&gt;

&lt;h3 id=&quot;xj-can-also-step-into-macros&quot;&gt;&lt;kbd&gt;xj&lt;/kbd&gt; can also step into macros&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;lispy-debug-step-in&lt;/code&gt;, bound to &lt;kbd&gt;xj&lt;/kbd&gt; locally and &lt;kbd&gt;C-x C-j&lt;/kbd&gt; globally can now step into macros, as well as into functions. This command is very useful for Edebug-less debugging.  Stepping into macros with &lt;code&gt;&amp;amp;rest&lt;/code&gt; parameters should work fine as well.&lt;/p&gt;

&lt;h3 id=&quot;p-can-now-lax-eval-function-and-macro-arguments&quot;&gt;&lt;kbd&gt;p&lt;/kbd&gt; can now lax-eval function and macro arguments&lt;/h3&gt;

&lt;p&gt;When positioned at function or macro args, &lt;kbd&gt;p&lt;/kbd&gt; will set them as if the function or macro was called with empty args, or the appropriate amount of nils. If the function is interned and interactive, use its interactive form to set the arguments appropriately.&lt;/p&gt;

&lt;p&gt;Again, this is very useful for debugging.&lt;/p&gt;

&lt;h3 id=&quot;allow-to-paste-anywhere-in-the-list-using-a-numeric-arg&quot;&gt;Allow to paste anywhere in the list using a numeric arg&lt;/h3&gt;

&lt;p&gt;As you might know, &lt;kbd&gt;P&lt;/kbd&gt; (&lt;code&gt;lispy-paste&lt;/code&gt;) is a powerful command that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replaces selection with current kill when the region is active.&lt;/li&gt;
&lt;li&gt;Yanks the current kill before or after the current list otherwise.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Yank the current kill to become the second element of the list with &lt;kbd&gt;2P&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;Yank the current kill to become the third element of the list with &lt;kbd&gt;3P&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It&amp;#39;s OK to pass a larger arg than the length of the current list. In
that case, the paste will be made into the last element of the list.&lt;/p&gt;

&lt;h3 id=&quot;update-the-way-lispy-splice-works&quot;&gt;Update the way &lt;kbd&gt;/&lt;/kbd&gt; (&lt;code&gt;lispy-splice&lt;/code&gt;) works&lt;/h3&gt;

&lt;p&gt;When there&amp;#39;s no next element within parent, jump to parent from
appropriate side. When the region is active, don&amp;#39;t deactivate it. When
splicing region, remove random quotes at region bounds.&lt;/p&gt;

&lt;p&gt;This change makes the splice a lot more manageable. For example,
starting with this Clojure code, with &lt;code&gt;|&lt;/code&gt; marking the current point:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;defn &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;read-resource&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Read a resource into a string&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read-string&lt;/span&gt;
   &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;slurp &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;clojure.java.io/resource&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A double splice &lt;kbd&gt;//&lt;/kbd&gt; will result in:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;defn &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;read-resource&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Read a resource into a string&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read-string&lt;/span&gt;
   &lt;span class=&quot;nb&quot;&gt;slurp &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;clojure.java.io/resource&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After &lt;kbd&gt;xR&lt;/kbd&gt; (reverse list), &lt;kbd&gt;2 SPC&lt;/kbd&gt; (same as
&lt;kbd&gt;C-f&lt;/kbd&gt;), &lt;code&gt;-&amp;gt;&lt;/code&gt; (plain insert),
&lt;kbd&gt;[M&lt;/kbd&gt; (back to parent and multi-line), the final result:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;defn &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;read-resource&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Read a resource into a string&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;-&amp;gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;clojure.java.io/resource&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;slurp&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;read-string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This also shows off &lt;kbd&gt;xR&lt;/kbd&gt; - &lt;code&gt;lispy-reverse&lt;/code&gt;, which reverses
the current list.  Finally, reverting from the last code to the
initial one can be done simply with &lt;kbd&gt;xf&lt;/kbd&gt; - it will flatten
the &lt;code&gt;-&amp;gt;&lt;/code&gt; macro call.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Thanks to all who contributed, enjoy the new stuff. Would also be nice
to get some more feedback and bug reports. Currently, it might seem
that a large part of the features are either perfect or unused.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy-mode 0.5.0 is out</title>
   <link href="https://oremacs.com/2015/05/23/swiper-0.5.0/"/>
   <updated>2015-05-23T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/05/23/swiper-0.5.0</id>
   <content type="html">&lt;p&gt;At this point, &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt; is only a
fraction of &lt;code&gt;ivy-mode&lt;/code&gt;&amp;#39;s functionality.  Still, it&amp;#39;s nice to keep them
all, together with &lt;a href=&quot;http://melpa.org/#/counsel&quot;&gt;counsel&lt;/a&gt;, in a single
repository: &lt;code&gt;counsel-git-grep&lt;/code&gt; works much better this way.&lt;/p&gt;

&lt;p&gt;Anyway, I&amp;#39;ll echo &lt;a href=&quot;https://github.com/abo-abo/swiper/releases/tag/0.5.0&quot;&gt;the release notes&lt;/a&gt; here, there are quite a few exciting new features.&lt;/p&gt;

&lt;h2 id=&quot;fixes&quot;&gt;Fixes&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;TAB&lt;/kbd&gt; shouldn&amp;#39;t delete input when there&amp;#39;s no candidate.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;TAB&lt;/kbd&gt; should switch directories properly.&lt;/li&gt;
&lt;li&gt;require &lt;code&gt;dired&lt;/code&gt; when completing file names, so that the directory face is loaded.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;TAB&lt;/kbd&gt; should work with &lt;code&gt;confirm-nonexistent-file-or-buffer&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;TAB&lt;/kbd&gt; should handle empty input.&lt;/li&gt;
&lt;li&gt;work around &lt;code&gt;grep-read-files&lt;/code&gt;: it should be possible to simply &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;rgrep&lt;/code&gt; &lt;kbd&gt;RET RET RET&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;Fix the transition from a bad regex to a good one - you can input a bad regex to get 0 candidates, the candidates come back once the regex is fixed.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-switch-buffer&lt;/code&gt; should pre-select &lt;code&gt;other-buffer&lt;/code&gt; just like &lt;code&gt;switch-buffer&lt;/code&gt; does it.&lt;/li&gt;
&lt;li&gt;Fix selecting &amp;quot;C:\&amp;quot; on Windows.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-git-grep&lt;/code&gt; should warn if not in a repository.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-M-n&lt;/kbd&gt; shouldn&amp;#39;t try to call action if there isn&amp;#39;t one.&lt;/li&gt;
&lt;li&gt;Turn on sorting for &lt;code&gt;counsel-info-lookup-symbol&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-read&lt;/code&gt; should check for an outdated cons initial-input.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New Features&lt;/h2&gt;

&lt;h3 id=&quot;out-of-order-matching&quot;&gt;Out of order matching&lt;/h3&gt;

&lt;p&gt;I actually like in-order matching, meaning the input &amp;quot;in ma&amp;quot; will match &amp;quot;in-order matching&amp;quot;, but not &amp;quot;made in&amp;quot;. But the users can switch to out-of-order matching if they use this code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-re-builders-alist&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy--regex-ignore-order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;ivy-re-builders-alist&lt;/code&gt; is the flexible way to customize the regex builders per-collection.  Using &lt;code&gt;t&lt;/code&gt; here, means to use this regex builder for everything. You could choose to have in-order for files, and out-of-order for buffers and so on.&lt;/p&gt;

&lt;h3 id=&quot;new-defcustom-ivy-tab-space&quot;&gt;New defcustom: &lt;code&gt;ivy-tab-space&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Use this to have a space inserted each time you press &lt;kbd&gt;TAB&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-tab-space&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;ignore-case-for-tab&quot;&gt;ignore case for TAB&lt;/h3&gt;

&lt;p&gt;&amp;quot;pub&amp;quot; can expand to &amp;quot;Public License&amp;quot;.&lt;/p&gt;

&lt;h3 id=&quot;new-command-counsel-load-library&quot;&gt;New command: &lt;code&gt;counsel-load-library&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This command is much better than the standard &lt;code&gt;load-libary&lt;/code&gt; that it
upgrades.  It applies a sort of &lt;code&gt;uniquify&lt;/code&gt; effect to all your
libraries, which is very useful:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://cloud.githubusercontent.com/assets/2937359/7783947/7da9395e-0154-11e5-86cd-45d38c0f2c17.png&quot; alt=&quot;counsel-load-library&quot;&gt;&lt;/p&gt;

&lt;p&gt;In this case, I have &lt;code&gt;avy&lt;/code&gt; installed both from the package manager and
manually. I can easily distinguish them.&lt;/p&gt;

&lt;p&gt;Another cool feature is that instead of using &lt;code&gt;find-library&lt;/code&gt; (which is
also bad, since it would report two versions of &lt;code&gt;avy&lt;/code&gt; with the same
name and no way to distinguish them), you can simply use
&lt;code&gt;counsel-load-library&lt;/code&gt; and type &lt;kbd&gt;C-.&lt;/kbd&gt; instead of
&lt;kbd&gt;RET&lt;/kbd&gt; to finalize.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s another scenario: first load the library, then call
&lt;code&gt;ivy-resume&lt;/code&gt; and immediately open the library file.&lt;/p&gt;

&lt;h3 id=&quot;new-command-ivy-partial&quot;&gt;New command: &lt;code&gt;ivy-partial&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Does a partial complete without exiting. Use this code to replace
&lt;code&gt;ivy-partial-or-done&lt;/code&gt; with this command:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-minibuffer-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;TAB&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-partial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;allow-to-use-in-swiper&quot;&gt;Allow to use &lt;code&gt;^&lt;/code&gt; in &lt;code&gt;swiper&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;In regex terms, &lt;code&gt;^&lt;/code&gt; is the beginning of line. You can now use this in
&lt;code&gt;swiper&lt;/code&gt; to filter your matches.&lt;/p&gt;

&lt;h3 id=&quot;new-command-swiper-avy&quot;&gt;New command: &lt;code&gt;swiper-avy&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This command is crazy good: it combines the best features of &lt;code&gt;swiper&lt;/code&gt;
(all buffer an once, flexible input length) and &lt;code&gt;avy&lt;/code&gt; (quickly select
one candidate once you&amp;#39;ve narrowed to about 10-20 candidates).&lt;/p&gt;

&lt;p&gt;For instance, I can enter &amp;quot;to&amp;quot; into &lt;code&gt;swiper&lt;/code&gt; to get around 10 matches.  Instead of using &lt;kbd&gt;C-n&lt;/kbd&gt; a bunch of times to select the one of 10 that I want, I just press &lt;kbd&gt;C-&amp;#39;&lt;/kbd&gt;, followed by &lt;kbd&gt;a&lt;/kbd&gt; or &lt;kbd&gt;s&lt;/kbd&gt; or &lt;kbd&gt;d&lt;/kbd&gt; ... to select one of the matches visible on screen.&lt;/p&gt;

&lt;p&gt;So both packages use their best feature to cover up the others worst drawback.&lt;/p&gt;

&lt;h3 id=&quot;add-support-for-virtual-buffers&quot;&gt;Add support for virtual buffers&lt;/h3&gt;

&lt;p&gt;I was never a fan of &lt;code&gt;recentf&lt;/code&gt; until now. The virtual buffers feature works in the same way as &lt;code&gt;ido-use-virtual-buffers&lt;/code&gt;: when you call &lt;code&gt;ivy-switch-buffer&lt;/code&gt;, your recently visited files as well as all your bookmarks are appended to the end of the buffer list.&lt;/p&gt;

&lt;p&gt;Suppose you killed a buffer and want to bring it back: now you do it as if you didn&amp;#39;t kill the buffer and instead buried it. The bookmarks access is also nice.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s how to configure it, along with some customization of &lt;code&gt;recentf&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-use-virtual-buffers&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;use-package&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;recentf&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:config&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;recentf-exclude&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;COMMIT_MSG&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;COMMIT_EDITMSG&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;github.*txt$&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;&amp;quot;.*png$&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;recentf-max-saved-items&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;add-a-few-wrapper-commands-for-the-minibuffer&quot;&gt;Add a few wrapper commands for the minibuffer&lt;/h3&gt;

&lt;p&gt;All these commands just forward to their built-in counterparts, only trying not to exit the first line of the minibuffer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-DEL&lt;/kbd&gt; calls &lt;code&gt;ivy-backward-kill-word&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-d&lt;/kbd&gt; calls &lt;code&gt;ivy-delete-char&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-d&lt;/kbd&gt; calls &lt;code&gt;ivy-kill-word&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-f&lt;/kbd&gt; calls &lt;code&gt;ivy-forward-char&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;allow-to-customize-the-minibuffer-formatter&quot;&gt;Allow to customize the minibuffer formatter&lt;/h3&gt;

&lt;p&gt;See &lt;a href=&quot;https://github.com/abo-abo/swiper/wiki/Customize-candidate-menu-style&quot;&gt;the wiki&lt;/a&gt; on how to customize
the minibuffer display to look like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;100 Find file: ~/
  file1
  file2
&amp;gt; file3
  file4
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;when-completing-file-names-tab-should-defer-to-minibuffer-complete&quot;&gt;When completing file names, &lt;kbd&gt;TAB&lt;/kbd&gt; should defer to &lt;code&gt;minibuffer-complete&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Thanks to this, you can &lt;kbd&gt;TAB&lt;/kbd&gt;-complete your ssh hosts, e.g.:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/ss&lt;/code&gt; &lt;kbd&gt;TAB&lt;/kbd&gt; -&amp;gt; &lt;code&gt;/ssh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/ssh:ol&lt;/code&gt; &lt;kbd&gt;TAB&lt;/kbd&gt; -&amp;gt; &lt;code&gt;/ssh:oleh@&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;more-commands-work-with-ivy-resume&quot;&gt;More commands work with &lt;code&gt;ivy-resume&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;I&amp;#39;ve added:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-git-grep&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-git&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Others (that start with &lt;code&gt;counsel-&lt;/code&gt;) should work fine as well. Also don&amp;#39;t forget that you can use &lt;kbd&gt;C-M-n&lt;/kbd&gt; and &lt;kbd&gt;C-M-p&lt;/kbd&gt; to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;switch candidate&lt;/li&gt;
&lt;li&gt;call the action for the candidate&lt;/li&gt;
&lt;li&gt;stay in the minibuffer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is especially powerful for &lt;code&gt;counsel-git-grep&lt;/code&gt;: you can easily check the whole repository for something with just typing in the query and holding &lt;kbd&gt;C-M-n&lt;/kbd&gt;. The matches will be highlighted &lt;code&gt;swiper&lt;/code&gt;-style, of course.&lt;/p&gt;

&lt;h3 id=&quot;allow-to-recenter-during-counsel-git-grep&quot;&gt;Allow to recenter during &lt;code&gt;counsel-git-grep&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Use &lt;kbd&gt;C-l&lt;/kbd&gt; to recenter.&lt;/p&gt;

&lt;h3 id=&quot;update-the-quoting-of-spaces&quot;&gt;Update the quoting of spaces&lt;/h3&gt;

&lt;p&gt;Split only on single spaces, from all other space groups, remove one space.&lt;/p&gt;

&lt;p&gt;As you might know, a space is used in place of &lt;code&gt;.*&lt;/code&gt; in &lt;code&gt;ivy&lt;/code&gt;. In case
you want an actual space, you can now quote them even easier.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Thanks to all who contributed, check out the new stuff, and make sure
to bind &lt;code&gt;ivy-resume&lt;/code&gt; to something short: it has become a really nice
feature.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New on MELPA - define word at point</title>
   <link href="https://oremacs.com/2015/05/22/define-word/"/>
   <updated>2015-05-22T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/05/22/define-word</id>
   <content type="html">&lt;p&gt;Doing things in Emacs is &lt;em&gt;superlatively&lt;/em&gt; better than having to switch
to another application.&lt;/p&gt;

&lt;p&gt;In this case, &amp;quot;doing things&amp;quot; is getting the dictionary definition of
word at point, and &amp;quot;&lt;em&gt;superlatively&lt;/em&gt;&amp;quot; is a word that I didn&amp;#39;t know - a
straw that broke the camel&amp;#39;s back and caused me to finally automate
the process of getting the definition of a word that I encounter in an
Emacs buffer.&lt;/p&gt;

&lt;p&gt;The whole process of writing the &lt;code&gt;define-word&lt;/code&gt; package took around 30
minutes, I just had to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;See which engine DuckDuckGo uses.&lt;/li&gt;
&lt;li&gt;Follow to &lt;a href=&quot;https://www.wordnik.com/words/superlative&quot;&gt;wordnik&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Try to get an API key, read their draconian TOS and decide that I don&amp;#39;t want
to agree to it just to get their key.&lt;/li&gt;
&lt;li&gt;Examine the HTML that it returns and note that it&amp;#39;s quite regular.&lt;/li&gt;
&lt;li&gt;Write a 10 line function with &lt;code&gt;re-search-forward&lt;/code&gt; to extract the word
definitions from a sample page that I saved with &lt;code&gt;wget&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then just wrap the function in an &lt;code&gt;url-retrieve&lt;/code&gt; and done.  It&amp;#39;s a
good thing that I learned to use &lt;code&gt;url-retrieve&lt;/code&gt; when I wrote
&lt;a href=&quot;https://github.com/abo-abo/org-download&quot;&gt;org-download&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s how it looks like in action, the word under point is &amp;quot;Authors&amp;quot;
and instead of visiting
&lt;a href=&quot;https://www.wordnik.com/words/authors&quot;&gt;this page&lt;/a&gt;, you can see it
right away in your Echo Area:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/wiki/abo-abo/define-word/images/define-word.png&quot; alt=&quot;demo&quot;&gt;&lt;/p&gt;

&lt;p&gt;The result is displayed simply with &lt;code&gt;message&lt;/code&gt;, so it doesn&amp;#39;t mess with
your window config.  You read it, press any key and the Echo Area
popup will vanish automatically.&lt;/p&gt;

&lt;p&gt;Install the package from MELPA or check it out at &lt;a href=&quot;https://github.com/abo-abo/define-word&quot;&gt;github&lt;/a&gt;.
You just need to decide where to bind it:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c d&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;define-word-at-point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c D&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;define-word&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;At less than 50 lines, the source is very easy to understand. So if
you&amp;#39;re looking to write some Elisp that retrieves and parses some HTML
from a web service, it&amp;#39;s nice to look at a simple implementation of
how it&amp;#39;s done.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New in Emacs - run checkdoc in batch mode</title>
   <link href="https://oremacs.com/2015/05/19/checkdoc-batch/"/>
   <updated>2015-05-19T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/05/19/checkdoc-batch</id>
   <content type="html">&lt;h2 id=&quot;more-checkdoc-goodness&quot;&gt;More &lt;code&gt;checkdoc&lt;/code&gt; goodness&lt;/h2&gt;

&lt;p&gt;If you&amp;#39;re doing some Elisp coding, you should definitely check out the
built-in &lt;code&gt;checkdoc&lt;/code&gt; command. Too bad it&amp;#39;s (was) interactive-only. With
a small modification, I&amp;#39;ve made it suitable for batch.&lt;/p&gt;

&lt;p&gt;You can check out how I did it in the
&lt;a href=&quot;https://github.com/abo-abo/avy&quot;&gt;avy&lt;/a&gt; (or
&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;) repository. Here&amp;#39;s my
&lt;code&gt;compile&lt;/code&gt; target in the Makefile:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Makefile&quot; data-lang=&quot;Makefile&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emacs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?=&lt;/span&gt; emacs

&lt;span class=&quot;nf&quot;&gt;compile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;emacs&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -batch -l targets/avy-init.el
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here are the contents of avy-init.el:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;load-path&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapc&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;byte-compile-file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;avy.el&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;checkdoc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;with-current-buffer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-file&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;avy.el&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;checkdoc-current-buffer&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I made &lt;code&gt;compile&lt;/code&gt; target a dependency of the &lt;code&gt;all&lt;/code&gt; target, so with a
single &lt;code&gt;make&lt;/code&gt; I can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;run the tests&lt;/li&gt;
&lt;li&gt;check for compiler warnings&lt;/li&gt;
&lt;li&gt;check for &lt;code&gt;checkdoc&lt;/code&gt; style warnings&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;compile-over-ansi-term&quot;&gt;&lt;code&gt;compile&lt;/code&gt; over &lt;code&gt;ansi-term&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;There&amp;#39;s no reason to use &lt;code&gt;ansi-term&lt;/code&gt; (or an external shell) over
&lt;code&gt;compile&lt;/code&gt; in this case. Using &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;compile&lt;/code&gt; (or actually
&lt;kbd&gt;M-x&lt;/kbd&gt; &lt;a href=&quot;https://github.com/abo-abo/helm-make&quot;&gt;helm-make&lt;/a&gt;) I
can navigate to any compilation or style warning or failed test from
the &lt;code&gt;*compilation*&lt;/code&gt; buffer.&lt;/p&gt;

&lt;p&gt;For the lazy, it&amp;#39;s possible to jump to errors with a mouse, but
navigating errors is a breeze with this Hydra:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-error&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-g&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;goto-error&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;first-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;first&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;next&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;prev&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;recenter-top-bottom&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;recenter&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There is also
&lt;a href=&quot;https://github.com/abo-abo/ace-link&quot;&gt;ace-link-compilation&lt;/a&gt;, but I
tend not to use it often.&lt;/p&gt;

&lt;p&gt;I make good use of one of the coolest &lt;code&gt;compilation-mode&lt;/code&gt; features:
pressing &lt;kbd&gt;g&lt;/kbd&gt; will restart the compilation process.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Check out the new feature, I think it&amp;#39;s really cool. Another incentive
to try is that lately the
&lt;a href=&quot;https://savannah.gnu.org/git/?group=emacs&quot;&gt;emacs trunk&lt;/a&gt; has been
extremely stable: I&amp;#39;m on Emacs25 almost all the time now, since it
feels a lot faster.&lt;/p&gt;

&lt;p&gt;Here are my aliasing settings:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span&gt;&lt;/span&gt;$ which newemacs
/usr/local/bin/newemacs
$ readlink -f &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;which newemacs&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
/home/oleh/git/gnu-emacs/src/emacs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To run the tests with &lt;code&gt;newemacs&lt;/code&gt; instead of &lt;code&gt;emacs&lt;/code&gt; (since that&amp;#39;s the
one for which &lt;code&gt;checkdoc&lt;/code&gt; works in batch), use &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;setenv&lt;/code&gt;
-&amp;gt; &lt;code&gt;emacs&lt;/code&gt; -&amp;gt; &lt;code&gt;newemacs&lt;/code&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Free avy with your goto-line</title>
   <link href="https://oremacs.com/2015/05/17/avy-goto-line/"/>
   <updated>2015-05-17T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/05/17/avy-goto-line</id>
   <content type="html">&lt;p&gt;I have a fondness for Emacs commands and key bindings that you can
get for free.  Here, by &amp;quot;free&amp;quot; I mean customizations that don&amp;#39;t
require you to change your old workflow (i.e. unbind your old
bindings), but still get the new workflow with comfortable bindings.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For free (almost physical) keys, see my post on
&lt;a href=&quot;http://oremacs.com/2015/02/14/semi-xmodmap/&quot;&gt;xmodmap&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;See &lt;a href=&quot;http://oremacs.com/2015/05/13/ace-window-0.9.0/&quot;&gt;the last post&lt;/a&gt;
to see how you can get window manipulation commands &amp;quot;for free&amp;quot; when
you call &lt;code&gt;ace-window&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;With &lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt;, you can define
lightweight minor modes for almost free or even completely free key
bindings.&lt;/li&gt;
&lt;li&gt;With &lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;, you get list
manipulation bindings (single letters, no less) for free when your
point is positioned at a list boundary, or when the region is
active.&lt;/li&gt;
&lt;li&gt;With &lt;a href=&quot;https://github.com/abo-abo/worf&quot;&gt;worf&lt;/a&gt;, you get heading
navigation and manipulation bindings, also single-letter, when your
point is at a heading or markup start.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Today, I describe a recent addition to
&lt;a href=&quot;https://github.com/abo-abo/avy&quot;&gt;avy&lt;/a&gt;: when you call &lt;code&gt;avy-goto-line&lt;/code&gt;
and decide that you don&amp;#39;t want to use &lt;code&gt;avy-keys&lt;/code&gt; to select a line on
screen, and you want to select a line by number, you can just enter
that number.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;avy-goto-line&lt;/code&gt; will recognize that you entered a digit, and forward
to &lt;code&gt;goto-line&lt;/code&gt; with that digit already pre-entered. So basically there&amp;#39;s no disadvantage to doing this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-g g&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avy-goto-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Even if you use the &lt;code&gt;avy&lt;/code&gt; method zero times, you lose no efficiency
when compared with regular &lt;code&gt;goto-line&lt;/code&gt;, you just get a pretty
light-show with each call:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avy-goto-line.png&quot; alt=&quot;avy-goto-line.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;You can customize a lot of things in &lt;code&gt;avy&lt;/code&gt;, for instance the keys or
the way the overlays are displayed.  See the
&lt;a href=&quot;https://github.com/abo-abo/avy/wiki/defcustom&quot;&gt;new wiki page&lt;/a&gt; on
customization for more info.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ace-window 0.9.0 is out</title>
   <link href="https://oremacs.com/2015/05/13/ace-window-0.9.0/"/>
   <updated>2015-05-13T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/05/13/ace-window-0.9.0</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;https://cloud.githubusercontent.com/assets/390964/7583437/86180fa6-f895-11e4-80ef-c24a7bdf9bf6.png&quot; alt=&quot;ace-window-keys.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;I kind of forgot to tag the &lt;code&gt;0.8.0&lt;/code&gt; release on Github, so it&amp;#39;s been a
whole 3 months since the last release. In this post, I&amp;#39;ll only
describe the newest exciting feature in more detail, see
&lt;a href=&quot;http://oremacs.com/archive/&quot;&gt;the archive&lt;/a&gt; for
&lt;a href=&quot;http://oremacs.com/2015/02/27/ace-window-leading-char/&quot;&gt;older&lt;/a&gt;
&lt;a href=&quot;http://oremacs.com/2015/03/02/ace-window-without-ace/&quot;&gt;posts&lt;/a&gt;
&lt;a href=&quot;http://oremacs.com/2015/03/03/ace-window-full-path/&quot;&gt;on&lt;/a&gt;
&lt;a href=&quot;http://oremacs.com/2015/03/06/ace-window-toggle/&quot;&gt;ace&lt;/a&gt;
&lt;a href=&quot;http://oremacs.com/2015/03/12/ace-window-display-mode/&quot;&gt;window&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New Features&lt;/h2&gt;

&lt;h3 id=&quot;display-the-window-decision-chars-in-the-mode-line&quot;&gt;Display the window decision chars in the mode line&lt;/h3&gt;

&lt;p&gt;Enable &lt;code&gt;ace-window-display-mode&lt;/code&gt; for this. This gives you the
advantage of always being aware which window corresponds to which
char.&lt;/p&gt;

&lt;h3 id=&quot;new-defcustom-aw-ignore-current&quot;&gt;New defcustom: &lt;code&gt;aw-ignore-current&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is off by default. When t, &lt;code&gt;ace-window&lt;/code&gt; will ignore
&lt;code&gt;selected-window&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;allow-to-switch-the-window-action-midway&quot;&gt;Allow to switch the window action midway&lt;/h3&gt;

&lt;p&gt;Ace-window has many commands available, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ace-select-window&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ace-delete-window&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ace-swap-window&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But did you wish sometimes when you called &lt;code&gt;ace-select-window&lt;/code&gt; that
you should have called &lt;code&gt;ace-delete-window&lt;/code&gt;? In the old way, you would
cancel &lt;code&gt;ace-select-window&lt;/code&gt; with &lt;kbd&gt;C-g&lt;/kbd&gt; and call
&lt;code&gt;ace-delete-window&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;With the new way, you can, just press &lt;kbd&gt;x&lt;/kbd&gt; followed by the
decision char.  All keys are customizable through &lt;code&gt;aw-dispatch-alist&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-dispatch-alist&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;?x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-delete-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; Ace - Delete Window&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;?m&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-swap-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; Ace - Swap Window&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;?n&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-flip-window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;?v&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-split-window-vert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; Ace - Split Vert Window&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;?b&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-split-window-horz&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; Ace - Split Horz Window&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;?i&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;delete-other-windows&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; Ace - Maximize Window&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;?o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;delete-other-windows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;List of actions for &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`aw-dispatch-default&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The strings beside each command are important: they are used to update
the mode line when you press a char. They also mean that a window
should be selected using &lt;code&gt;aw-keys&lt;/code&gt; for the corresponding command. If
there&amp;#39;s no string, the command is just called straight away, with no
arguments.  To reiterate, for each entry without a string, its command
will be called immediately, and for others the window will be selected
first.&lt;/p&gt;

&lt;p&gt;Also, take note of &lt;code&gt;aw-flip-window&lt;/code&gt;. Suppose the you have a lot (say
7) windows, but you only want to cycle between the most recent
two. You can do so with &lt;kbd&gt;n&lt;/kbd&gt;, with no need to press the
decision char.&lt;/p&gt;

&lt;p&gt;I call this feature &amp;quot;the dispatch&amp;quot;. The dispatch normally happens when:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;you&amp;#39;re prompted for &lt;code&gt;aw-keys&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;you press a char that isn&amp;#39;t in &lt;code&gt;aw-keys&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;there&amp;#39;s an entry in &lt;code&gt;aw-dispatch-alist&lt;/code&gt; for this char&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to skip step 1 always (since, by default, you&amp;#39;re not
prompted for &lt;code&gt;aw-keys&lt;/code&gt; when you have 2 or less windows), use:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-dispatch-always&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Be careful though, setting this means that you&amp;#39;ll always have to
select a window with &lt;code&gt;aw-keys&lt;/code&gt;, even if there are only two. This is a
large toll on the muscle memory. On the other hand, even with one
window, assuming you&amp;#39;ve bound &lt;code&gt;ace-window&lt;/code&gt; to &lt;kbd&gt;M-p&lt;/kbd&gt;, you get:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;split-window-vertically&lt;/code&gt; on &lt;kbd&gt;M-p v&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;split-window-horizontally&lt;/code&gt; on &lt;kbd&gt;M-p b&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;delete-other-windows&lt;/code&gt; on &lt;kbd&gt;M-p o&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What&amp;#39;s also nice is that these commands scale with the amount of
windows: if you have only one window, you get no prompt for &lt;kbd&gt;M-p
v&lt;/kbd&gt;, so it acts just like &lt;kbd&gt;C-x 2&lt;/kbd&gt;. But if you have more
windows, you don&amp;#39;t have to select the window that you want to split
beforehand: you can select it after you decided to issue a split
operation.&lt;/p&gt;

&lt;p&gt;See &lt;a href=&quot;https://github.com/abo-abo/ace-window/wiki&quot;&gt;the wiki&lt;/a&gt; for a nice
customization setup by &lt;a href=&quot;https://github.com/joedicastro&quot;&gt;@joedicastro&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Give the new feature a try. The jump in utility between the new and
old &lt;code&gt;ace-window&lt;/code&gt;, I feel, is of the same magnitude as the jump between
&lt;code&gt;other-window&lt;/code&gt; and &lt;code&gt;ace-window&lt;/code&gt;. However, it doesn&amp;#39;t come for free and
the muscle memory needs to be readjusted slightly.&lt;/p&gt;

&lt;p&gt;Big thanks to all who contributed, especially to &lt;a href=&quot;https://github.com/joedicastro&quot;&gt;@joedicastro&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>New on MELPA - avy</title>
   <link href="https://oremacs.com/2015/05/08/avy-0.1.0/"/>
   <updated>2015-05-08T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/05/08/avy-0.1.0</id>
   <content type="html">&lt;p&gt;This package contains the library on which &lt;a href=&quot;https://github.com/abo-abo/ace-window&quot;&gt;ace-window&lt;/a&gt; and
&lt;a href=&quot;https://github.com/abo-abo/ace-link&quot;&gt;ace-link&lt;/a&gt; now depend, as well as a multitude of navigation
commands.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/wiki/abo-abo/avy-jump/images/avy-avatar-1.png&quot; alt=&quot;logo.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;Yes, they used to depend on &lt;a href=&quot;https://github.com/winterTTr/ace-jump-mode&quot;&gt;ace-jump-mode&lt;/a&gt;, hence the
&lt;code&gt;ace&lt;/code&gt; in their names, but as I added features to my packages over time, it became harder to compose
features because of &lt;code&gt;ace-jump-mode&lt;/code&gt; inflexibility.&lt;/p&gt;

&lt;p&gt;Don&amp;#39;t get me wrong, &lt;code&gt;ace-jump-mode&lt;/code&gt; is a fine standalone package, and if you&amp;#39;re using it only for
jumping to chars, there are few reasons for you to make the switch. However, if you&amp;#39;re interested in
the new and juicy features, such as: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;jumping to word starts&lt;/li&gt;
&lt;li&gt;jumping to sub-word starts&lt;/li&gt;
&lt;li&gt;jumping to line beginnings or endings&lt;/li&gt;
&lt;li&gt;copying and moving lines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;with most of the features coming in &lt;code&gt;-0&lt;/code&gt;, &lt;code&gt;-1&lt;/code&gt;, or &lt;code&gt;-2&lt;/code&gt; flavor, or if you&amp;#39;re interested in building
an &lt;code&gt;ace-jump-mode&lt;/code&gt;-based package, then you should consider &lt;a href=&quot;https://github.com/abo-abo/avy&quot;&gt;avy&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-leading-chars-flavor&quot;&gt;The leading chars flavor&lt;/h2&gt;

&lt;p&gt;All of the commands provided are about jumping to visible characters, and possibly doing some stuff.
Since usually there are a lot of these visible characters, it&amp;#39;s advantageous to first narrow them
somewhat. So each command can be divided into two phases: the narrowing phase and the decision phase.&lt;/p&gt;

&lt;p&gt;There are 3 variations of the narrowing phase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;-0&lt;/code&gt; flavor, e.g. &lt;code&gt;avy-goto-word-0&lt;/code&gt; or &lt;code&gt;avy-goto-line&lt;/code&gt; doesn&amp;#39;t narrow at all. The advantage
that there&amp;#39;s minimum context switching (no narrowing phase, only decision phase). The disadvantage
is that the number of candidates in the decision phase can be quite large.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;-1&lt;/code&gt; flavor, e.g. &lt;code&gt;avy-goto-word-1&lt;/code&gt; or &lt;code&gt;avy-goto-char&lt;/code&gt; narrows by the first character of the
thing.  The disadvantage is the context switch: first you call the command, then you switch context
to scan and input the leading char, then you switch context to scan and input the decision chars.
The advantage is less candidates in the decision phase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;-2&lt;/code&gt; flavor is my favorite &lt;code&gt;avy-goto-char-2&lt;/code&gt;: it reads &lt;strong&gt;two&lt;/strong&gt; consecutive chars, instead of
just one.  This doesn&amp;#39;t impact the narrowing phase too much, since inputting two consecutive chars
isn&amp;#39;t much more than just one.  But it greatly decreases the number of candidates in the decision
phase. The small amount of candidates allows me to use this setting for the decision:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-keys&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;?a&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?s&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?d&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?f&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?g&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?h&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?j&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?k&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?l&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That&amp;#39;s only 9 decision chars, all of them on the home row.&lt;/p&gt;

&lt;h2 id=&quot;the-decision-char-overlay-flavors&quot;&gt;The decision char overlay flavors&lt;/h2&gt;

&lt;p&gt;Once again, there are three, here are their corresponding &lt;code&gt;defcustom&lt;/code&gt;s:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-goto-char-style&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;pre&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Method of displaying the overlays for &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`avy-goto-char&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; and &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`avy-goto-char-2&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;choice&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Pre&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pre&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;At&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Post&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-goto-word-style&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;pre&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Method of displaying the overlays for &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`avy-goto-word-0&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; and &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`avy-goto-word-0&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;choice&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Pre&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pre&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;At&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:tag&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Post&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you&amp;#39;re used to &lt;code&gt;ace-jump-mode&lt;/code&gt;, the corresponding style is &lt;code&gt;at&lt;/code&gt;, which displays the overlay at
the target position, one character at a time.  I don&amp;#39;t like this style most of the time, I prefer
&lt;code&gt;pre&lt;/code&gt; which is more similar to &lt;code&gt;vim-easymotion&lt;/code&gt;: it will display the full char path at once, before
the target position. This results in less feedback and more efficiency, in my opinion.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Give the new package a try, it&amp;#39;s already been pretty active the last few days, with bugs being fixed
and new features appearing, thanks to all who contributed.&lt;/p&gt;

&lt;p&gt;If you want to see some screenshots, there are plenty at the
&lt;a href=&quot;https://github.com/abo-abo/avy&quot;&gt;repository page&lt;/a&gt;, and also in an earlier
&lt;a href=&quot;http://oremacs.com/2015/03/03/ace-window-full-path/&quot;&gt;post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Finally, the package in on &lt;a href=&quot;http://melpa.org/#/avy&quot;&gt;MELPA&lt;/a&gt;, so it&amp;#39;s convenient to install.  The only hassle is to decide where to bind all these commands.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ivy-mode 0.4.0 is out</title>
   <link href="https://oremacs.com/2015/05/02/swiper-0.4.0/"/>
   <updated>2015-05-02T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/05/02/swiper-0.4.0</id>
   <content type="html">&lt;p&gt;This is a feature-packed release with a lot of cool things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Partial completion on &lt;kbd&gt;TAB&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;Resume the last completion session with &lt;code&gt;ivy-resume&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Multi-tier regex matching&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The detailed release notes follow.&lt;/p&gt;

&lt;h2 id=&quot;fixes&quot;&gt;Fixes&lt;/h2&gt;

&lt;h3 id=&quot;glob-expansion-in-rgrep&quot;&gt;Glob expansion in &lt;code&gt;rgrep&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;While completing file names, ivy expands the file name to
full. Unfortunately, &lt;code&gt;rgrep&lt;/code&gt; uses &lt;code&gt;read-file-name-internal&lt;/code&gt; and isn&amp;#39;t
receptive to globs being expanded with the current directory.  A
work-around this is to use the generic strategy when ivy is in
trouble:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;enter the input text as if there was no completion.&lt;/li&gt;
&lt;li&gt;exit with &lt;kbd&gt;C-u C-j&lt;/kbd&gt; (forwards to &lt;code&gt;ivy-immediate-done&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;ivy-immediate-done&lt;/code&gt; is currently unbound by default. If you want, you
can bind it in your config like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-minibuffer-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c C-d&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-immediate-done&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;exclude-a-couple-more-modes-from-font-lock&quot;&gt;Exclude a couple more modes from font-lock&lt;/h3&gt;

&lt;p&gt;This time, they are &lt;code&gt;jabber-chat-mode&lt;/code&gt; and &lt;code&gt;elfeed-search-mode&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;fix-a-flag-in-swiper-query-replace&quot;&gt;Fix a flag in &lt;code&gt;swiper-query-replace&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;You can launch a query replace with &lt;kbd&gt;M-q&lt;/kbd&gt; from swiper.&lt;/p&gt;

&lt;h3 id=&quot;avoid-sorting-org-refile-candidates&quot;&gt;Avoid sorting &lt;code&gt;org-refile&lt;/code&gt; candidates&lt;/h3&gt;

&lt;p&gt;By default, ivy completion candidates are sorted with
&lt;code&gt;string-lessp&lt;/code&gt;. The sorting can be customized with
&lt;code&gt;ivy-sort-functions-alist&lt;/code&gt;. While refiling, the natural order is
actually best, so the sorting is turned off in that case.&lt;/p&gt;

&lt;h3 id=&quot;reset-to-the-first-candidate-when-switching-directories&quot;&gt;Reset to the first candidate when switching directories&lt;/h3&gt;

&lt;p&gt;With &lt;code&gt;ivy-mode&lt;/code&gt; you can select a file anywhere on your file system by
switching directories repeatedly with &lt;kbd&gt;C-j&lt;/kbd&gt;
(&lt;code&gt;ivy-alt-done&lt;/code&gt;). After moving to a new directory, the point should be
on the first candidate.&lt;/p&gt;

&lt;h3 id=&quot;fixup-the-face-order&quot;&gt;Fixup the face order&lt;/h3&gt;

&lt;p&gt;All this time there was an issue with the face order swapping between
1 and 2 groups.  This is now fixed.  Also, I&amp;#39;ve made
&lt;code&gt;swiper-match-face-4&lt;/code&gt; inherit from &lt;code&gt;isearch-fail&lt;/code&gt;. It&amp;#39;s important to
have all 4 faces be different.&lt;/p&gt;

&lt;h3 id=&quot;dont-error-on-bad-regex&quot;&gt;Don&amp;#39;t error on bad regex&lt;/h3&gt;

&lt;p&gt;When the current input is a bad regex, just display no candidates and
continue. Don&amp;#39;t throw an error.&lt;/p&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New Features&lt;/h2&gt;

&lt;h3 id=&quot;use-instead-of-to-move-to-root&quot;&gt;Use &lt;kbd&gt;//&lt;/kbd&gt; instead of &lt;kbd&gt;/&lt;/kbd&gt; to move to root&lt;/h3&gt;

&lt;p&gt;While completing file names, you can enter &lt;kbd&gt;//&lt;/kbd&gt; to move to
the root directory.  This change was necessary in order to make it
possible to enter e.g. &lt;code&gt;/sudo:&lt;/code&gt; or &lt;code&gt;/ssh:&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;host-completion-for-sudo-and-ssh&quot;&gt;Host completion for &lt;code&gt;/sudo:&lt;/code&gt; and &lt;code&gt;/ssh:&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This feature is a bit flaky for now. But it works well on my
machine. It should get better after a few bug reports. You can start
the completion right after the method, e.g. &lt;code&gt;/ssh:&lt;/code&gt; &lt;kbd&gt;RET&lt;/kbd&gt;, or
after method+user, e.g. &lt;code&gt;/ssh:oleh@&lt;/code&gt; &lt;kbd&gt;RET&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;respect-confirm-nonexistent-file-or-buffer&quot;&gt;Respect &lt;code&gt;confirm-nonexistent-file-or-buffer&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;If you set &lt;code&gt;confirm-nonexistent-file-or-buffer&lt;/code&gt; to t (it&amp;#39;s nil by
default), you&amp;#39;ll have to confirm when you create a new file or buffer
with ivy.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/wiki/abo-abo/swiper/images/ivy-confirm.png&quot; alt=&quot;confirm.png&quot;&gt;&lt;/p&gt;

&lt;h3 id=&quot;highlight-remote-buffers-with-ivy-remote-face&quot;&gt;Highlight remote buffers with &lt;code&gt;ivy-remote&lt;/code&gt; face&lt;/h3&gt;

&lt;p&gt;Just some extra polish to make things look nicer. The buffers to which
you&amp;#39;re connected through TRAMP will be highlighted with the new
&lt;code&gt;ivy-remote&lt;/code&gt; face.&lt;/p&gt;

&lt;h3 id=&quot;change-the-prompt-for-match-required-interactions&quot;&gt;Change the prompt for &lt;code&gt;match-required&lt;/code&gt; interactions&lt;/h3&gt;

&lt;p&gt;Sometimes, the Emacs functions that call completion specify to it that
a match is required, i.e. you can&amp;#39;t just type in some random stuff -
you have to select one of the candidates given to you.  In that case
ivy will appropriately change the prompt like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/wiki/abo-abo/swiper/images/ivy-match-required.png&quot; alt=&quot;match-required.png&quot;&gt;&lt;/p&gt;

&lt;h3 id=&quot;improve-the-candidate-selection-while-using-history&quot;&gt;Improve the candidate selection while using history&lt;/h3&gt;

&lt;p&gt;While completing, you press &lt;kbd&gt;M-p&lt;/kbd&gt; to select the previous
input. This update tries to select not just the first candidates that
matches, but the actual previous candidate that you selected before.&lt;/p&gt;

&lt;h3 id=&quot;use-alpha-compositing-to-add-ivy-current-match-face&quot;&gt;Use alpha compositing to add &lt;code&gt;ivy-current-match-face&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is only relevant for when the completion candidates have custom
face backgrounds. But in that case, the minibuffer looks a lot nicer.&lt;/p&gt;

&lt;h3 id=&quot;add-partial-completion&quot;&gt;Add partial completion&lt;/h3&gt;

&lt;p&gt;Press &lt;kbd&gt;TAB&lt;/kbd&gt; to do call &lt;code&gt;ivy-partial-or-done&lt;/code&gt; to complete the
current thing to the largest possible prefix. When called twice in a
row, it&amp;#39;s the same as &lt;kbd&gt;C-j&lt;/kbd&gt;, i.e. it will finish the
completion.&lt;/p&gt;

&lt;h3 id=&quot;improve-completion-of-hidden-buffers&quot;&gt;Improve completion of hidden buffers&lt;/h3&gt;

&lt;p&gt;In Emacs, hidden buffer names start with a space. To see them all,
press a single space while completing buffers in &lt;code&gt;ivy-mode&lt;/code&gt;. You can
toggle between hidden and non-hidden buffers by editing the first
space in your input query. Remember that with &lt;code&gt;ivy-mode&lt;/code&gt; the
minibuffer is a proper editable area, so &lt;kbd&gt;C-a&lt;/kbd&gt; works properly
(unlike in &lt;code&gt;isearch&lt;/code&gt; or &lt;code&gt;ido-mode&lt;/code&gt;).&lt;/p&gt;

&lt;h3 id=&quot;allow-to-quote-spaces-while-matching&quot;&gt;Allow to quote spaces while matching&lt;/h3&gt;

&lt;p&gt;Spaces are wild while matching - they serve as group
boundaries. However, sometimes it would be useful to quote them. From
now on, you can quote &lt;code&gt;N&lt;/code&gt; consecutive spaces by inputting &lt;code&gt;N+1&lt;/code&gt;
consecutive spaces.&lt;/p&gt;

&lt;h2 id=&quot;add-multi-tier-regex-matching&quot;&gt;Add multi-tier regex matching&lt;/h2&gt;

&lt;p&gt;This is actually a really cool feature, so if you&amp;#39;re paying attention
to any section, let it be this one.&lt;/p&gt;

&lt;h3 id=&quot;user-side&quot;&gt;User side&lt;/h3&gt;

&lt;p&gt;For example, I cloned
&lt;a href=&quot;https://github.com/boostorg/boost/tree/boost-1.58.0&quot;&gt;boost-1.58.0&lt;/a&gt;
and called &lt;code&gt;counsel-git&lt;/code&gt;, which is like a &lt;code&gt;find-file&lt;/code&gt; for all files in
a git repository at once.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Initially, it gives 45919 candidate files.&lt;/li&gt;
&lt;li&gt;With input &amp;quot;utility&amp;quot;, there are 234 candidates.&lt;/li&gt;
&lt;li&gt;With input &amp;quot;utility hpp&amp;quot;, there are 139 candidates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, the interesting part. If I want to exclude anything with &amp;quot;hpp&amp;quot; in
it, I change the input to &amp;quot;utility !hpp&amp;quot; (with &lt;kbd&gt;M-b !&lt;/kbd&gt;) to
get 95 candidates (95=234-139, it checks out).  I could exclude some
more:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;with input &amp;quot;utility !hpp cpp&amp;quot; there are 57 candidates.&lt;/li&gt;
&lt;li&gt;with input &amp;quot;utility !hpp cpp ipp&amp;quot; there are 46 candidates.&lt;/li&gt;
&lt;li&gt;I can unify the regex to &amp;quot;utility ![hic]pp&amp;quot; and also get 46 candidates.&lt;/li&gt;
&lt;li&gt;exclude htm with &amp;quot;utility ![hic]pp htm&amp;quot; to get only 17 candidates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can use this strategy anywhere, not just for git file. For example, in &lt;code&gt;describe-function&lt;/code&gt; or &lt;code&gt;swiper&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;elisp-side&quot;&gt;Elisp side&lt;/h3&gt;

&lt;p&gt;You can customize &lt;code&gt;ivy-re-builders-alist&lt;/code&gt; to make &lt;code&gt;ivy-mode&lt;/code&gt; complete
in the way that you like.  The alist dispatches on the collection
type, so you can have one completion strategy for buffers, another for
files and still another for everything else.&lt;/p&gt;

&lt;p&gt;Each function on the alist should turn the string input into a string
regex. So the simplest one would be &lt;code&gt;regexp-quote&lt;/code&gt;. If you want to use
multi-tier matching, the function should instead return a list of
regexps of two types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the ones that should match (will be joined by &lt;code&gt;and&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;the ones that should not match (will be joined by &lt;code&gt;or&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;add-ivy-resume&quot;&gt;Add &lt;code&gt;ivy-resume&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;This feature is still a bit of a work-in-progress. But it allows you
to resume the last completion to the point before you entered
&lt;kbd&gt;RET&lt;/kbd&gt; or &lt;kbd&gt;C-g&lt;/kbd&gt; etc.  It only works for features that
specifically passed &lt;code&gt;:action&lt;/code&gt; to &lt;code&gt;ivy-read&lt;/code&gt;.  You could resume other
features, but nothing would be done when you select the candidate,
since &lt;code&gt;ivy-completing-read&lt;/code&gt; has no idea what the function that called
it was going to do with the result.&lt;/p&gt;

&lt;p&gt;Currently, you can resume:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-describe-variable&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-describe-function&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lispy-goto&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swiper&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here&amp;#39;s how I&amp;#39;ve bound it in my config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c C-r&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-resume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-resume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;ivy-resume&lt;/code&gt; feature adds &lt;code&gt;occur&lt;/code&gt;-like functionality to &lt;code&gt;swiper&lt;/code&gt;.
Calling &lt;code&gt;ivy-resume&lt;/code&gt; is like switching to the &lt;code&gt;*Occur*&lt;/code&gt; buffer.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Big thanks to all who contributed, especially
&lt;a href=&quot;https://github.com/tsdh&quot;&gt;@tsdh&lt;/a&gt; and
&lt;a href=&quot;https://github.com/zhaojiangbin&quot;&gt;@zhaojiangbin&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you&amp;#39;re considering to switch from &lt;code&gt;ido-mode&lt;/code&gt; to &lt;code&gt;ivy-mode&lt;/code&gt;, now is
a good time, since the most glaring gaps have now been filled. You can
find some up-to-date info on the
&lt;a href=&quot;https://github.com/abo-abo/swiper/wiki&quot;&gt;swiper wiki&lt;/a&gt;. I switched the
page syntax from markdown to org-mode, but Github makes the headings
way to big. So it might be easier to clone the wiki and view the org
files in Emacs:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;git clone https://github.com/abo-abo/swiper.wiki.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>GCC macros and auto-yasnippet</title>
   <link href="https://oremacs.com/2015/04/30/gcc-macros-auto-yasnippet/"/>
   <updated>2015-04-30T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/30/gcc-macros-auto-yasnippet</id>
   <content type="html">&lt;p&gt;As one thing leads to another, it occurred to me that I didn&amp;#39;t know
what &lt;code&gt;__GNUC__&lt;/code&gt; macro does.  Which brought me to the manual page on
&lt;a href=&quot;https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html&quot;&gt;Common Predefined Macros&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;using-org-mode-babel-to-check-the-macro-values&quot;&gt;Using &lt;code&gt;org-mode&lt;/code&gt; Babel to check the macro values&lt;/h2&gt;

&lt;p&gt;I decided that just skimming through the page wasn&amp;#39;t enough, and I
wanted to brush up on my &lt;code&gt;org-mode&lt;/code&gt; babel.  So I created this
&lt;a href=&quot;https://raw.githubusercontent.com/abo-abo/oremacs/github/etc/org/wiki/C.org&quot;&gt;wiki page&lt;/a&gt;
to which you&amp;#39;re welcome if you ever need to check &lt;code&gt;__BYTE_ORDER_&lt;/code&gt; or
&lt;code&gt;__UINT_FAST16_TYPE__&lt;/code&gt; on your system.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s a small excerpt of it:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-C&quot; data-lang=&quot;C&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;#+begin_src C :results verbatim&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// version stuff&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;__GNUC__ %d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__GNUC__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;__GNUC_MINOR__ %d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__GNUC_MINOR__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;__GNUC_PATCHLEVEL__ %d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__GNUC_PATCHLEVEL__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;__VERSION__ %s&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__VERSION__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;#+end_src&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When you navigate to any place in the code and press &lt;kbd&gt;C-c C-c&lt;/kbd&gt;, which calls (sic) &lt;code&gt;org-ctrl-c-ctrl-c&lt;/code&gt;,
it will re-compile and re-run your program.&lt;/p&gt;

&lt;p&gt;I list here some of the &lt;a href=&quot;https://github.com/abo-abo/oremacs/blob/github/oleh/modes/ora-org.el&quot;&gt;config&lt;/a&gt; to make it all work:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-babel-do-load-languages&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;org-babel-load-languages&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;C&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-babel-C-compiler&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;gcc -std=c99&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;new-auto-yasnippet-method&quot;&gt;New &lt;code&gt;auto-yasnippet&lt;/code&gt; method&lt;/h2&gt;

&lt;p&gt;You can read up on what &lt;code&gt;auto-yasnippet&lt;/code&gt; is in &lt;a href=&quot;http://oremacs.com/2015/01/30/auto-yasnippet/&quot;&gt;this post&lt;/a&gt;.
For the wiki page, I had to insert the &lt;code&gt;printf&lt;/code&gt; statements a bunch of times, some of them with triply-repeated symbols.
Take, for instance, this statement:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-C&quot; data-lang=&quot;C&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;__INT32_TYPE__ %s (%d)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ESTR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__INT32_TYPE__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__INT32_TYPE__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With the old method, I would insert &lt;code&gt;~&lt;/code&gt; before each &lt;code&gt;INT32&lt;/code&gt; and call &lt;code&gt;aya-create&lt;/code&gt;. But it would result in this snippet, which isn&amp;#39;t optimal:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-C&quot; data-lang=&quot;C&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;__$1 %s (%d)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ESTR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With the new method (the old one still works, it&amp;#39;s just that the new one takes priority), I would only quote the first field like so:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-C&quot; data-lang=&quot;C&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;__`INT32&amp;#39;_TYPE__ %s (%d)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ESTR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__INT32_TYPE__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__INT32_TYPE__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Which results in this snippet:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-C&quot; data-lang=&quot;C&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;__$1_TYPE__ %s (%d)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ESTR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_TYPE__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_TYPE__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Much better.&lt;/p&gt;

&lt;h2 id=&quot;oremacs-wiki-workflow&quot;&gt;&lt;code&gt;oremacs&lt;/code&gt; wiki workflow&lt;/h2&gt;

&lt;p&gt;If you&amp;#39;re crazy enough (in a good way) to follow &lt;a href=&quot;https://github.com/abo-abo/oremacs&quot;&gt;oremacs&lt;/a&gt;, you&amp;#39;ll get the
new wiki page delivered right to your config with&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;which will also update to the latest &lt;code&gt;org-mode&lt;/code&gt; and CEDET.&lt;/p&gt;

&lt;p&gt;And here&amp;#39;s how to access it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;run &lt;code&gt;xmodmap etc/.Xmodmap&lt;/code&gt; to make &lt;kbd&gt;;&lt;/kbd&gt; into a modifier&lt;/li&gt;
&lt;li&gt;press &lt;kbd&gt;;-k&lt;/kbd&gt; to open a dispatch hydra&lt;/li&gt;
&lt;li&gt;press &lt;kbd&gt;w&lt;/kbd&gt; to select the wiki&lt;/li&gt;
&lt;li&gt;select &lt;code&gt;C&lt;/code&gt; (currently, the only other candidate is &lt;code&gt;git&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Check out the new &lt;code&gt;auto-yasnippet&lt;/code&gt; method, I think it&amp;#39;s pretty
efficient.  I hope that you&amp;#39;ll find the wiki page useful in your C
pursuits.  And a big thanks to Eric Schulte for &lt;code&gt;org-babel&lt;/code&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Blending colors in Elisp</title>
   <link href="https://oremacs.com/2015/04/28/blending-faces/"/>
   <updated>2015-04-28T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/28/blending-faces</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;This is a slightly obscure feature that I&amp;#39;ve added today to
&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;ivy-mode&lt;/a&gt;. It&amp;#39;s obscure, since
very few packages give their candidates a face with a custom
background.  Still, when that happens, a conflict arises:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Which face to apply: &lt;code&gt;ivy-current-match&lt;/code&gt; or the existing one?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the image below, I&amp;#39;ve blended them both in a 50-50 mixture:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-blend.png&quot; alt=&quot;ivy-blend.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;By the way, if you&amp;#39;re wondering where the backgrounds come from in the
first place, it&amp;#39;s &lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy-goto&lt;/a&gt;
function (if you know what &lt;code&gt;imenu&lt;/code&gt; is, it&amp;#39;s an advanced version of
that).  This function collects all the Elisp tags in the current
directory, and offers to jump to them. The functions that have
&lt;code&gt;interactive&lt;/code&gt; in them, are highlighted with &lt;code&gt;lispy-command-name-face&lt;/code&gt;.
In the above screenshot, the first 7 functions are interactive, and the other 2 are not.&lt;/p&gt;

&lt;p&gt;If you&amp;#39;re interested in how color blending is done, I&amp;#39;ll describe it
shortly below.&lt;/p&gt;

&lt;h2 id=&quot;color-building-internals&quot;&gt;Color-building internals&lt;/h2&gt;

&lt;p&gt;First, a smaller and more clear example (I&amp;#39;ve used &lt;code&gt;rainbow-mode&lt;/code&gt; and &lt;code&gt;htmlize-buffer&lt;/code&gt;):&lt;/p&gt;

&lt;style type=&quot;text/css&quot;&gt;
    &lt;!--
      .ATTRLIST {
        /* (:background &quot;#800080&quot;) */
        background-color: #800080;
      }
      .ATTRLIST-1 {
        /* (:background &quot;blue&quot;) */
        background-color: #0000ff;
      }
      .ATTRLIST-2 {
        /* (:foreground &quot;white&quot;) */
        color: #ffffff;
      }
      .ATTRLIST-3 {
        /* (:background &quot;red&quot;) */
        background-color: #ff0000;
      }
      .comment {
        /* font-lock-comment-face */
        color: #3F7F5F;
      }
      .comment-delimiter {
        /* font-lock-comment-delimiter-face */
        color: #3F7F5F;
      }
      .string {
        /* font-lock-string-face */
        color: #2A00FF;
      }
    --&gt;
    &lt;/style&gt;

&lt;pre&gt;
(colir-blend
 (color-values &lt;span class=&quot;string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;ATTRLIST-3&quot;&gt;&lt;span class=&quot;ATTRLIST-2&quot;&gt;red&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;&lt;/span&gt;)
 (color-values &lt;span class=&quot;string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;ATTRLIST-1&quot;&gt;&lt;span class=&quot;ATTRLIST-2&quot;&gt;blue&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;&lt;/span&gt;))
&lt;span class=&quot;comment-delimiter&quot;&gt;;; &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;=&amp;gt; &quot;&lt;/span&gt;&lt;span class=&quot;ATTRLIST&quot;&gt;&lt;span class=&quot;ATTRLIST-2&quot;&gt;#800080&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;&quot;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Here, &lt;code&gt;colir-blend&lt;/code&gt; is a very small function that I&amp;#39;ll describe below,
and &lt;code&gt;color-values&lt;/code&gt; is a function from faces.el that forwards to a C
function &lt;code&gt;xw-color-values&lt;/code&gt; with this doc:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Return a list of three integers, (RED GREEN BLUE), each between 0
and either 65280 or 65535 (the maximum depends on the system).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Which is a bit weird, since the last time I checked, the standard for
colors was one-byte per channel, not two.  Granted, it was about 10
years ago that I checked, and indeed, the
&lt;a href=&quot;http://en.wikipedia.org/wiki/RGB_color_model#Numeric_representations&quot;&gt;entry on Wikipedia&lt;/a&gt;
says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;High-end digital image equipment are often able to deal with larger
integer ranges for each primary color, such as 0..1023 (10 bits),
0..65535 (16 bits) or even larger, by extending the 24-bits (three
8-bit values) to 32-bit, 48-bit, or 64-bit units&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Apparently, Emacs is outfitted to deal high-end digital image
equipment. But I&amp;#39;m still pretty sure that most graphics cards that you
can buy only give 8 bits per each channel. Anyway, here&amp;#39;s the code for
the basic functions:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;colir-join&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;g&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Build a color from R G B.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Inverse of &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`color-values&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#%02x%02x%02x&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ash&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ash&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;g&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ash&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;colir-blend&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;c1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c2&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;&amp;amp;optional&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;alpha&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Blend the two colors C1 and C2 with ALPHA.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;C1 and C2 are in the format of &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`color-values&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;ALPHA is a number between 0.0 and 1.0 which corresponds to the&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;influence of C1 on the result.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;alpha&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;alpha&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;colir-join&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cl-mapcar&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;round&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;alpha&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;alpha&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
          &lt;span class=&quot;nv&quot;&gt;c1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;All pretty simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Split each color into red, green, and blue integers with &lt;code&gt;color-values&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Compute a mean for each color channel.&lt;/li&gt;
&lt;li&gt;Build the new color by concatenating the hex components into a string.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the example above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The result of &lt;code&gt;(color-values &amp;quot;red&amp;quot;)&lt;/code&gt; is &lt;code&gt;(65535 0 0)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The result of &lt;code&gt;(color-values &amp;quot;blue&amp;quot;)&lt;/code&gt; is &lt;code&gt;(0 0 65535)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Their arithmetic mean is &lt;code&gt;(32768 0 32768)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Divided by &lt;code&gt;256&lt;/code&gt; with &lt;code&gt;ash&lt;/code&gt;, we get &lt;code&gt;(128 0 128)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Converted to hex, &lt;code&gt;(128 0 128)&lt;/code&gt; is &lt;code&gt;(80 0 80)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;And the final color is &lt;code&gt;&amp;quot;#800080&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you&amp;#39;ve enjoyed this little venture into Elisp and colors.
People say rough things about Elisp sometimes, but hey: it offers
functions ranging from the assembly-level &lt;code&gt;ash&lt;/code&gt;, all the way up to
Photoshop-grade color channel handling.&lt;/p&gt;

&lt;p&gt;If only it could get a good optimization bump, like JavaScript got at
one point, and a small threading library, we&amp;#39;d be all set.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Oremacs config is on Github</title>
   <link href="https://oremacs.com/2015/04/24/oremacs-config/"/>
   <updated>2015-04-24T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/24/oremacs-config</id>
   <content type="html">&lt;p&gt;I noticed that the packages that I&amp;#39;ve published on
&lt;a href=&quot;https://github.com/abo-abo&quot;&gt;Github&lt;/a&gt; in the last year did get a nice
boost in quality just from being published, viewed, used and commented
on.&lt;/p&gt;

&lt;p&gt;So it makes sense to do the same for my full Emacs config, which lives in the &lt;a href=&quot;https://github.com/abo-abo/oremacs&quot;&gt;oremacs&lt;/a&gt; repository as of today.&lt;/p&gt;

&lt;p&gt;The config is personal in the sense that I&amp;#39;m actually using it
verbatim, but it&amp;#39;s been configured in a way that&amp;#39;s it&amp;#39;s easy to
replicate and modify it.&lt;/p&gt;

&lt;h2 id=&quot;who-can-benefit-from-this-config&quot;&gt;Who can benefit from this config&lt;/h2&gt;

&lt;p&gt;The audience is people like me, who like to tinker with Elisp just for
fun of it.  If you want things to just work, or you find learning
Elisp a chore, it&amp;#39;s not for you.&lt;/p&gt;

&lt;p&gt;The config won&amp;#39;t work initially, it won&amp;#39;t work always, but when it
finally does work (hopefully), it will be glorious!&lt;/p&gt;

&lt;h2 id=&quot;installation-and-running&quot;&gt;Installation and Running&lt;/h2&gt;

&lt;h3 id=&quot;requirements&quot;&gt;Requirements&lt;/h3&gt;

&lt;p&gt;Emacs 24 is required. Obviously, newer versions are better, but the
default &lt;code&gt;emacs24&lt;/code&gt; that you get from the package manager should work.&lt;/p&gt;

&lt;p&gt;I&amp;#39;m currently switching between Emacs 24.5.2 built from source and the
current master from &lt;a href=&quot;https://savannah.gnu.org/git/?group=emacs&quot;&gt;git&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;install-command&quot;&gt;Install command&lt;/h3&gt;

&lt;p&gt;This config doesn&amp;#39;t assume to become your main config when you install
it.  It installs in-place in the git directory and will start from
there without touching your main config.  But you still get access to
all your stuff, like bookmarks stored in your actual &lt;code&gt;~/.emacs.d/&lt;/code&gt;
etc.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ~/git
git clone https://github.com/abo-abo/oremacs
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; oremacs
make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;run-command&quot;&gt;Run command&lt;/h3&gt;

&lt;p&gt;Run without updating:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;make run
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Run with an upstream + ELPA update:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;make up
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Run with an upstream + ELPA + org-mode + CEDET update:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;perks&quot;&gt;Perks&lt;/h2&gt;

&lt;h3 id=&quot;standalone&quot;&gt;Standalone&lt;/h3&gt;

&lt;p&gt;You can try it without messing up your current Emacs config.  I actually have multiple versions of this on my system to work-around incompatibility between versions. This way, I can use my full setup even in case I get a bug report for an older Emacs version.&lt;/p&gt;

&lt;h3 id=&quot;fast-start-up&quot;&gt;Fast start up&lt;/h3&gt;

&lt;p&gt;With a SSD, it starts in 1 second. Most features are autoloaded and it&amp;#39;s easy to add new autoloaded features.&lt;/p&gt;

&lt;h3 id=&quot;tracks-the-most-recent-org-mode-and-cedet&quot;&gt;Tracks the most recent org-mode and CEDET&lt;/h3&gt;

&lt;p&gt;Since these packages take a long time to byte compile, they are updated not with &lt;code&gt;make up&lt;/code&gt; but with &lt;code&gt;make install&lt;/code&gt;. They are actually git submodules, which means that they won&amp;#39;t update if I don&amp;#39;t update them in the upstream.&lt;/p&gt;

&lt;h3 id=&quot;bankruptcy-proof&quot;&gt;Bankruptcy-proof&lt;/h3&gt;

&lt;p&gt;It&amp;#39;s hard to become Emacs-bankrupt with this config, since the config is composed of many independent pieces that you can simply ignore if you don&amp;#39;t need them.&lt;/p&gt;

&lt;h3 id=&quot;anti-rsi-qwerty-mod&quot;&gt;Anti-RSI QWERTY mod&lt;/h3&gt;

&lt;p&gt;The config comes with its own &lt;code&gt;.Xmodmap&lt;/code&gt; that makes &lt;kbd&gt;;&lt;/kbd&gt; into an additional modifier. RSI savers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;;-v&lt;/kbd&gt; instead of &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;;-o&lt;/kbd&gt; instead of &lt;kbd&gt;Backspace&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;;-f&lt;/kbd&gt; instead of &lt;kbd&gt;Shift-9&lt;/kbd&gt; and &lt;kbd&gt;Shift-0&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;;-a&lt;/kbd&gt; instead of &lt;kbd&gt;-&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;;-s&lt;/kbd&gt; instead of &lt;kbd&gt;Shift--&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;;-q&lt;/kbd&gt; instead of &lt;kbd&gt;Shift-&amp;#39;&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;;-e&lt;/kbd&gt; instead of &lt;kbd&gt;=&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;;-u&lt;/kbd&gt; in addition / instead of &lt;kbd&gt;C-u&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And obviously the replacements for the two keys that the mod takes away:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;;-j&lt;/kbd&gt; instead of &lt;kbd&gt;;&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;;-d&lt;/kbd&gt; instead of &lt;kbd&gt;Shift-;&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One more Elisp-level RSI-saver is the swap between &lt;kbd&gt;C-p&lt;/kbd&gt; and &lt;kbd&gt;C-h&lt;/kbd&gt;. Moving up/down line is very important, and it&amp;#39;s nice to have these keys close, which &lt;kbd&gt;C-n&lt;/kbd&gt; and &lt;kbd&gt;C-h&lt;/kbd&gt; are.&lt;/p&gt;

&lt;p&gt;It also includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a bunch of Hydras that save you key strokes.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lispy-mode&lt;/code&gt; which quickens any LISP mode, especially Elisp.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;worf-mode&lt;/code&gt; which quickens &lt;code&gt;org-mode&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ivy-mode&lt;/code&gt; which quickens all completion.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swiper&lt;/code&gt; which quickens &lt;code&gt;isearch&lt;/code&gt; (by replacing it).&lt;/li&gt;
&lt;li&gt;C/C++ is customized with &lt;code&gt;function-args-mode&lt;/code&gt; and a bunch of hacks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;org-mode-starter&quot;&gt;Org mode starter&lt;/h3&gt;

&lt;p&gt;The config starts you off with a fully configured &lt;code&gt;org-mode&lt;/code&gt; setup that includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;gtd.org for getting things done.&lt;/li&gt;
&lt;li&gt;ent.org to track entertainment.&lt;/li&gt;
&lt;li&gt;wiki folder for quickly starting and selecting wikis.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you try and enjoy the new config. Perhaps not verbatim,
but if you find the tips on this blog helpful, this config is their
actual implementation that you can use for reference.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Swiper 0.3.0 is out, with ivy-mode.</title>
   <link href="https://oremacs.com/2015/04/22/swiper-0.3.0/"/>
   <updated>2015-04-22T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/22/swiper-0.3.0</id>
   <content type="html">&lt;p&gt;This &lt;a href=&quot;https://github.com/abo-abo/swiper/releases/tag/0.3.0&quot;&gt;release&lt;/a&gt; packs more than 90 commits, which is quite a lot for me.
The most important part of this release is &lt;code&gt;ivy-mode&lt;/code&gt;, which is a nice alternative to &lt;code&gt;ido-mode&lt;/code&gt; or &lt;code&gt;helm-mode&lt;/code&gt;.
I&amp;#39;ve mentioned it already in &lt;a href=&quot;http://oremacs.com/2015/04/16/ivy-mode/&quot;&gt;an earlier post&lt;/a&gt;,
I&amp;#39;ll just review all the little details, changes and customizations here.&lt;/p&gt;

&lt;h2 id=&quot;important-remove-the-old-ivy-package&quot;&gt;Important: remove the old &lt;code&gt;ivy&lt;/code&gt; package&lt;/h2&gt;

&lt;p&gt;One important change related to MELPA is that the &lt;code&gt;ivy&lt;/code&gt; package was merged into &lt;code&gt;swiper&lt;/code&gt; package. So if you still have a stand-alone &lt;code&gt;ivy&lt;/code&gt; package, you should delete it, or you&amp;#39;ll get incompatibility problems.&lt;/p&gt;

&lt;h2 id=&quot;video-demo-of-counsel-git-grep&quot;&gt;Video Demo of &lt;code&gt;counsel-git-grep&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;If you like videos, you can watch the &lt;a href=&quot;https://www.youtube.com/watch?v=AgRsYOJi6ao&quot;&gt;this quick demo&lt;/a&gt;
which mostly shows off the new &lt;code&gt;counsel-git-grep&lt;/code&gt; function.&lt;/p&gt;

&lt;h2 id=&quot;fixes&quot;&gt;Fixes&lt;/h2&gt;

&lt;h3 id=&quot;add-work-around-for-window-start-being-not-current&quot;&gt;Add work-around for &lt;code&gt;window-start&lt;/code&gt; being not current&lt;/h3&gt;

&lt;p&gt;From now on, you won&amp;#39;t encounter some un-highlighted matches when your window is scrolled.&lt;/p&gt;

&lt;h3 id=&quot;make-thing-at-point-work&quot;&gt;Make &lt;code&gt;thing-at-point&lt;/code&gt; work&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;C-h v&lt;/kbd&gt; and &lt;kbd&gt;C-h f&lt;/kbd&gt; should select thing-at-point properly.&lt;/p&gt;

&lt;h3 id=&quot;dont-try-to-fontify-huge-buffers&quot;&gt;Don&amp;#39;t try to fontify huge buffers&lt;/h3&gt;

&lt;p&gt;It&amp;#39;s a nice feature of swiper that everything in the minibuffer is fontified.  However, this can cause a slowdown for buffers with x10000 lines. So this feature is automatically turned off for these large buffers.&lt;/p&gt;

&lt;h3 id=&quot;exclude-a-few-modes-from-font-locking&quot;&gt;Exclude a few modes from font locking&lt;/h3&gt;

&lt;p&gt;Some modes just misbehave when &lt;code&gt;font-lock-ensure&lt;/code&gt; is called. Excluded:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;org-agenda-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dired-mode&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New Features&lt;/h2&gt;

&lt;h3 id=&quot;ivy-mode-complete-everything-with-ivy&quot;&gt;&lt;code&gt;ivy-mode&lt;/code&gt;: complete everything with Ivy&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ivy-mode&lt;/code&gt; uses swiper&amp;#39;s approach to completion for almost all completion in Emacs, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;execute-extended-command&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;package-install&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;find-file&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;See the &lt;a href=&quot;https://github.com/abo-abo/swiper/wiki/File-Completion&quot;&gt;wiki page&lt;/a&gt; for the details on the key bindings related to &lt;code&gt;ivy-mode&lt;/code&gt;, which are especially important to know for &lt;code&gt;find-file&lt;/code&gt;.  Also see the &lt;a href=&quot;https://www.youtube.com/watch?v=VvnJQpTFVDc&quot;&gt;intro video&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;new-counsel-functions&quot;&gt;New Counsel functions&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;counsel-describe-variable&lt;/code&gt; - replacement for &lt;kbd&gt;C-h v&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-describe-function&lt;/code&gt; - replacement for &lt;kbd&gt;C-h f&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-info-lookup-symbol&lt;/code&gt; - just a wrapper around &lt;code&gt;info-lookup-symbol&lt;/code&gt;, you get the same behavior by just calling &lt;code&gt;info-lookup-symbol&lt;/code&gt; with &lt;code&gt;ivy-mode&lt;/code&gt; on.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;counsel-unicode-char&lt;/code&gt; - replacement for &lt;code&gt;ucs-insert&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;counsel-git-grep&quot;&gt;&lt;code&gt;counsel-git-grep&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is a really cool command for grepping at once all the files in your current git repository. For smaller repositories (&amp;lt;20000) lines, ivy handles the completion by itself.  For larger repositories, it defers the work to &lt;code&gt;git grep&lt;/code&gt;. It works really well for the Emacs repo with its 3,000,000 lines, especially if you&amp;#39;re using Emacs 25 (from &lt;code&gt;emacs-snapshot&lt;/code&gt; or self-built).&lt;/p&gt;

&lt;p&gt;This function makes use of &lt;kbd&gt;C-M-n&lt;/kbd&gt; and &lt;kbd&gt;C-M-p&lt;/kbd&gt; bindings, which switch between candidates without exiting the minibuffer. Also, they highlight the current candidate with the swiper faces. You can think of this command as multi-swiper.&lt;/p&gt;

&lt;p&gt;Even for very large repos, it will always display the amount of matches correctly. Also note that swiper-style regex is used here (spaces are wild), and the case is ignored.&lt;/p&gt;

&lt;h3 id=&quot;the-arrows-can-take-numeric-arguments&quot;&gt;The arrows can take numeric arguments&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;C-n&lt;/kbd&gt; / &lt;kbd&gt;C-p&lt;/kbd&gt;, &lt;kbd&gt;C-s&lt;/kbd&gt; / &lt;kbd&gt;C-r&lt;/kbd&gt;, and &lt;kbd&gt;C-M-n&lt;/kbd&gt; / &lt;kbd&gt;C-M-p&lt;/kbd&gt; can all take numeric args, e.g. &lt;kbd&gt;M-5&lt;/kbd&gt; or &lt;kbd&gt;C-u&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;add-a-recenter-binding&quot;&gt;Add a recenter binding&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;C-l&lt;/kbd&gt; will recenter the window in which swiper was called.&lt;/p&gt;

&lt;h3 id=&quot;look-up-ivy-key-bindings-with-c-h-m&quot;&gt;Look up Ivy key bindings with &lt;kbd&gt;C-h m&lt;/kbd&gt;&lt;/h3&gt;

&lt;p&gt;While in the minibuffer, press &lt;kbd&gt;C-h m&lt;/kbd&gt; to see the active modes. Ivy also has a paragraph with its bindings.&lt;/p&gt;

&lt;h3 id=&quot;use-c-v-and-m-v-to-scroll&quot;&gt;Use &lt;kbd&gt;C-v&lt;/kbd&gt; and &lt;kbd&gt;M-v&lt;/kbd&gt; to scroll&lt;/h3&gt;

&lt;p&gt;You can use these bindings to speed up your minibuffer scrolling.&lt;/p&gt;

&lt;h3 id=&quot;allow-c-to-jump-to-definition&quot;&gt;Allow &lt;kbd&gt;C-.&lt;/kbd&gt; to jump-to-definition&lt;/h3&gt;

&lt;p&gt;For &lt;code&gt;counsel-describe-variable&lt;/code&gt; and &lt;code&gt;counsel-describe-function&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pressing &lt;kbd&gt;C-m&lt;/kbd&gt; will actually describe the current candidate.&lt;/li&gt;
&lt;li&gt;pressing &lt;kbd&gt;C-.&lt;/kbd&gt; will instead jump to definition of the the current candidate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is very useful for me, I jump to definitions more often that describe.&lt;/p&gt;

&lt;h3 id=&quot;bind-arrows&quot;&gt;Bind arrows&lt;/h3&gt;

&lt;p&gt;The actual arrow keys are also bound to the corresponding Emacs arrows.&lt;/p&gt;

&lt;h3 id=&quot;add-a-way-to-exit-ignoring-the-candidates&quot;&gt;Add a way to exit ignoring the candidates&lt;/h3&gt;

&lt;p&gt;If your current input matches a candidate, &lt;kbd&gt;C-m&lt;/kbd&gt; and &lt;kbd&gt;C-j&lt;/kbd&gt; will exit with that candidate.  If you want to exit with your exact input instead, press &lt;kbd&gt;C-u C-j&lt;/kbd&gt;.  This is very useful for creating new files and directories.&lt;/p&gt;

&lt;h3 id=&quot;use-m-q-to-toggle-regexp-quote&quot;&gt;Use &lt;kbd&gt;M-q&lt;/kbd&gt; to toggle &lt;code&gt;regexp-quote&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This can be useful while completing file names (with a lot of dots). Pressing &lt;kbd&gt;M-q&lt;/kbd&gt; toggles between regex and non-regex matching.&lt;/p&gt;

&lt;h3 id=&quot;customize-ivy-re-builders-alist&quot;&gt;Customize &lt;code&gt;ivy-re-builders-alist&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is pretty intricate, look up the variable to see the details. In short, you can use this to apply `regexp-quote&amp;#39; for some types of completion if you want.&lt;/p&gt;

&lt;h3 id=&quot;customize-what-to-do-on-del-error&quot;&gt;Customize what to do on &lt;kbd&gt;DEL&lt;/kbd&gt; error&lt;/h3&gt;

&lt;p&gt;The standard behavior on a &lt;kbd&gt;DEL&lt;/kbd&gt; error (usually empty minibuffer) is to exit the minibuffer.  I like this behavior, since it&amp;#39;s similar to the behavior to fixing wrongly typed chars: only in this case &lt;kbd&gt;DEL&lt;/kbd&gt; &amp;quot;fixes&amp;quot; a wrongly typed command.&lt;/p&gt;

&lt;p&gt;But if you want to customize it, just set &lt;code&gt;ivy-on-del-error-function&lt;/code&gt; to something other than &lt;code&gt;minibuffer-keyboard-quit&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;customize-ivy-extra-directories&quot;&gt;Customize &lt;code&gt;ivy-extra-directories&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Customize this if you don&amp;#39;t want to see &lt;code&gt;../&lt;/code&gt; and &lt;code&gt;./&lt;/code&gt; while completing file names.&lt;/p&gt;

&lt;h3 id=&quot;customize-ivy-sort-functions-alist&quot;&gt;Customize &lt;code&gt;ivy-sort-functions-alist&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Use this variable to customize sorting, depending on what you&amp;#39;re completing.  For example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-sort-functions-alist&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;read-file-name-internal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-sort-file-function-default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;internal-complete-buffer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;counsel-git-grep-function&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;string-lessp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;customize-ivy-subdir-face&quot;&gt;Customize &lt;code&gt;ivy-subdir-face&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;While completing file names, the directories will use &lt;code&gt;ivy-subdir-face&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Big thanks to all who contributed, especially &lt;a href=&quot;https://github.com/tsdh&quot;&gt;@tsdh&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Grep in a git repository using ivy</title>
   <link href="https://oremacs.com/2015/04/19/git-grep-ivy/"/>
   <updated>2015-04-19T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/19/git-grep-ivy</id>
   <content type="html">&lt;p&gt;Just got this request a few minutes ago, and now this feature is in
the &lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/counsel.el&quot;&gt;swiper&lt;/a&gt;
repository (available as &lt;code&gt;counsel&lt;/code&gt; from MELPA).&lt;/p&gt;

&lt;p&gt;The motivation was to write an ivy equivalent of &lt;a href=&quot;https://github.com/yasuyk/helm-git-grep&quot;&gt;helm-git-grep&lt;/a&gt;.
I didn&amp;#39;t use this feature before, but the only thing that I needed to get me started was this shell command:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;git --no-pager grep --full-name -n --no-color -i -e foobar
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The rest of the code (just 20 lines) followed all by itself:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-git-grep-function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;&amp;amp;optional&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;_pred&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;&amp;amp;rest&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;_u&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Grep in the current git repository for STRING.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;split-string&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;shell-command-to-string&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;
     &lt;span class=&quot;s&quot;&gt;&amp;quot;git --no-pager grep --full-name -n --no-color -i -e \&amp;quot;%s\&amp;quot;&amp;quot;&lt;/span&gt;
     &lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel-git-grep&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Grep for a string in the current git repository.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;locate-dominating-file&lt;/span&gt;
                             &lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.git&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pattern: &amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-git-grep-function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;lst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;val&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lst&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;split-string&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forward-line&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-to-number&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cadr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Thanks to the push from Stefan Monnier, &lt;code&gt;ivy-read&lt;/code&gt; also supports a
function to be passed instead of a static collection of strings. In
this case, it&amp;#39;s &lt;code&gt;counsel-git-grep-function&lt;/code&gt; that basically takes one
argument: the thing that we&amp;#39;re looking for.&lt;/p&gt;

&lt;p&gt;After this, &lt;code&gt;shell-command-to-string&lt;/code&gt; is my go-to function to quickly
bring some shell output into Elisp. As you can see, it&amp;#39;s enough to
pass it a shell command in a string form to get a string response.  I
transform the response into a list of line strings with
&lt;code&gt;split-string&lt;/code&gt;, making sure to pass the &lt;code&gt;t&lt;/code&gt; argument to avoid empty
strings.&lt;/p&gt;

&lt;p&gt;One final trick that you can learn for your own Elisp programming is
the &lt;code&gt;let&lt;/code&gt; / &lt;code&gt;default-directory&lt;/code&gt; / &lt;code&gt;(locate-dominating-file default-directory &amp;quot;.git&amp;quot;)&lt;/code&gt; combo.
It&amp;#39;s quite useful for dealing with git shell commands.
And that&amp;#39;s it, it only remains to open a file and jump to the selected line.&lt;/p&gt;

&lt;p&gt;I think that &lt;code&gt;counsel-git-grep&lt;/code&gt; might complement and slightly displace &lt;code&gt;rgrep&lt;/code&gt; or &lt;code&gt;ag&lt;/code&gt; in my setup.
So I&amp;#39;ve given it a nice binding:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c j&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-git-grep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I hope that I&amp;#39;ve made a good case of how easy it is to quickly write
something in Elisp, especially if it&amp;#39;s just a shell command
wrapper. So if you&amp;#39;re on the fence of whether to learn Elisp or not,
do yourself a favor and learn it: it pays off quickly and is a lot of
fun.&lt;/p&gt;

&lt;p&gt;Side note: I&amp;#39;ve mentioned &lt;code&gt;\bfun\b&lt;/code&gt; in this blog 182 times, mostly as a variable representing a function (courtesy of &lt;code&gt;counsel-git-grep&lt;/code&gt;).&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Introducing ivy-mode</title>
   <link href="https://oremacs.com/2015/04/16/ivy-mode/"/>
   <updated>2015-04-16T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/16/ivy-mode</id>
   <content type="html">&lt;p&gt;Today I&amp;#39;d like to introduce a function that has completely replaced
&lt;code&gt;ido-mode&lt;/code&gt; for me: &lt;code&gt;ivy-mode&lt;/code&gt;. It comes with the
&lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt; package, available both in
&lt;a href=&quot;http://melpa.org/#/swiper&quot;&gt;MELPA&lt;/a&gt; and
&lt;a href=&quot;https://elpa.gnu.org/packages/swiper.html&quot;&gt;GNU ELPA&lt;/a&gt;.
The latter is a bit slower to update, so the version there can be a bit outdated sometimes.&lt;/p&gt;

&lt;h2 id=&quot;the-quick-video-demo&quot;&gt;The quick video demo&lt;/h2&gt;

&lt;p&gt;If you prefer listening and watching to reading, check out the video
demo &lt;a href=&quot;https://www.youtube.com/watch?v=VvnJQpTFVDc&quot;&gt;here&lt;/a&gt;.
It repeats most of the stuff written down below.&lt;/p&gt;

&lt;h2 id=&quot;generic-completion&quot;&gt;Generic completion&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;ivy-mode&lt;/code&gt; is simply a minor mode that changes
&lt;code&gt;completing-read-function&lt;/code&gt; to &lt;code&gt;ivy-completing-read&lt;/code&gt; while it&amp;#39;s active.
This function is used in most of the places where Emacs requires
completion, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;execute-extended-command&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-h f&lt;/kbd&gt; &lt;code&gt;describe-function&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-h v&lt;/kbd&gt; &lt;code&gt;describe-variable&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;package-install&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-x b&lt;/kbd&gt; &lt;code&gt;switch-to-buffer&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-x C-f&lt;/kbd&gt; &lt;code&gt;find-file&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, while &lt;code&gt;ivy-mode&lt;/code&gt; is on, all these functions and more will use ivy completion.&lt;/p&gt;

&lt;h2 id=&quot;package-specific-completion&quot;&gt;Package-specific completion&lt;/h2&gt;

&lt;h3 id=&quot;org-mode&quot;&gt;org-mode&lt;/h3&gt;

&lt;p&gt;With the most recent master version, &lt;code&gt;org-mode&lt;/code&gt; will obey
&lt;code&gt;completing-read-function&lt;/code&gt;, so it should work by default.  If you try
it for refiling to headings with similar names, you&amp;#39;ll really notice
how much better &lt;code&gt;ivy-mode&lt;/code&gt; is at it. &lt;code&gt;helm-mode&lt;/code&gt; also does well, if
you don&amp;#39;t mind the large window.&lt;/p&gt;

&lt;h3 id=&quot;magit&quot;&gt;magit&lt;/h3&gt;

&lt;p&gt;This setting is needed to use ivy completion:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;magit-completing-read-function&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-completing-read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;find-file-in-project&quot;&gt;find-file-in-project&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/technomancy/find-file-in-project&quot;&gt;find-file-in-project&lt;/a&gt;
will use ivy by default if it&amp;#39;s available.&lt;/p&gt;

&lt;h3 id=&quot;projectile&quot;&gt;projectile&lt;/h3&gt;

&lt;p&gt;You can set this to make it work:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-completion-system&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;smex&quot;&gt;smex&lt;/h3&gt;

&lt;p&gt;Yes, it&amp;#39;s also possible, since today. Although you&amp;#39;ll have to use my
fork of &lt;a href=&quot;https://github.com/abo-abo/smex&quot;&gt;smex&lt;/a&gt; if you want to try it.
I&amp;#39;ve sent a pull request, it&amp;#39;s all backwards-compatible, so hopefully
it&amp;#39;ll get merged.&lt;/p&gt;

&lt;p&gt;The nice thing is that &lt;code&gt;smex&lt;/code&gt; can take care of the sorting all by
itself, since &lt;code&gt;ivy&lt;/code&gt; doesn&amp;#39;t do that yet.&lt;/p&gt;

&lt;h3 id=&quot;my-packages&quot;&gt;my packages&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt; and
&lt;a href=&quot;https://github.com/abo-abo/function-args&quot;&gt;function-args&lt;/a&gt; use &lt;code&gt;ivy&lt;/code&gt; by
default. You can also enable it for
&lt;a href=&quot;https://github.com/abo-abo/helm-make&quot;&gt;helm-make&lt;/a&gt;, for which the
default is obviously &lt;code&gt;helm&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;file-name-completion&quot;&gt;File name completion&lt;/h2&gt;

&lt;p&gt;When &lt;code&gt;ivy-mode&lt;/code&gt; is on, &lt;code&gt;find-file&lt;/code&gt; will also use it.  The completion
is considerably different from all other cases, since it&amp;#39;s done in
stages, just like &lt;code&gt;ido-find-file&lt;/code&gt; does it.&lt;/p&gt;

&lt;p&gt;The key bindings are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;RET&lt;/kbd&gt; will select the current candidate and finish.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-j&lt;/kbd&gt; will try to continue the completion, i.e. if the
current candidate is a directory, move to that directory. But if the
current candidate is a file or &lt;code&gt;./&lt;/code&gt;, then finish.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;/&lt;/kbd&gt; will switch to completing the sub-directories of &lt;code&gt;/&lt;/code&gt;,
but if the candidate is a perfect match, it will act like
&lt;kbd&gt;C-j&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;~&lt;/kbd&gt; will switch to completing the sub-directories of &lt;code&gt;~/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-n&lt;/kbd&gt; and &lt;kbd&gt;C-p&lt;/kbd&gt; naturally select the next and the previous candidate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;whats-it-all-for&quot;&gt;What&amp;#39;s it all for?&lt;/h2&gt;

&lt;p&gt;Well, for me the advantage is obvious: I get my completion just the
way I like it.  You can use it as well if you find that you like it
more than ido.  I&amp;#39;ll just list a list of features that I like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The current number of candidates is robustly displayed and updated after each key stroke.&lt;/li&gt;
&lt;li&gt;The minibuffer is an actual editing area, where the bindings like
&lt;kbd&gt;C-a&lt;/kbd&gt;, &lt;kbd&gt;M-DEL&lt;/kbd&gt; and &lt;kbd&gt;C-k&lt;/kbd&gt; etc. work just as
you expect. Once you internalize the way that the regex is built, you
can get your match very quickly and intuitively.&lt;/li&gt;
&lt;li&gt;The actual regular expressions constructs like &lt;code&gt;\\b&lt;/code&gt; or &lt;code&gt;$&lt;/code&gt; and &lt;code&gt;^&lt;/code&gt; work. The only thing that works differently
is the space: you can&amp;#39;t match a single space because any amount of spaces translates into the &lt;code&gt;.*&lt;/code&gt; wild card.
But you can use it to your advantage and use the space instead of all the various symbol joining constructs out there, like
&lt;code&gt;snake_case&lt;/code&gt;, or &lt;code&gt;kebab-case&lt;/code&gt; (yeah, it&amp;#39;s totally called that, check the wiki), or &lt;code&gt;whatever/this/is/case&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The familiar &lt;kbd&gt;M-&amp;lt;&lt;/kbd&gt; and &lt;kbd&gt;M-&amp;gt;&lt;/kbd&gt; key bindings also work as expected, navigating you to the first and last candidate respectively.
When you press &lt;kbd&gt;C-p&lt;/kbd&gt; on the first match or &lt;kbd&gt;C-n&lt;/kbd&gt; on the last match, the match will not change, unlike the behavior
of &lt;code&gt;ido&lt;/code&gt; that has annoyed me a lot.&lt;/li&gt;
&lt;li&gt;The minibuffer key bindings can actually be properly customized:
just set &lt;code&gt;ivy-minibuffer-map&lt;/code&gt; to whatever you like, it won&amp;#39;t be
changed. Even in Emacs 24.5, if you customize &lt;code&gt;ido-completion-map&lt;/code&gt;,
the change will be reset.  That was fixed only in the current master.&lt;/li&gt;
&lt;li&gt;You don&amp;#39;t have to rely on &lt;code&gt;flx&lt;/code&gt; or &lt;code&gt;flx-ido&lt;/code&gt; to save you from the overwhelming number of matches.
Instead, you type maybe a bit more, but in return you get a &lt;em&gt;very consistent&lt;/em&gt; and predictable result.
No black boxes or hidden variables that dramatically change the order of candidates from time to time.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Check it out, I hope you like it. And a big thanks to all who
contributed code or bug reports.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Display the initial Hydra hint with a delay</title>
   <link href="https://oremacs.com/2015/04/15/hydra-idle-hint/"/>
   <updated>2015-04-15T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/15/hydra-idle-hint</id>
   <content type="html">&lt;p&gt;More hydra goodness incoming, this time thanks to &lt;a href=&quot;https://github.com/joedicastro&quot;&gt;@joedicastro&lt;/a&gt;.
Firstly, he contributed this awesome-looking &lt;code&gt;twittering-mode&lt;/code&gt; hydra to &lt;a href=&quot;https://github.com/abo-abo/hydra/wiki/Twittering&quot;&gt;the wiki&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://camo.githubusercontent.com/c2c541ec30563223701609c24c5ed5ec7ebf59b6/68747470733a2f2f7062732e7477696d672e636f6d2f6d656469612f43436b336a4851556b4141436e62502e706e673a6c61726765&quot; alt=&quot;hydra-twittering.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;And a similarly nice one for &lt;a href=&quot;https://github.com/abo-abo/hydra/wiki/Helm-2&quot;&gt;helm&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://camo.githubusercontent.com/757f726b2010173505f1c2b32cb9292f9c20ddaa/687474703a2f2f692e696d6775722e636f6d2f696a47703675392e706e67&quot; alt=&quot;hydra-helm-2.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;You can look up the code for both hydras by following the above two links.&lt;/p&gt;

&lt;p&gt;Secondly, he gave me a nice idea in &lt;a href=&quot;https://github.com/abo-abo/hydra/issues/108&quot;&gt;#108&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A nice thing that guide-key has is that you can set an idle time to
wait until you press a key to activate any head before show the
hydra hints buffer (explained in hydra terms). This is very helpful
when you know the key bindings by memory and you do not need to see
the hints buffer, but if you forget how to activate any head, you
simple press the hydra binding and wait the &amp;quot;idle time&amp;quot; and the
hints buffer is shown to help you to choose the right next binding.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So this option is now also possible. Here&amp;#39;s an example, using &lt;code&gt;hydra-toggle&lt;/code&gt; from hydra-examples.el:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-toggle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;
                        &lt;span class=&quot;nb&quot;&gt;:idle&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;toggle&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;abbrev-mode&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;abbrev&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;toggle-debug-on-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;debug&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;auto-fill-mode&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;fill&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;toggle-truncate-lines&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;truncate&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c C-v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-toggle/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So the single change from the old code is &lt;code&gt;:idle 1.0&lt;/code&gt;, which means:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;After a call to &lt;code&gt;hydra-toggle/body&lt;/code&gt;, instead of displaying the hint
as usual, start a timer for 1.0 seconds. Once the timer runs out,
display the hint.  But if the hydra has exited before that time,
cancel the timer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Typically, I&amp;#39;m not a huge fan of timers, but it&amp;#39;s nice to have the
option.  And indeed, I&amp;#39;ve been noticing that I could do without a hint
for some simple and more often used hydras. But a command can go from
often to barely used quickly, and disabling the hint altogether seems
too harsh. A timer could be a nice middle ground, especially since I
can decide whether to use it or not and the interval for each specific
hydra.&lt;/p&gt;

&lt;p&gt;Anyway, thanks for the contributions. Enjoy the new feature, and keep
those good ideas coming!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Org-mode Hydras incoming!</title>
   <link href="https://oremacs.com/2015/04/14/hydra-org-mode/"/>
   <updated>2015-04-14T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/14/hydra-org-mode</id>
   <content type="html">&lt;h2 id=&quot;a-hydra-for-org-mode-time-clock-capture&quot;&gt;A hydra for org-mode time/clock/capture&lt;/h2&gt;

&lt;p&gt;This is a categorized version of the hydra that &lt;a href=&quot;https://github.com/WorldsEndless&quot;&gt;@WorldsEndless&lt;/a&gt; contributed
today to the &lt;a href=&quot;https://github.com/abo-abo/hydra/wiki/Hydras-by-Topic&quot;&gt;wiki&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-global-org&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;
                            &lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Timer^^        ^Clock^         ^Capture^&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;--------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;s_t_art        _w_ clock in    _c_apture&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt; _s_top        _o_ clock out   _l_ast capture&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_r_eset        _j_ clock goto&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_p_rint&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-timer-start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-timer-stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; Need to be at timer&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-timer-set-timer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; Print timer value to buffer&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-timer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-clock-in&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-clock-out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; Visit the clocked task from any buffer&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-clock-goto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-capture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-capture-goto-last-stored&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I&amp;#39;ve bound it like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-global-org/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Previously, I had &lt;kbd&gt;f11&lt;/kbd&gt; bound to &lt;code&gt;org-clock-goto&lt;/code&gt;, thanks to
the &lt;a href=&quot;http://doc.norang.ca/org-mode.html&quot;&gt;Org Mode - Organize Your Life In Plain Text!&lt;/a&gt;
post.  I kind of recommend that post, as it has a tonne of useful
stuff. At the same time, it resulted in me copying too much stuff that I didn&amp;#39;t understand into my config,
ultimately discouraging me from using &lt;code&gt;org-mode&lt;/code&gt;. YMMV.&lt;/p&gt;

&lt;p&gt;Screenshot:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-org-global.png&quot; alt=&quot;hydra-org-global.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;a-hydra-for-refile-archive&quot;&gt;A hydra for refile/archive&lt;/h2&gt;

&lt;p&gt;Inspired by the previous one, I wanted to write a hydra of my own.  As
it happened, I was just about to clean up my git notes. So I wanted a
nice refile hydra to speed up the process.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the hydra&amp;#39;s code, which is now part of
&lt;a href=&quot;https://github.com/abo-abo/worf&quot;&gt;worf&lt;/a&gt;.  Worf is a package for
quickly navigating around an &lt;code&gt;org-mode&lt;/code&gt; buffer, you can get it from
MELPA.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-refile&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
                        &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;teal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Refile:^^   _k_eep: %`org-refile-keep&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;----------------------------------&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_l_ast      _a_rchive&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_o_ther&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_t_his&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;worf-refile-this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;worf-refile-other&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;worf-refile-last&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-refile-keep&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-refile-keep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
       &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-archive-subtree&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Some explanations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;worf-refile-this&lt;/code&gt; will give you a choice of this file&amp;#39;s headings for refiling.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;worf-refile-other&lt;/code&gt; will give you a choice of your &lt;code&gt;org-refile-targets&lt;/code&gt; except the current file.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;worf-refile-last&lt;/code&gt; will refile to the last refile location without prompting.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;k&lt;/kbd&gt; will toggle &lt;code&gt;org-refile-keep&lt;/code&gt;, which decides if refiling moves or copies the text.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And here&amp;#39;s how it looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-refile.png&quot; alt=&quot;hydra-refile.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Thanks for the contribution, enjoy the new stuff.
Also, if you ever want to dig around someone&amp;#39;s git notes, you can read &lt;a href=&quot;/public/git-notes/git.html&quot;&gt;mine&lt;/a&gt;,
courtesy of &lt;code&gt;org-mode&lt;/code&gt; export.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hydra 0.13.0 is out</title>
   <link href="https://oremacs.com/2015/04/13/hydra-0.13.0/"/>
   <updated>2015-04-13T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/13/hydra-0.13.0</id>
   <content type="html">&lt;p&gt;A lot of the changes for this release aren&amp;#39;t very user-visible, although they
are important in improving the usability.  The main change is the move from the
standard &lt;code&gt;set-transient-map&lt;/code&gt; to my own &lt;code&gt;hydra-set-transient-map&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This change has allowed to remove the part where the amaranth and pink hydras
intercept a binding which doesn&amp;#39;t belong to them and then try to forward it back
to Emacs. It was done in this way, which might be interesting for people who
write Elisp:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-keymap&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-intercept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Binding &lt;code&gt;t&lt;/code&gt; means that when the keymap is active, any binding which doesn&amp;#39;t
belong to the keymap will be interpreted as &lt;code&gt;t&lt;/code&gt;.  Then, I would use &lt;code&gt;lookup-key&lt;/code&gt;
and &lt;code&gt;this-command-keys&lt;/code&gt; and try to call the result.  That method was quite
fragile:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It didn&amp;#39;t work for prefix keys while a pink hydra was active.&lt;/li&gt;
&lt;li&gt;It didn&amp;#39;t work for some keys in the terminal because of &lt;code&gt;input-decode-map&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The new method solves the mentioned issues by not using &lt;code&gt;t&lt;/code&gt; and instead running
this function in the &lt;code&gt;pre-command-hook&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra--clearfun&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Disable the current Hydra unless &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`this-command&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; is a head.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;memq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;this-command&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;handle-switch-frame&lt;/span&gt;
                           &lt;span class=&quot;nv&quot;&gt;keyboard-quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-disable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;this-command&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lookup-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-curr-map&lt;/span&gt;
                            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;this-single-command-keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cl-case&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-curr-foreign-keys&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;warn&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;this-command&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-amaranth-warn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;run&lt;/span&gt;
                 &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-disable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This approach is actually very similar to what the built-in &lt;code&gt;set-transient-map&lt;/code&gt;
does from Emacs 24.4 onward.  Of course, changing the a large cog in the Hydra
mechanism can lead to some new bugs, or even old bugs to re-surface. So I really
appreciate the help from &lt;a href=&quot;https://github.com/jhonnyseven&quot;&gt;@jhonnyseven&lt;/a&gt; in testing the new code.&lt;/p&gt;

&lt;p&gt;As always, if you find something very broken, you can roll back to &lt;a href=&quot;http://elpa.gnu.org/packages/hydra.html&quot;&gt;the GNU ELPA version&lt;/a&gt;
and raise an &lt;a href=&quot;https://github.com/abo-abo/hydra/issues&quot;&gt;issue&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;fixes&quot;&gt;Fixes&lt;/h2&gt;

&lt;h3 id=&quot;single-command-red-blue-issue&quot;&gt;single command red/blue issue&lt;/h3&gt;

&lt;p&gt;Fix the uniqueness issue, when a single command is assigned to both a
red and a blue head.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s an example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-zoom&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f2&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;zoom&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-increase&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;in&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-decrease&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;out&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;text-scale-set&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;reset&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;text-scale-set&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:bind&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;text-scale-set&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:bind&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, three heads are assigned &lt;code&gt;(text-scale-set 0)&lt;/code&gt;, however their behavior is different:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;r&lt;/kbd&gt; doesn&amp;#39;t exit and has a string hint.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;0&lt;/kbd&gt; exits and has an empty hint (so only the key is in the docstring).&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;1&lt;/kbd&gt; exits and has a nil hint (will not be displayed in the docstring).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The latter two call &lt;code&gt;hydra-zoom/lambda-0-and-exit&lt;/code&gt;, while &lt;kbd&gt;r&lt;/kbd&gt;
calls &lt;code&gt;hydra-zoom/lambda-r&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;dont-default-hydra-repeast-prefix-arg-to-1&quot;&gt;Don&amp;#39;t default &lt;code&gt;hydra-repeast--prefix-arg&lt;/code&gt; to 1&lt;/h3&gt;

&lt;p&gt;See &lt;a href=&quot;https://github.com/abo-abo/hydra/issues/61&quot;&gt;#61&lt;/a&gt; for more info.&lt;/p&gt;

&lt;h3 id=&quot;allow-hydra-repeat-to-take-a-numeric-arg&quot;&gt;Allow &lt;code&gt;hydra-repeat&lt;/code&gt; to take a numeric arg&lt;/h3&gt;

&lt;p&gt;For &lt;code&gt;hydra-vi&lt;/code&gt;, it&amp;#39;s now possible to do this &lt;kbd&gt;4j.2..&lt;/kbd&gt;.
The line will be forwarded:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;4 times by &lt;kbd&gt;4j&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;4 times by &lt;kbd&gt;.&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;2 times by &lt;kbd&gt;2.&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;2 times by &lt;kbd&gt;.&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;See &lt;a href=&quot;https://github.com/abo-abo/hydra/issues/92&quot;&gt;#92&lt;/a&gt; for more info.&lt;/p&gt;

&lt;h3 id=&quot;key-chord-will-be-disabled-for-the-duration-of-a-hydra&quot;&gt;Key chord will be disabled for the duration of a hydra&lt;/h3&gt;

&lt;p&gt;This means that hydras have become much more easy to use with key chords.  For
instance, if &lt;kbd&gt;dj&lt;/kbd&gt; key chord calls a hydra or is part of the hydra, you
won&amp;#39;t call the &lt;kbd&gt;jj&lt;/kbd&gt; key chord by accident with &lt;kbd&gt;djj&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;See &lt;a href=&quot;https://github.com/abo-abo/hydra/issues/97&quot;&gt;#97&lt;/a&gt; for more info.&lt;/p&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New Features&lt;/h2&gt;

&lt;h3 id=&quot;variable-as-a-string-docstring-spec&quot;&gt;Variable as a string docstring spec&lt;/h3&gt;

&lt;p&gt;You can now use this form in your hydras:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;foo&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;a b c&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  bar %s`foo&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Previously, it would only work for &lt;code&gt;%s(foo)&lt;/code&gt; forms.&lt;/p&gt;

&lt;h3 id=&quot;bind-property-can-also-be-a-keymap&quot;&gt;&lt;code&gt;:bind&lt;/code&gt; property can also be a keymap&lt;/h3&gt;

&lt;p&gt;If you remember, you can set &lt;code&gt;:bind&lt;/code&gt; in the body to define in which way the
heads should be bound &lt;em&gt;outside&lt;/em&gt; the Hydra. You also assign/override &lt;code&gt;:bind&lt;/code&gt; for
each head.  This is especially useful to set &lt;code&gt;:bind&lt;/code&gt; to nil for a few heads that
you don&amp;#39;t want to bind outside.&lt;/p&gt;

&lt;p&gt;Previously, &lt;code&gt;:bind&lt;/code&gt; could be either a lambda or nil. Now a keymap is also accepted.&lt;/p&gt;

&lt;h3 id=&quot;integration-tests&quot;&gt;Integration tests&lt;/h3&gt;

&lt;p&gt;In addition to the abundant macro-expansion tests, integration tests are now
also running, both for &lt;code&gt;emacs24&lt;/code&gt; and for &lt;code&gt;emacs-snapshot&lt;/code&gt;. This means that hydra
should be a lot more stable now.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s an example test:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-simple-1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ert-deftest&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-integration-1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-with&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;|&amp;quot;&lt;/span&gt;
                               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;execute-kbd-macro&lt;/span&gt;
                                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c aabbaaqaabbaa&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
                   &lt;span class=&quot;s&quot;&gt;&amp;quot;jjkkjjaabbaa|&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-with&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;|&amp;quot;&lt;/span&gt;
                               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;condition-case&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
                                   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;execute-kbd-macro&lt;/span&gt;
                                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c aabb C-g&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;quit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;execute-kbd-macro&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;aaqaabbaa&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                   &lt;span class=&quot;s&quot;&gt;&amp;quot;jjkkaaqaabbaa|&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the tests above, &lt;code&gt;hydra-simple&lt;/code&gt; is a defined and bound hydra. &lt;code&gt;&amp;quot;|&amp;quot;&lt;/code&gt;
represents the buffer text (empty), where &lt;code&gt;|&lt;/code&gt; is the point position.
And &lt;code&gt;(kbd &amp;quot;C-c aabbaaqaabbaa&amp;quot;)&lt;/code&gt; represents the key sequence that you can normally press by hand.
Finally, &lt;code&gt;&amp;quot;jjkkjjaabbaa|&amp;quot;&lt;/code&gt; is what the buffer and the point position should look like afterwards.
If you find a hydra bug, it would be really cool to submit a new integration test to make sure that
this bug doesn&amp;#39;t happen in the future.&lt;/p&gt;

&lt;h3 id=&quot;basic-error-handling&quot;&gt;Basic error handling&lt;/h3&gt;

&lt;p&gt;I really like the &lt;a href=&quot;https://github.com/jwiegley/use-package&quot;&gt;use-package&lt;/a&gt; feature where it catches load-time errors and issues a message instead of bringing up the debugger. This is really useful, since it&amp;#39;s hard to fix the bug with a mostly broken Emacs, in the case when the error happened early in the load process. So the same behavior now happens with &lt;code&gt;defhydra&lt;/code&gt;. In case of an error, &lt;code&gt;defhydra&lt;/code&gt; will be equivalent to a no-op, and the error message will be written to the &lt;code&gt;*Messages*&lt;/code&gt; buffer.&lt;/p&gt;

&lt;h3 id=&quot;use-a-variable-instead-of-a-function-for-the-hint&quot;&gt;Use a variable instead of a function for the hint&lt;/h3&gt;

&lt;p&gt;This leads up to the yet unresolved &lt;a href=&quot;https://github.com/abo-abo/hydra/issues/86&quot;&gt;#86&lt;/a&gt;, which asks
for heads to be activated conditionally.&lt;/p&gt;

&lt;p&gt;For now, you can modify the docstring on your own if you wish.
Here&amp;#39;s some code from the expansion of &lt;code&gt;hydra-zoom&lt;/code&gt; to explain what I mean:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-zoom/hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;Dynamic hint for hydra-zoom.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;#(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;zoom: [g]: in, [l]: out.&amp;quot;&lt;/span&gt;
     &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;face&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-face-red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;17&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;face&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-face-red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; in head body:&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-is-helpful&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-lv&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lv-message&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eval&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-zoom/hint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;message&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eval&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-zoom/hint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Eventually, I&amp;#39;ll add some automatic stuff to fix #86. But for now, you can
experiment with modifying e.g. &lt;code&gt;hydra-zoom/hint&lt;/code&gt; inside heads, if you want.&lt;/p&gt;

&lt;h3 id=&quot;multiple-inheritance-for-hydra-heads&quot;&gt;Multiple inheritance for Hydra heads&lt;/h3&gt;

&lt;p&gt;Each hydra, e.g. &lt;code&gt;hydra-foo&lt;/code&gt; will now declare its own heads as a variable
&lt;code&gt;hydra-foo/heads&lt;/code&gt;. It&amp;#39;s possible to inherit them like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-zoom&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f2&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;zoom&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-increase&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;in&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-decrease&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;out&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-arrows&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;left&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;down&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;up&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forward-char&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;right&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-zoom-child&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:inherit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-zoom/heads&lt;/span&gt;
                                      &lt;span class=&quot;nv&quot;&gt;hydra-arrows/heads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                            &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;amaranth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;zoom&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;hydra-zoom-child&lt;/code&gt; inherits the heads of &lt;code&gt;hydra-zoom&lt;/code&gt; and &lt;code&gt;hydra-arrows&lt;/code&gt;.
It adds one more head &lt;kbd&gt;q&lt;/kbd&gt; to quit. Also, it changes the color to
amaranth, which means that it&amp;#39;s only possible to exit it with &lt;kbd&gt;q&lt;/kbd&gt; or
&lt;kbd&gt;C-g&lt;/kbd&gt;. This hydra&amp;#39;s parents remain at their original (red) color.&lt;/p&gt;

&lt;p&gt;See &lt;a href=&quot;https://github.com/abo-abo/hydra/issues/57&quot;&gt;#57&lt;/a&gt; for more info.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;A big thanks to all who contributed towards this release and to &lt;a href=&quot;https://github.com/abo-abo/hydra/wiki&quot;&gt;the wiki&lt;/a&gt;.
If you have an idea that would be cool in Hydra, do raise &lt;a href=&quot;https://github.com/abo-abo/hydra/issues&quot;&gt;an issue&lt;/a&gt;.
And if you written some cool code that uses the already available Hydra features, please share it on the wiki.
It&amp;#39;s also a good way to protect your code against regressions (although the best one would be an integration test).&lt;/p&gt;

&lt;p&gt;Finally, check out the new version of
&lt;a href=&quot;https://github.com/joostkremers/pandoc-mode&quot;&gt;pandoc-mode&lt;/a&gt; which is
one of the coolest and most elaborate uses of Hydra yet.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Complete stuff with Counsel</title>
   <link href="https://oremacs.com/2015/04/09/counsel-completion/"/>
   <updated>2015-04-09T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/09/counsel-completion</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;If you like my package &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt;,
I&amp;#39;m sure you&amp;#39;ll also like &lt;a href=&quot;http://melpa.org/#/counsel&quot;&gt;counsel&lt;/a&gt;. It
lives in the same repository, but you can install it separately from
MELPA.&lt;/p&gt;

&lt;p&gt;Counsel uses &lt;code&gt;ivy&lt;/code&gt; - the same method as &lt;code&gt;swiper&lt;/code&gt; to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complete Elisp at point with &lt;code&gt;counsel-el&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Complete Clojure at point with &lt;code&gt;counsel-clj&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Open a git-managed file with &lt;code&gt;counsel-git&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Describe an Elisp variable with &lt;code&gt;counsel-describe-variable&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Describe an Elisp function with &lt;code&gt;counsel-describe-function&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Look up an Elisp symbol in the info with &lt;code&gt;counsel-info-lookup-symbol&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Insert a Unicode character at point with &lt;code&gt;counsel-unicode-char&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below, I&amp;#39;ll describe the functions that I added just today.&lt;/p&gt;

&lt;h3 id=&quot;counsel-describe-function&quot;&gt;&lt;code&gt;counsel-describe-function&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is just a replacement for &lt;code&gt;describe-function&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-describe-function.png&quot; alt=&quot;counsel-describe-function.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;As you can see, regular expressions work here as well.  The
space-splitting behavior is the same as in &lt;code&gt;swiper&lt;/code&gt;, so don&amp;#39;t expect
to be able to match a single space: spaces are wild.&lt;/p&gt;

&lt;h3 id=&quot;counsel-describe-variable&quot;&gt;&lt;code&gt;counsel-describe-variable&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is just a replacement for &lt;code&gt;describe-variable&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-describe-variable.png&quot; alt=&quot;counsel-describe-variable.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Well, actually I&amp;#39;ve used &lt;code&gt;ido-mode&lt;/code&gt; with &lt;code&gt;flx&lt;/code&gt; matching for these two
functions before. In my experience, &lt;code&gt;ivy&lt;/code&gt; handles much better:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;you are in charge of which regex you&amp;#39;re searching for&lt;/li&gt;
&lt;li&gt;you see the candidate count&lt;/li&gt;
&lt;li&gt;no crazy wrap-around candidate cycling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And it works faster, too.&lt;/p&gt;

&lt;p&gt;Here are my bindings:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f1&amp;gt; f&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-describe-function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f1&amp;gt; v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-describe-variable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;counsel-info-lookup-symbol&quot;&gt;&lt;code&gt;counsel-info-lookup-symbol&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-info-lookup-symbol.png&quot; alt=&quot;counsel-info-lookup-symbol.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;I don&amp;#39;t use this one too often, but it&amp;#39;s nice to have the option:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f2&amp;gt; i&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;counsel-info-lookup-symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;counsel-unicode-char&quot;&gt;&lt;code&gt;counsel-unicode-char&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-unicode-char.png&quot; alt=&quot;counsel-unicode-char.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;At around 40000 candidates, &lt;code&gt;ivy&lt;/code&gt; starts to feel clunky (around 0.1s
display delay). Unfortunately, I don&amp;#39;t really see a way around this,
except using tricks like &lt;code&gt;while-no-input&lt;/code&gt;, which didn&amp;#39;t work right
when I tried it earlier. It would be really cool to do the completion
in another thread, but alas.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Give the new functions a try. I think &lt;code&gt;ivy&lt;/code&gt; can become a viable &lt;code&gt;ido&lt;/code&gt;
replacement, at least it has done so for me: the only &lt;code&gt;ido&lt;/code&gt; functions
that I&amp;#39;m still using are &lt;code&gt;ido-switch-buffer&lt;/code&gt; and &lt;code&gt;ido-find-file&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Also, if you&amp;#39;re using &lt;code&gt;projectile&lt;/code&gt;, you can use &lt;code&gt;ivy&lt;/code&gt; completion for it:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-completion-system&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Rule-based multi-line in lispy</title>
   <link href="https://oremacs.com/2015/04/06/lispy-multiline/"/>
   <updated>2015-04-06T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/06/lispy-multiline</id>
   <content type="html">&lt;h2 id=&quot;where-do-one-line-expressions-come-from&quot;&gt;Where do one-line expressions come from?&lt;/h2&gt;

&lt;p&gt;When programming LISP, especially with &lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;, it&amp;#39;s easy to
generate random one-line expressions. This is, of course, because the results of &lt;code&gt;read&lt;/code&gt; or &lt;code&gt;eval&lt;/code&gt;
don&amp;#39;t contain any whitespace information: all original newlines are lost.&lt;/p&gt;

&lt;p&gt;Just to review the multitude of ways to insert generated code into a buffer using &lt;code&gt;lispy&lt;/code&gt; I&amp;#39;ll list
the shortcuts and the test-based explanations (at around 2000 lines of tests and 54% test coverage,
&lt;code&gt;lispy&lt;/code&gt; is pretty well tested).&lt;/p&gt;

&lt;h3 id=&quot;eval-and-insert&quot;&gt;eval-and-insert&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;E&lt;/kbd&gt; calls &lt;code&gt;lispy-eval-and-insert&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lispy-test-eval-and-insert.png&quot; alt=&quot;lispy-test-eval-and-insert.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;The image above is generated using the interactive test visualizer &lt;code&gt;lispy-view-test&lt;/code&gt;, bound to
&lt;kbd&gt;xv&lt;/kbd&gt;. If you want to explore how a certain command is intended to behave, just find the
corresponding test (with the same name as the command) and call &lt;kbd&gt;xv&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;eval-and-replace&quot;&gt;eval-and-replace&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;xr&lt;/kbd&gt; calls &lt;code&gt;lispy-eval-and-replace&lt;/code&gt;.  This function evaluates the current expression and
replaces it with the result.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lispy-test-eval-and-replace.png&quot; alt=&quot;lispy-test-eval-and-replace.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;The sequence of actions in the test:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;e&lt;/kbd&gt; calls &lt;code&gt;lispy-eval&lt;/code&gt; to set &lt;code&gt;foo&lt;/code&gt; to &lt;code&gt;42&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;j&lt;/kbd&gt; calls &lt;code&gt;lispy-down&lt;/code&gt; to move to the next sexp.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;xr&lt;/kbd&gt; calls &lt;code&gt;lispy-eval-and-replace&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ideally, there should have been &lt;code&gt;&amp;quot;xr&amp;quot;&lt;/code&gt; instead of &lt;code&gt;(lispy-eval-and-replace)&lt;/code&gt; in the test, but
there&amp;#39;s a small wrinkle in the &lt;code&gt;lispy-with&lt;/code&gt; macro that needs to be fixed before that can happen.&lt;/p&gt;

&lt;h3 id=&quot;flatten&quot;&gt;flatten&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;xf&lt;/kbd&gt; calls &lt;code&gt;lispy-flatten&lt;/code&gt;. This function expands in-place the current function or macro
call.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lispy-test-flatten.png&quot; alt=&quot;lispy-test-flatten.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;In this test, the misleadingly named function &lt;code&gt;square&lt;/code&gt; is evaluated and flattened, to see if the
&lt;code&gt;&amp;amp;optional&lt;/code&gt; and &lt;code&gt;&amp;amp;rest&lt;/code&gt; argument passing rules indeed work.&lt;/p&gt;

&lt;p&gt;The flatten operation works really well for Elisp and quite well for Clojure.  The CL implementation
would need to heavily rely on SLIME features (currently absent), since the CL spec doesn&amp;#39;t define an
equivalent of Elisp&amp;#39;s &lt;code&gt;symbol-function&lt;/code&gt;. The same applies to Scheme, I guess.&lt;/p&gt;

&lt;h3 id=&quot;oneline&quot;&gt;oneline&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;O&lt;/kbd&gt; calls &lt;code&gt;lispy-oneline&lt;/code&gt;. It&amp;#39;s not eval-based, it just deletes the newlines.
If there are any comments present, they are pushed out.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lispy-test-oneline.png&quot; alt=&quot;lispy-test-oneline.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;lispy-alt-multiline-demo-1&quot;&gt;&lt;code&gt;lispy-alt-multiline&lt;/code&gt; Demo 1&lt;/h2&gt;

&lt;p&gt;In the following image, I just press &lt;kbd&gt;T&lt;/kbd&gt; once, starting from an unchanged buffer:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lispy-alt-multiline-1.gif&quot; alt=&quot;lispy-alt-multiline-1.gif&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;lispy-alt-multiline-demo-2&quot;&gt;&lt;code&gt;lispy-alt-multiline&lt;/code&gt; Demo 2&lt;/h2&gt;

&lt;h3 id=&quot;flatten-push&quot;&gt;Flatten &lt;code&gt;push&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Start from this code (the cursor is in the CSS, if you don&amp;#39;t see it):&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot;
data-lang=&quot;elisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dotimes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&lt;cursor&gt;(&lt;/cursor&gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nreverse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After &lt;kbd&gt;xf&lt;/kbd&gt; it becomes:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dotimes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&lt;cursor&gt;(&lt;/cursor&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nreverse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Since &lt;code&gt;push&lt;/code&gt; is a macro, &lt;code&gt;macroexpand&lt;/code&gt; is used. And since &lt;code&gt;macroexpand&lt;/code&gt; doesn&amp;#39;t give newline
information, &lt;code&gt;pp-to-string&lt;/code&gt; is used, and it gives a reasonable result.&lt;/p&gt;

&lt;h3 id=&quot;flatten-dotimes&quot;&gt;Flatten &lt;code&gt;dotimes&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Start with the same code, but with cursor on &lt;code&gt;dotimes&lt;/code&gt; this time:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot;
data-lang=&quot;elisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&lt;cursor&gt;(&lt;/cursor&gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dotimes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nreverse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After &lt;kbd&gt;xf&lt;/kbd&gt; it becomes:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&lt;cursor&gt;(&lt;/cursor&gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cl--block-wrapper&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;--cl-block-nil--&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;--dotimes-limit--&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;--dotimes-limit--&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1+&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nreverse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This time &lt;code&gt;pp-to-string&lt;/code&gt; isn&amp;#39;t as good: &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;while&lt;/code&gt; statements are messed up.
Follow this up with &lt;kbd&gt;T&lt;/kbd&gt; which calls &lt;code&gt;lispy-alt-multiline&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;&lt;cursor&gt;(&lt;/cursor&gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cl--block-wrapper&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;--cl-block-nil--&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;--dotimes-limit--&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;
                 &lt;span class=&quot;nv&quot;&gt;--dotimes-limit--&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;
                     &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1+&lt;/span&gt;
                &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nreverse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Well, at least some parts look better. It could be make perfect by adding a sort of threshold when
printing each sub-expression. It&amp;#39;s less than, say &lt;code&gt;15&lt;/code&gt; chars, which &lt;code&gt;(setq i (1+ i))&lt;/code&gt; is, no
newlines should be added. I&amp;#39;ll add this a bit later.&lt;/p&gt;

&lt;h2 id=&quot;more-on-lispy-alt-multiline&quot;&gt;More on &lt;code&gt;lispy-alt-multiline&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;lispy-alt-multiline&lt;/code&gt; can be used on a LISP expression to re-format it across multiple lines.  It
doesn&amp;#39;t matter in which shape the expression currently is, since all current newlines will be removed
before the algorithm starts.&lt;/p&gt;

&lt;p&gt;This has to be done with some rules, since a one-line expression can transform to multiple viable
multi-line forms. So far, these rules are implemented by customizing these variables:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy--multiline-take-3&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;defmacro&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;defgroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;List of constructs for which the first 3 elements are on the first line.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy--multiline-take-2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defface&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;define-minor-mode&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;condition-case&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;incf&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;incf&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;decf&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;cl-incf&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cl-decf&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;provide&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;List of constructs for which the first 2 elements are on the first line.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The name suggests that there should be &lt;code&gt;lispy-multiline&lt;/code&gt;, and there is, bound to &lt;kbd&gt;M&lt;/kbd&gt;.  The
difference between &lt;kbd&gt;M&lt;/kbd&gt; and &lt;kbd&gt;T&lt;/kbd&gt; is that &lt;kbd&gt;M&lt;/kbd&gt; is older and ad-hoc, while
&lt;kbd&gt;T&lt;/kbd&gt; is newer and rule-based. This means that the latter can misbehave, since it&amp;#39;s not yet
fully tested. However, it has the following built-in check to make sure that it doesn&amp;#39;t mess up your
code:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;read&lt;/code&gt; of the expression before transformation should be &lt;code&gt;equal&lt;/code&gt; to the &lt;code&gt;read&lt;/code&gt; of the
transformed expression.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If the above check fails, no change will be performed on the source code. So your code should be
pretty safe. One more cool thing that I want to add to other operations is that it checks if the
buffer will be changed after the transformation. If there will be no change, it will just issue a
&lt;code&gt;&amp;quot;No change&amp;quot;&lt;/code&gt; message, and no change will be performed. This is really cool if you obsess about the
buffer changed marker in the mode line like I do.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;The functions bound to &lt;kbd&gt;O&lt;/kbd&gt;, &lt;kbd&gt;M&lt;/kbd&gt;, and &lt;kbd&gt;T&lt;/kbd&gt; apply to the current expression.
To be really sure which one, turn on &lt;code&gt;show-paren-mode&lt;/code&gt;.  You can also call these functions not from
special, although it&amp;#39;s not very convenient. The typical strategy in that case would be to bind all
of them on a prefix map, e.g. &lt;kbd&gt;C-c&lt;/kbd&gt;.
How is it different from &lt;a href=&quot;https://github.com/abo-abo/lispy#how-to-get-into-list-editing-mode-special&quot;&gt;special&lt;/a&gt; then?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Instead of typing &lt;kbd&gt;[T&lt;/kbd&gt; you would type &lt;kbd&gt;C-c T&lt;/kbd&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But the advantage of the special approach is that &lt;kbd&gt;[&lt;/kbd&gt;
actually does something (moves point to the start of the current list),
instead of just being a useless part of a key combination like &lt;kbd&gt;C-c&lt;/kbd&gt;.
And if you&amp;#39;re in special already, there&amp;#39;s no need for &lt;kbd&gt;[&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;I hope that you enjoy the new update. If it&amp;#39;s needed, variables like &lt;code&gt;lispy--multiline-take-3&lt;/code&gt; can
be made buffer-local so that &lt;kbd&gt;T&lt;/kbd&gt; works appropriately for Clojure, CL and Scheme, instead of
just Elisp. If you&amp;#39;d like to add support for your favorite dialect in this way, I&amp;#39;d be happy to
explain some details if needed and to merge the PR. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Paredit emulation in lispy</title>
   <link href="https://oremacs.com/2015/04/02/lispy-paredit-emulation/"/>
   <updated>2015-04-02T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/02/lispy-paredit-emulation</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;I just finished this feature today.  Almost all Paredit functionality is available in terms of
&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;&amp;#39;s own functions.  The only functions that I didn&amp;#39;t
implement were the ones that I didn&amp;#39;t find any use for: &lt;code&gt;paredit-backslash&lt;/code&gt; (ugh, prompts),
&lt;code&gt;paredit-comment-dwim&lt;/code&gt; (covered by regular &lt;kbd&gt;;&lt;/kbd&gt;), &lt;code&gt;paredit-forward-down&lt;/code&gt; and
&lt;code&gt;paredit-backward-down&lt;/code&gt; (both just move out of special, and throw a lot).&lt;/p&gt;

&lt;h2 id=&quot;setting-the-keymap-theme&quot;&gt;Setting the keymap theme&lt;/h2&gt;

&lt;p&gt;So if you ever thought that &lt;code&gt;lispy&lt;/code&gt; could be a good idea, but the non-special key bindings are weird,
and you&amp;#39;re too used to Paredit, you can now try this setting:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-set-key-theme&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;special&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;paredit&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c-digits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s the setting that I&amp;#39;m using, since I love &lt;code&gt;lispy&lt;/code&gt;&amp;#39;s default bindings:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-set-key-theme&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;oleh&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;special&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c-digits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The default setting actually is this one, &lt;code&gt;lispy-mode-map-oleh&lt;/code&gt; is an additional map for use with
my &lt;a href=&quot;http://oremacs.com/2015/02/14/semi-xmodmap/&quot;&gt;Xmodmap setup&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-set-key-theme&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;special&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c-digits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Each item in the list passed to &lt;code&gt;lispy-set-key-theme&lt;/code&gt; designates a keymap to turn on.
So in a non-LISP buffer you could turn on just the special map:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-set-key-theme&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;special&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This would mean that zero regular bindings get overridden, but when the point is before or after a
paren, you get the &lt;code&gt;lispy&lt;/code&gt; bindings. Actually, I&amp;#39;ve just enabled &lt;code&gt;lispy-mode&lt;/code&gt; for &lt;code&gt;markdown-mode&lt;/code&gt;,
and it&amp;#39;s working great. Unfortunately, I haven&amp;#39;t yet figured out how to make a minor mode&amp;#39;s keymap
buffer-local. Maybe someone reading has an idea.&lt;/p&gt;

&lt;h2 id=&quot;the-screencast&quot;&gt;The screencast&lt;/h2&gt;

&lt;p&gt;I went through all of Paredit tests and made ERT tests out of them, to make sure that the features
are actually working. I&amp;#39;ve recorded a short (&amp;lt;3 minutes)
&lt;a href=&quot;https://www.youtube.com/watch?v=RDcc3RBQ9Gw&quot;&gt;screencast&lt;/a&gt; of implementing one of the tests.  Have a
look, maybe you&amp;#39;ll something interesting in my setup. There are two short pauses in the video,
that&amp;#39;s just me thinking how to write down a function. My ERT and Magit workflows are also shown.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;The new key-theme feature is meant to make &lt;code&gt;lispy&lt;/code&gt; super-not-annoying. I think it&amp;#39;s useful, since
using &lt;code&gt;lispy&lt;/code&gt; in Paredit mode was annoying for me, so the opposite has to be true for people that
are used to Paredit. So if you notice a bug, please &lt;a href=&quot;https://github.com/abo-abo/lispy/issues&quot;&gt;report it&lt;/a&gt;, bug
reports are very important for my non-annoyance agenda.&lt;/p&gt;

&lt;p&gt;Finally, if you&amp;#39;re super-devoted to Paredit and don&amp;#39;t want to drop it, now you can easily have both
&lt;code&gt;lispy-mode&lt;/code&gt; and &lt;code&gt;paredit-mode&lt;/code&gt; on. Just use this setting:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-set-key-theme&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;special&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Or this one if you additionally want &lt;kbd&gt;C-1&lt;/kbd&gt; to show the inline doc, and &lt;kbd&gt;C-2&lt;/kbd&gt; to show
the inline args:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-set-key-theme&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;special&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c-digits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>lispy 0.25.0 is out</title>
   <link href="https://oremacs.com/2015/04/01/lispy.0.25.0-is-out/"/>
   <updated>2015-04-01T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/04/01/lispy.0.25.0-is-out</id>
   <content type="html">&lt;p&gt;Seriously, check &lt;a href=&quot;https://github.com/abo-abo/lispy/releases/tag/0.25.0&quot;&gt;the release notes&lt;/a&gt; if you
don&amp;#39;t believe me.&lt;/p&gt;

&lt;h2 id=&quot;fixes&quot;&gt;Fixes&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;minibuffer-inactive-mode&lt;/code&gt; to the &lt;code&gt;lispy-elisp-modes&lt;/code&gt; list. It means that you can eval there if you want.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;V&lt;/kbd&gt; (&lt;code&gt;lispy-visit&lt;/code&gt;) should turn on &lt;code&gt;projectile-global-mode&lt;/code&gt; if it&amp;#39;s not on.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M&lt;/kbd&gt; (&lt;code&gt;lispy-multiline&lt;/code&gt;) works better for Clojure: the regexes for vectors, maps and sets have been improved.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-k&lt;/kbd&gt; should not delete only the string when located at start of string.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M&lt;/kbd&gt; will not turn vectors into lists any more.&lt;/li&gt;
&lt;li&gt;the backquote bug for &lt;kbd&gt;i&lt;/kbd&gt; and &lt;kbd&gt;M&lt;/kbd&gt; was fixed.&lt;/li&gt;
&lt;li&gt;you can flatten Elisp closures as well, at least the plain ones.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New Features&lt;/h2&gt;

&lt;h3 id=&quot;b-calls-lispy-back&quot;&gt;&lt;kbd&gt;b&lt;/kbd&gt; calls &lt;code&gt;lispy-back&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;The movement commands, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the arrows &lt;kbd&gt;hjkl&lt;/kbd&gt; (&lt;code&gt;lispy-left&lt;/code&gt;, &lt;code&gt;lispy-down&lt;/code&gt; etc.)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;f&lt;/kbd&gt; (&lt;code&gt;lispy-flow&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;q&lt;/kbd&gt; (&lt;code&gt;lispy-ace-paren&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;i&lt;/kbd&gt; (&lt;code&gt;lispy-tab&lt;/code&gt;), only when called for an active region&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;will not store each movement in the point-and-mark history. You can press &lt;kbd&gt;b&lt;/kbd&gt; to go back in
history. This is especially useful for &lt;kbd&gt;h&lt;/kbd&gt;, &lt;kbd&gt;l&lt;/kbd&gt;, and &lt;kbd&gt;f&lt;/kbd&gt;, since they are
not trivially reversible.&lt;/p&gt;

&lt;p&gt;&lt;kbd&gt;b&lt;/kbd&gt; was previously bound to &lt;code&gt;lispy-store-region-and-buffer&lt;/code&gt;, so you could do Ediff with
&lt;kbd&gt;b&lt;/kbd&gt; and &lt;kbd&gt;B&lt;/kbd&gt;. Now it&amp;#39;s bound to &lt;kbd&gt;xB&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;hungry-comment-delete&quot;&gt;Hungry comment delete&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;C-d&lt;/kbd&gt; (&lt;code&gt;lispy-delete&lt;/code&gt;) when positioned at the start of a comment, and with only whitespace
before the start of the line, will delete the whole comment.&lt;/p&gt;

&lt;p&gt;If you want to un-comment, just use &lt;kbd&gt;C-u ;&lt;/kbd&gt; from any point in the comment.&lt;/p&gt;

&lt;h3 id=&quot;added-flatten-operation-for-clojure&quot;&gt;Added flatten operation for Clojure&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;xf&lt;/kbd&gt; (&lt;code&gt;lispy-flatten&lt;/code&gt;) now also works for Clojure, before it was only for Elisp.&lt;/p&gt;

&lt;h4 id=&quot;example-1-flatten-a-macro&quot;&gt;Example 1 (flatten a macro):&lt;/h4&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;map &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sqr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;filter &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;odd?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When you press &lt;kbd&gt;xf&lt;/kbd&gt; you get this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;filter &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;odd?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;map &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sqr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4 id=&quot;example-2-flatten-a-standard-function&quot;&gt;Example 2 (flatten a standard function):&lt;/h4&gt;

&lt;p&gt;Start with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;map &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;odd?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After &lt;kbd&gt;xf&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;odd?&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;coll&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]]&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lazy-seq&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when-let &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;seq &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;coll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;chunked-seq?&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;chunk-first&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                      &lt;span class=&quot;nv&quot;&gt;size&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;int &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;count &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                      &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;chunk-buffer&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dotimes &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;chunk-append&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.nth&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;chunk-cons&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;chunk&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;map &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;chunk-rest&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cons &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;first &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;map &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;rest &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A bit of a gibberish, but at least we can confirm that &lt;code&gt;map&lt;/code&gt; is indeed lazy.&lt;/p&gt;

&lt;h4 id=&quot;example-3-flatten-your-own-function&quot;&gt;Example 3 (flatten your own function):&lt;/h4&gt;

&lt;p&gt;Example function:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;defn &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sqr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;* &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This one requires the function to be properly loaded with &lt;kbd&gt;C-c C-l&lt;/kbd&gt; (&lt;code&gt;cider-load-file&lt;/code&gt;),
otherwise Clojure will not know the location of the function.&lt;/p&gt;

&lt;p&gt;Example statement:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;+ &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sqr&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After &lt;kbd&gt;xf&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;+ &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;* &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;added-lax-eval-for-clojure&quot;&gt;Added lax eval for Clojure&lt;/h3&gt;

&lt;p&gt;This is similar to the lax eval for Elisp. If you mark an expression with a region:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;asdf [1 2 3]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and press &lt;kbd&gt;e&lt;/kbd&gt;, you will actually eval this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;asdf&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;asdf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can do this for let bindings, it&amp;#39;s super-useful for debugging.  The rule is that if the first
element of the region is a symbol, and there&amp;#39;s more stuff in the region besides the symbol, a lax
eval will be performed.&lt;/p&gt;

&lt;h3 id=&quot;e-will-auto-start-cider&quot;&gt;&lt;kbd&gt;e&lt;/kbd&gt; will auto-start CIDER&lt;/h3&gt;

&lt;p&gt;If CIDER isn&amp;#39;t live, &lt;kbd&gt;e&lt;/kbd&gt; will start it and properly eval the current statement.&lt;/p&gt;

&lt;h3 id=&quot;2f-will-search-for-variables-first&quot;&gt;&lt;kbd&gt;2F&lt;/kbd&gt; will search for variables first&lt;/h3&gt;

&lt;p&gt;Since Elisp is a LISP-2, there can be a function and a variable with the same name.  &lt;kbd&gt;F&lt;/kbd&gt;
(&lt;code&gt;lispy-follow&lt;/code&gt;) prefers functions, but now &lt;kbd&gt;2F&lt;/kbd&gt; will prefer variables.&lt;/p&gt;

&lt;h3 id=&quot;2e-will-eval-and-insert-the-commented-result&quot;&gt;&lt;kbd&gt;2e&lt;/kbd&gt; will eval and insert the commented result&lt;/h3&gt;

&lt;p&gt;Starting with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;filter &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;odd?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;map &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sqr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pressing &lt;kbd&gt;2e&lt;/kbd&gt; gives:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;filter &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;odd?&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;map &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sqr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; =&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (1 9 25)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This works for all dialects, so you can also have:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;symbol-function&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;exit-minibuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; =&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (closure (t)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;          nil &amp;quot;Terminate this minibuffer argument.&amp;quot; (interactive)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;          (setq deactivate-mark nil)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;          (throw (quote exit)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;            nil))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-cl&quot; data-lang=&quot;cl&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;vg&quot;&gt;*MODULES*&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; =&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (&amp;quot;SWANK-ARGLISTS&amp;quot; &amp;quot;SWANK-FANCY-INSPECTOR&amp;quot; &amp;quot;SWANK-FUZZY&amp;quot; &lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;                   &amp;quot;SWANK-UTIL&amp;quot; &amp;quot;SWANK-PRESENTATIONS&amp;quot; &lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;                   &amp;quot;SWANK-TRACE-DIALOG&amp;quot; &amp;quot;SB-CLTL2&amp;quot;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To do the last eval you need to be in special.
It means that you first have to mark the symbol &lt;code&gt;*MODULES*&lt;/code&gt; with a region.
A convenient function to mark the current symbol is &lt;kbd&gt;M-m&lt;/kbd&gt; (&lt;code&gt;lispy-mark-symbol&lt;/code&gt;).&lt;/p&gt;

&lt;h3 id=&quot;y-lispy-occur-now-has-an-ivy-back-end&quot;&gt;&lt;kbd&gt;y&lt;/kbd&gt; (&lt;code&gt;lispy-occur&lt;/code&gt;) now has an &lt;code&gt;ivy&lt;/code&gt; back end&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;lispy-occur&lt;/code&gt; launches an interactive search within the current top-level expression, usually a
defun. This is useful to see where a variable is used in a function, or to quickly navigate to a
statement.&lt;/p&gt;

&lt;p&gt;You can customize &lt;code&gt;lispy-occur-backend&lt;/code&gt; to either &lt;code&gt;ivy&lt;/code&gt; (the default) or &lt;code&gt;helm&lt;/code&gt; (if you have it,
since it&amp;#39;s no longer a dependency of &lt;code&gt;lispy&lt;/code&gt;).&lt;/p&gt;

&lt;h3 id=&quot;add-ivy-back-end-to-lispy-completion-method&quot;&gt;Add ivy back end to &lt;code&gt;lispy-completion-method&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Now it&amp;#39;s the default one for navigating to tags. You can select alternatively &lt;code&gt;helm&lt;/code&gt; or &lt;code&gt;ido&lt;/code&gt; if you
wish.&lt;/p&gt;

&lt;h3 id=&quot;remove-the-dependency-on-ace-jump-mode&quot;&gt;Remove the dependency on &lt;code&gt;ace-jump-mode&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Instead the dependency on &lt;code&gt;ace-window&lt;/code&gt; will be re-used. This allows for a lot of code
simplifications and better tests.&lt;/p&gt;

&lt;p&gt;New custom variables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lispy-avy-style-char&lt;/code&gt;: choose where the overlay appears for &lt;kbd&gt;Q&lt;/kbd&gt; (&lt;code&gt;lispy-ace-char&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lispy-avy-style-paren&lt;/code&gt;: choose where the overlay appears for &lt;kbd&gt;q&lt;/kbd&gt; (&lt;code&gt;lispy-ace-paren&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lispy-avy-style-symbol&lt;/code&gt;: choose where the overlay appears for &lt;kbd&gt;a&lt;/kbd&gt; (&lt;code&gt;lispy-ace-symbol&lt;/code&gt;)
and &lt;kbd&gt;-&lt;/kbd&gt; (&lt;code&gt;lispy-ace-subword&lt;/code&gt;) and &lt;kbd&gt;H&lt;/kbd&gt; (&lt;code&gt;ace-symbol-replace&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There&amp;#39;s also &lt;code&gt;lispy-avy-keys&lt;/code&gt;, which is &lt;code&gt;a&lt;/code&gt; ... &lt;code&gt;z&lt;/code&gt; by default.&lt;/p&gt;

&lt;h3 id=&quot;add-lispy-compat&quot;&gt;Add &lt;code&gt;lispy-compat&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is a list of compatibility features with other packages, such as &lt;code&gt;edebug&lt;/code&gt; and &lt;code&gt;god-mode&lt;/code&gt;.
They add overhead, so you might want to turn them off if you don&amp;#39;t use the mentioned packages.&lt;/p&gt;

&lt;h3 id=&quot;f-works-for-scheme&quot;&gt;&lt;kbd&gt;F&lt;/kbd&gt; works for Scheme&lt;/h3&gt;

&lt;p&gt;You can navigate to a symbol definition in Scheme with &lt;kbd&gt;F&lt;/kbd&gt;. This feature was already
in place for Elisp, Clojure and CL.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Looks like a great batch of features, but I&amp;#39;m the most happy about the stupid backquote bug being
fixed.&lt;/p&gt;

&lt;p&gt;Up next: pre-defined key binding &lt;a href=&quot;https://github.com/abo-abo/lispy/issues/57&quot;&gt;themes&lt;/a&gt;, featuring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the beloved &lt;code&gt;default&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;the old-school &lt;code&gt;paredit&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;the special-only &lt;code&gt;minimal&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;and maybe one more.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feel free to chime in, if you&amp;#39;ve got a key setup that you think other people will like. Happy
hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>An update to my Elisp ERT / Travis CI setup</title>
   <link href="https://oremacs.com/2015/03/30/elisp-ert-travis/"/>
   <updated>2015-03-30T00:00:00+02:00</updated>
   <id>https://oremacs.com/2015/03/30/elisp-ert-travis</id>
   <content type="html">&lt;p&gt;This post might be interesting to people who use Travis CI to test their Elisp packages.&lt;/p&gt;

&lt;p&gt;I&amp;#39;ve noticed a few days ago that my tests on Travis CI started failing randomly.  Turns out that the
widely used &lt;a href=&quot;https://launchpad.net/%7Ecassou/+archive/ubuntu/emacs&quot;&gt;ppa:cassou/emacs&lt;/a&gt; has become
deprecated. It still sort of works, but sometimes &lt;code&gt;apt-get update&lt;/code&gt; just times out, and I get a build
error.&lt;/p&gt;

&lt;p&gt;Since it was the only one that I was using, I had to find another one. I went with &lt;code&gt;emacs-snapshot&lt;/code&gt;
from &lt;a href=&quot;https://launchpad.net/%7Eubuntu-elisp/+archive/ppa&quot;&gt;ppa:ubuntu-elisp&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s my current &lt;a href=&quot;https://github.com/abo-abo/lispy/blob/master/.travis.yml&quot;&gt;.travis.yml&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;language: emacs-lisp
env:
  matrix:
    - emacs=emacs-snapshot

before_install:
  - sudo add-apt-repository -y ppa:ubuntu-elisp
  - sudo apt-get update -qq
  - sudo apt-get install -qq $emacs
  - curl -fsSkL --max-time 10 --retry 10 --retry-delay 10 https://raw.github.com/cask/cask/master/go | python

script:
  - make cask
  - make test
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I&amp;#39;ve adopted one more change in the above code: &lt;code&gt;EMACS&lt;/code&gt; is replaced by &lt;code&gt;emacs&lt;/code&gt;.
The reason for this is that both &lt;code&gt;ansi-term&lt;/code&gt; and &lt;code&gt;compile&lt;/code&gt;
for legacy reasons set &lt;code&gt;EMACS&lt;/code&gt; to &lt;a href=&quot;https://lists.gnu.org/archive/html/emacs-devel/2015-03/msg00994.html&quot;&gt;strange values&lt;/a&gt;,
like &lt;code&gt;&amp;quot;24.4.91.2 (term:0.96)&amp;quot;&lt;/code&gt;.
So if you have in your Makefile:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;EMACS ?= emacs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;you&amp;#39;re going to have a bad time. So I changed my &lt;a href=&quot;https://github.com/abo-abo/lispy/blob/master/Makefile&quot;&gt;Makefile&lt;/a&gt; to:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;emacs ?= emacs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And now I can compile and test while inside Emacs with no issues.  The only issue left is that I
don&amp;#39;t yet know which PPA I should use for a stable Emacs. Maybe someone has a suggestion.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>recenter-positions, that's not how gravity works!</title>
   <link href="https://oremacs.com/2015/03/28/recenter/"/>
   <updated>2015-03-28T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/28/recenter</id>
   <content type="html">&lt;p&gt;Yesterday, I&amp;#39;ve added a new binding to &lt;code&gt;swiper-map&lt;/code&gt;: &lt;kbd&gt;C-l&lt;/kbd&gt; will now call
&lt;code&gt;swiper-recenter-top-bottom&lt;/code&gt;.
The implementation is really easy, almost nothing to write home about:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;swiper-recenter-top-bottom&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;&amp;amp;optional&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Call (&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`recenter-top-bottom&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; ARG) in &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`swiper--window&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;P&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;with-selected-window&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;swiper--window&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;recenter-top-bottom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;An interesting thing that I want to mention though is the customization of the default
&lt;code&gt;recenter-top-bottom&lt;/code&gt; behavior. This is the default one:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;recenter-positions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;middle&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;top&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And this is the logical one that I&amp;#39;m using:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;recenter-positions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;top&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;middle&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Try it out, and see if it makes sense to you. For me, when I&amp;#39;ve just jumped to a function
definition, which usually means that the point is on the first line of the function, the first
recenter position has to be &lt;code&gt;top&lt;/code&gt;, since that will maximize the amount of the function body that&amp;#39;s
displayed on the screen.&lt;/p&gt;

&lt;p&gt;Another use-case is when I&amp;#39;m reading an info or a web page. After a recenter to top, all that I have
read is scrolled out of view, and I can continue from the top.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>A Hydra for ivy/swiper</title>
   <link href="https://oremacs.com/2015/03/26/hydra-ivy-swiper/"/>
   <updated>2015-03-26T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/26/hydra-ivy-swiper</id>
   <content type="html">&lt;p&gt;Today I&amp;#39;ll share a Hydra that I&amp;#39;ve been working on that&amp;#39;s similar to Lit Wakefield&amp;#39;s original idea
for &lt;a href=&quot;http://angelic-sedition.github.io/blog/2015/02/03/a-more-evil-helm/&quot;&gt;a helm hydra&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-code&quot;&gt;The Code&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-ivy&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
                     &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pink&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;^^^^^^          ^Actions^    ^Dired^     ^Quit^&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;^^^^^^--------------------------------------------&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;^ ^ _k_ ^ ^     _._ repeat   _m_ark      _i_: cancel&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_h_ ^✜^ _l_     _r_eplace    _,_ unmark  _o_: quit&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;^ ^ _j_ ^ ^     _u_ndo  &lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; arrows&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-beginning-of-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-end-of-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; actions&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-repeat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-undo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; dired&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-dired-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;,&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-dired-unmark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; exit&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keyboard-escape-quit&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s how I bind it:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-minibuffer-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-ivy/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here are the auxiliaries:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-dired-mark&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dotimes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;_i&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with-ivy-window&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-mark&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-next-line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy--exhibit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-dired-unmark&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dotimes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;_i&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with-ivy-window&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-unmark&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-next-line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy--exhibit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-replace&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with-ivy-window&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;move-beginning-of-line&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt;
                       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy--regex&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;line-end-position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;user-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;No match&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rep&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read-string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Replace [%s] with: &amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;with-selected-window&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;swiper--window&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;undo-boundary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;replace-match&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;rep&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-undo&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with-ivy-window&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;undo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;the-dired-operations&quot;&gt;The dired operations&lt;/h2&gt;

&lt;p&gt;There&amp;#39;s actually an outstanding &lt;a href=&quot;https://github.com/abo-abo/hydra/issues/86&quot;&gt;issue&lt;/a&gt; to make the hydra
heads appear conditionally. This would be quite useful for the &lt;kbd&gt;m&lt;/kbd&gt; and &lt;kbd&gt;,&lt;/kbd&gt; bindings, since
they don&amp;#39;t work outside a &lt;code&gt;dired&lt;/code&gt; buffer. Maybe I&amp;#39;ll get to it on the weekend.
Meanwhile, here&amp;#39;s a screenshot for marking files in &lt;code&gt;dired&lt;/code&gt; using &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-ivy-dired.png&quot; alt=&quot;hydra-ivy-dired.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Since the input is &lt;code&gt;&amp;quot;mar 10&amp;quot;&lt;/code&gt;, &lt;code&gt;swiper&lt;/code&gt; transforms it into the regex &lt;code&gt;&amp;quot;(mar).*(10)&amp;quot;&lt;/code&gt;.
What I do next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-o&lt;/kbd&gt; to get into the hydra state.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;99m&lt;/kbd&gt; to mark everything. Normally, it would mark 99 candidates, but since there are only 17, that means all of them.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;h&lt;/kbd&gt; to go to the first candidate.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;j,&lt;/kbd&gt; to to skip one candidate and unmark, then unmark some more, using this method.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If I wanted to move two candidates down at once, I could press &lt;kbd&gt;2j.....&lt;/kbd&gt;. The &lt;kbd&gt;.&lt;/kbd&gt;
will repeat the previous command with the previous argument. You can also set the argument later,
e.g.  &lt;kbd&gt;j.2.3..&lt;/kbd&gt; etc.&lt;/p&gt;

&lt;h2 id=&quot;the-exit-points&quot;&gt;The exit points&lt;/h2&gt;

&lt;p&gt;There are two:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;i&lt;/kbd&gt; will bring you back to &lt;code&gt;ivy&lt;/code&gt;, so that you can edit the input.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;o&lt;/kbd&gt; will quit everything and bring you to the &lt;code&gt;dired&lt;/code&gt; buffer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So you could first mark &lt;code&gt;Mar 10&lt;/code&gt;, exit with &lt;kbd&gt;i&lt;/kbd&gt;, edit the input to &lt;code&gt;Mar 17&lt;/code&gt;, press
&lt;kbd&gt;C-o&lt;/kbd&gt; and mark some more. Then finally exit with &lt;kbd&gt;o&lt;/kbd&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-replace-and-undo-operations&quot;&gt;The replace and undo operations&lt;/h2&gt;

&lt;p&gt;These two I&amp;#39;ve added the latest, so they are still a bit off.  The &lt;code&gt;ivy-replace&lt;/code&gt; option is similar
to vim&amp;#39;s &lt;kbd&gt;r&lt;/kbd&gt; (I did &lt;code&gt;vimtutor&lt;/code&gt; yesterday). It lets you replace the selected candidate.  And
&lt;kbd&gt;u&lt;/kbd&gt; simply calls undo. Strangely, at the moment it will undo several &lt;code&gt;ivy-replace&lt;/code&gt;
operations at once, even though I call &lt;code&gt;undo-boundary&lt;/code&gt; in &lt;code&gt;ivy-replace&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I think &lt;code&gt;ivy&lt;/code&gt; and the &lt;code&gt;hydra&lt;/code&gt; docstring blend in together quite nicely, like
&lt;a href=&quot;http://i.imgur.com/QblQ8cO.gifv&quot;&gt;old dogs and new tricks&lt;/a&gt;. I don&amp;#39;t know which is which.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Swiper 0.2.0 is out</title>
   <link href="https://oremacs.com/2015/03/25/swiper-0.2.0/"/>
   <updated>2015-03-25T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/25/swiper-0.2.0</id>
   <content type="html">&lt;p&gt;I forgot to mark the &lt;code&gt;0.1.0&lt;/code&gt; release, so I&amp;#39;m giving an overview of all the fixes and new features
since the first commit in &lt;a href=&quot;https://github.com/abo-abo/swiper/releases/0.2.0&quot;&gt;the release notes&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;fixes&quot;&gt;Fixes&lt;/h2&gt;

&lt;h3 id=&quot;fix-font-locking-in-certain-modes&quot;&gt;Fix font locking in certain modes&lt;/h3&gt;

&lt;p&gt;Some major modes try to optimize the font locking (highlighting text with various faces) by only
doing it for the visible portion of the text. But since &lt;code&gt;swiper&lt;/code&gt; needs to access all lines at once,
it&amp;#39;s necessary to font lock the whole buffer. This is done in &lt;code&gt;swiper-font-lock-ensure&lt;/code&gt;. For some
modes, the buffer becomes discolored after calling &lt;code&gt;swiper-font-lock-ensure&lt;/code&gt;. In theory, this should
not happen. As a work-around, I exclude these modes from ensuring font lock:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;package-menu-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gnus-summary-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gnus-article-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gnus-group-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;emms-playlist-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;erc-mode&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you see a discoloration in one of your favorite major modes while using &lt;code&gt;swiper&lt;/code&gt;, just let me
know and I&amp;#39;ll add it to the list.&lt;/p&gt;

&lt;h3 id=&quot;fix-face-changes-in-the-minibuffer-propagating-to-the-main-buffer&quot;&gt;Fix face changes in the minibuffer propagating to the main buffer&lt;/h3&gt;

&lt;p&gt;This was a quite interesting &lt;a href=&quot;https://github.com/abo-abo/swiper/issues/22&quot;&gt;bug&lt;/a&gt;. At that moment, I was using &lt;code&gt;add-face-text-property&lt;/code&gt; to add faces to the copies of strings in the minibuffer. However, this function destructively modifies the properties, so the change to the properties of a string copy (obtained with &lt;code&gt;concat&lt;/code&gt; or &lt;code&gt;copy-sequence&lt;/code&gt;) was propagated to the properties of the original string. This was fixed by using &lt;code&gt;font-lock-append-text-property&lt;/code&gt; instead of &lt;code&gt;add-face-text-property&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;ivy-read-returns-immediately-for-0-1-candidates&quot;&gt;&lt;code&gt;ivy-read&lt;/code&gt; returns immediately for 0-1 candidates&lt;/h3&gt;

&lt;p&gt;An obvious improvement.&lt;/p&gt;

&lt;h3 id=&quot;clean-up-overlays-better-for-c-g&quot;&gt;Clean up overlays better for &lt;kbd&gt;C-g&lt;/kbd&gt;&lt;/h3&gt;

&lt;p&gt;The hidden overlays revealed during the search will be re-hidden if you cancel the search with
&lt;kbd&gt;C-g&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;ensure-that-candidates-dont-have-read-only-property&quot;&gt;Ensure that candidates don&amp;#39;t have read-only property&lt;/h3&gt;

&lt;p&gt;This issue was causing a bug while using &lt;code&gt;swiper&lt;/code&gt; in &lt;code&gt;erc-mode&lt;/code&gt;, since it marks all of the buffer
content to &lt;code&gt;read-only&lt;/code&gt;. So once a string with &lt;code&gt;read-only&lt;/code&gt; property is inserted into the minibuffer,
you can&amp;#39;t delete it unless you set &lt;code&gt;inhibit-read-only&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New Features&lt;/h2&gt;

&lt;h3 id=&quot;optional-initial-input&quot;&gt;Optional initial input&lt;/h3&gt;

&lt;p&gt;If you call &lt;code&gt;(swiper &amp;quot;fix&amp;quot;)&lt;/code&gt;, you&amp;#39;ll start searching with initial input &lt;code&gt;&amp;quot;fix&amp;quot;&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;restore-the-initial-point-on-canceling&quot;&gt;Restore the initial point on canceling&lt;/h3&gt;

&lt;p&gt;If you cancel the search with e.g. &lt;kbd&gt;C-g&lt;/kbd&gt; (or &lt;kbd&gt;DEL&lt;/kbd&gt; when there&amp;#39;s no input), the
initial point will be restored.&lt;/p&gt;

&lt;h3 id=&quot;inherit-standard-faces&quot;&gt;Inherit standard faces&lt;/h3&gt;

&lt;p&gt;To give a more standard default appearance, &lt;code&gt;swiper&lt;/code&gt; faces inherit the default faces:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;isearch-lazy-highlight-face&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;isearch&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;match&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;isearch&lt;/code&gt; again&lt;/li&gt;
&lt;li&gt;&lt;code&gt;highlight&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most themes customize these faces, so by re-using them &lt;code&gt;swiper&lt;/code&gt; blends in better.
If you want the cool (my opinion) original faces, have a look at &lt;a href=&quot;https://github.com/abo-abo/eclipse-theme&quot;&gt;eclipse-theme&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;reveal-invisible-overlays&quot;&gt;Reveal invisible overlays&lt;/h3&gt;

&lt;p&gt;This is quite important for searches in &lt;code&gt;org-mode&lt;/code&gt; buffers. I tried to make it as close as possible
to what &lt;code&gt;isearch&lt;/code&gt; is doing.&lt;/p&gt;

&lt;h3 id=&quot;mark-is-saved-for-successful-searches&quot;&gt;Mark is saved for successful searches&lt;/h3&gt;

&lt;p&gt;This is the behavior of &lt;code&gt;isearch&lt;/code&gt;. After you complete a search, you can go back to the search start with
&lt;kbd&gt;C-x C-SPC&lt;/kbd&gt; (&lt;code&gt;pop-global-mark&lt;/code&gt;).&lt;/p&gt;

&lt;h3 id=&quot;the-current-candidate-is-anchored-to-the-current-position&quot;&gt;The current candidate is anchored to the current position&lt;/h3&gt;

&lt;p&gt;This means that if many candidates are matching the current input, the one which is closest to the
current line (going forwards) is selected. This is important for not losing the context of what
you&amp;#39;re searching.&lt;/p&gt;

&lt;h3 id=&quot;dont-recenter-unless-necessary&quot;&gt;Don&amp;#39;t recenter unless necessary&lt;/h3&gt;

&lt;p&gt;This is similar to the behavior of &lt;code&gt;isearch&lt;/code&gt;: a scroll is performed only if the candidate is out of
the window bounds. An alternate strategy of keeping the current candidate always centered in the
window is more distracting.&lt;/p&gt;

&lt;h3 id=&quot;decouple-helm-back-end&quot;&gt;Decouple helm back end&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;swiper&lt;/code&gt; command uses only &lt;code&gt;ivy&lt;/code&gt; now. If you want to use &lt;code&gt;helm&lt;/code&gt;, have a look at
&lt;a href=&quot;https://github.com/abo-abo/swiper-helm&quot;&gt;swiper-helm&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;add-history-handling&quot;&gt;Add history handling&lt;/h3&gt;

&lt;p&gt;&lt;kbd&gt;M-n&lt;/kbd&gt; will select the next history element, and &lt;kbd&gt;M-p&lt;/kbd&gt; will select the previous
history element.&lt;/p&gt;

&lt;p&gt;When there is no input, both &lt;kbd&gt;C-s&lt;/kbd&gt; and &lt;kbd&gt;C-r&lt;/kbd&gt; will select the last history element.
This is to make it similar to &lt;code&gt;isearch&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;When there is no input, and only once during the search, &lt;kbd&gt;M-n&lt;/kbd&gt; will select symbol-at-point
as the current input.&lt;/p&gt;

&lt;h3 id=&quot;truncate-candidates-to-window-width-in-the-minibuffer&quot;&gt;Truncate candidates to window width in the minibuffer&lt;/h3&gt;

&lt;p&gt;If a candidate is longer than the window width, it will be appropriately truncated with &lt;code&gt;...&lt;/code&gt;.
You can still match the invisible parts.&lt;/p&gt;

&lt;h3 id=&quot;warn-for-empty-buffer&quot;&gt;Warn for empty buffer&lt;/h3&gt;

&lt;p&gt;Obviously there&amp;#39;s nothing to search for in an empty buffer.&lt;/p&gt;

&lt;h3 id=&quot;bring-the-last-history-candidate-to-front&quot;&gt;Bring the last history candidate to front&lt;/h3&gt;

&lt;p&gt;In case of a successful search, the current input will be removed from history, and then re-added to
the front.&lt;/p&gt;

&lt;h3 id=&quot;make-c-n-and-c-p-differ-from-c-s-and-c-r&quot;&gt;Make &lt;kbd&gt;C-n&lt;/kbd&gt; and &lt;kbd&gt;C-p&lt;/kbd&gt; differ from &lt;kbd&gt;C-s&lt;/kbd&gt; and &lt;kbd&gt;C-r&lt;/kbd&gt;&lt;/h3&gt;

&lt;p&gt;The arrows will not recall the last history element in case the input is empty.
Otherwise, &lt;kbd&gt;C-n&lt;/kbd&gt; matches to &lt;kbd&gt;C-s&lt;/kbd&gt; and &lt;kbd&gt;C-p&lt;/kbd&gt; matches to &lt;kbd&gt;C-r&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;ivy-read-now-displays-the-number-of-candidates-in-the-prompt&quot;&gt;&lt;code&gt;ivy-read&lt;/code&gt; now displays the number of candidates in the prompt&lt;/h3&gt;

&lt;p&gt;The prompt argument can hold a &lt;code&gt;format&lt;/code&gt;-style expression, e.g. &lt;code&gt;&amp;quot; [% 3d] pattern:&amp;quot;&lt;/code&gt;, and the integer
parameter will be updated with the current amount of matches.
You can also customize &lt;code&gt;ivy-count-format&lt;/code&gt;, that defaults to &lt;code&gt;&amp;quot;%-4d &amp;quot;&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;custom-amount-of-chars-to-start-highlighting&quot;&gt;Custom amount of chars to start highlighting&lt;/h3&gt;

&lt;p&gt;Customize &lt;code&gt;swiper-min-highlight&lt;/code&gt; for this. It defaults to 2, which means that the current buffer
will be highlighted when the input has 2 chars or more. You can set it to &lt;code&gt;1&lt;/code&gt; if you want, I found
it slightly distracting, since there will be a lot of highlights for just one char input.
Or you can set it to a larger value if you want the highlights to appear later.&lt;/p&gt;

&lt;h3 id=&quot;customize-wrapping-for-c-n-and-c-p&quot;&gt;Customize wrapping for &lt;kbd&gt;C-n&lt;/kbd&gt; and &lt;kbd&gt;C-p&lt;/kbd&gt;&lt;/h3&gt;

&lt;p&gt;This feature being on by default in &lt;code&gt;helm-swoop&lt;/code&gt; was very distracting for me, and one of the reasons
that I wrote &lt;code&gt;swiper&lt;/code&gt;. So it&amp;#39;s off by default, but you can set it if you want. Calling
&lt;kbd&gt;C-p&lt;/kbd&gt; on line number 0 will cycle to the last candidate etc.&lt;/p&gt;

&lt;h3 id=&quot;update-copyright&quot;&gt;Update Copyright&lt;/h3&gt;

&lt;p&gt;Since &lt;code&gt;swiper&lt;/code&gt; was added to &lt;a href=&quot;https://elpa.gnu.org/packages/&quot;&gt;GNU ELPA&lt;/a&gt;, I had to assign the
Copyright to the FSF. This also means that you also need an FSF Copyright assignment for Emacs in
order to contribute more than total of 15 lines to the &lt;code&gt;swiper&lt;/code&gt; code. It&amp;#39;s really easy to get and is
already necessary to contribute to any package that is part of Emacs.&lt;/p&gt;

&lt;h3 id=&quot;add-swiper-query-replace&quot;&gt;Add &lt;code&gt;swiper-query-replace&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;You can start a query replace operation starting with the current candidate with &lt;kbd&gt;M-q&lt;/kbd&gt;.  If
you want to query replace in whole buffer, just do &lt;kbd&gt;M-&amp;lt; M-q&lt;/kbd&gt;. And remember that
&lt;kbd&gt;!&lt;/kbd&gt; will auto-replace all matches for the current query.&lt;/p&gt;

&lt;p&gt;The default binding of &lt;kbd&gt;M-q&lt;/kbd&gt; is &lt;code&gt;fill-paragraph&lt;/code&gt;. This function is useless in the minibuffer,
so I chose that binding for query-replace, which is normally bound to sub-optimal &lt;kbd&gt;M-%&lt;/kbd&gt;.
Although there are worse bindings than &lt;kbd&gt;M-%&lt;/kbd&gt; (hold three keys at once), for instance, there&amp;#39;s
&lt;kbd&gt;C-M-%&lt;/kbd&gt; (hold &lt;strong&gt;four&lt;/strong&gt; keys at once) that calls &lt;code&gt;query-replace-regexp&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Enjoy the new features, and a big thanks to all who contributed!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Transform region into ASCII art</title>
   <link href="https://oremacs.com/2015/03/23/region-to-toilet/"/>
   <updated>2015-03-23T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/23/region-to-toilet</id>
   <content type="html">&lt;p&gt;Here&amp;#39;s a command that I&amp;#39;ve found laying around my config that you might find interesting:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-figlet-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;&amp;amp;optional&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;shell-command-on-region&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;toilet&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;current-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can install the &lt;code&gt;toilet&lt;/code&gt; shell utility from your package manager.
Here&amp;#39;s an example result:&lt;/p&gt;

&lt;pre&gt;
    #&quot;
   m&quot;    mmm    m mm          mmm   mmmmm   mmm    mmm    mmm
   #    #&quot; &quot;#   #&quot;  &quot;        #&quot;  #  # # #  &quot;   #  #&quot;  &quot;  #   &quot;
   #    #   #   #            #&quot;&quot;&quot;&quot;  # # #  m&quot;&quot;&quot;#  #       &quot;&quot;&quot;m
    #   &quot;#m#&quot;   #            &quot;#mm&quot;  # # #  &quot;mm&quot;#  &quot;#mm&quot;  &quot;mmm&quot;
     &quot;
&lt;/pre&gt;

&lt;p&gt;If you don&amp;#39;t mind the strange name, the output looks quite nice.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hydra 0.12.0 is out</title>
   <link href="https://oremacs.com/2015/03/22/hydra-0.12.0/"/>
   <updated>2015-03-22T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/22/hydra-0.12.0</id>
   <content type="html">&lt;p&gt;With a month&amp;#39;s time and almost 50 commits since that last one, a new version of Hydra has emerged.
As usual, I&amp;#39;ll just re-state the
&lt;a href=&quot;https://github.com/abo-abo/hydra/releases/tag/0.12.0&quot;&gt;release notes&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;fixes&quot;&gt;Fixes&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Handling of heads with duplicate &lt;code&gt;cmd&lt;/code&gt; was improved.&lt;/li&gt;
&lt;li&gt;Don&amp;#39;t bind &lt;code&gt;nil&lt;/code&gt; in outside keymaps.&lt;/li&gt;
&lt;li&gt;Work-around &lt;code&gt;golden-ratio-mode&lt;/code&gt; in &lt;code&gt;lv-window&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-g&lt;/kbd&gt; (&lt;code&gt;hydra-keyboard-quit&lt;/code&gt;) should run &lt;code&gt;:post&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Bind &lt;code&gt;[switch-frame]&lt;/code&gt; to &lt;code&gt;hydra-keyboard-quit&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:post&lt;/code&gt; is called for &lt;code&gt;:timeout&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New Features&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hydra-key-format-spec&lt;/code&gt; is a new defcustom for the keys format in the docstring. It&amp;#39;s &lt;code&gt;&amp;quot;%s&amp;quot;&lt;/code&gt; by
default, but you can set it to e.g. &lt;code&gt;&amp;quot;%-4s&amp;quot;&lt;/code&gt; if you like.&lt;/li&gt;
&lt;li&gt;The key regex was extended to include most common key binding characters.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hydra-repeat&lt;/code&gt; is a hydra-specific &lt;code&gt;repeat&lt;/code&gt; function. It behaves as you would expect &lt;code&gt;repeat&lt;/code&gt; to behave.&lt;/li&gt;
&lt;li&gt;New body option - &lt;code&gt;:timeout&lt;/code&gt;. Use e.g. &lt;code&gt;:timeout 2.0&lt;/code&gt; to set the timer. After the first head is called,
a timer is started to disable the hydra. Each new head call resets this timer, so the hydra won&amp;#39;t disappear as long as you keep typing.&lt;/li&gt;
&lt;li&gt;Lines are truncated in &lt;code&gt;lv-message&lt;/code&gt;. This is useful for large docstring not to become misaligned when the window
becomes too small.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;allow-for-a-s-test-spec-in-the-docstring&quot;&gt;Allow for a &lt;code&gt;%s(test)&lt;/code&gt; spec in the docstring&lt;/h3&gt;

&lt;p&gt;The spec that&amp;#39;s used for e.g. &lt;code&gt;(test)&lt;/code&gt; is &lt;code&gt;%S&lt;/code&gt;. So if &lt;code&gt;(test)&lt;/code&gt; returns a string, it will be quoted.
This may not be desired, hence the new feature.
Example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-marked-items&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Number of marked items: %(length (dired-get-marked-files))&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Directory size: %s(shell-command-to-string \&amp;quot;du -hs\&amp;quot;)&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mark&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;mark&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;the-pink-amaranth-override-is-set-recursively&quot;&gt;The pink/amaranth override is set recursively&lt;/h3&gt;

&lt;p&gt;This fixes the issue in this hydra:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-test&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;amaranth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fo&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;yay&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Before, pressing e.g. &lt;kbd&gt;fp&lt;/kbd&gt; would not issue a warning, since &lt;kbd&gt;f&lt;/kbd&gt; started its own
keymap. This is now fixed.&lt;/p&gt;

&lt;h3 id=&quot;an-option-to-specify-the-hint-for-all-heads-in-body&quot;&gt;An option to specify the hint for all heads in body&lt;/h3&gt;

&lt;p&gt;When you write a large docstring, you usually pass &lt;code&gt;nil&lt;/code&gt; as the hint for most heads.
Now you can omit it, if you set &lt;code&gt;:hint nil&lt;/code&gt; in body.
Example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-org-template&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_c_enter  _q_uote    _L_aTeX:&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_l_atex   _e_xample  _i_ndex:&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_a_scii   _v_erse    _I_NCLUDE:&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_s_rc     ^ ^        _H_TML:&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_h_tml    ^ ^        _A_SCII:&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;e&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;q&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;c&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;l&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;h&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;a&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;L&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;L&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;i&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;I&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;I&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;H&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;H&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;self-insert-command&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ins&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;emulate-org-mode-export-dispatch-with-hydra-ox&quot;&gt;Emulate org-mode export dispatch with hydra-ox&lt;/h3&gt;

&lt;p&gt;You can also look at that code to see how nested hydras work.  Several other examples were added to
hydra-examples.el.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you enjoy all the new features/fixes, and thanks to all the people that contributed to
them. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Some fun with Hydra</title>
   <link href="https://oremacs.com/2015/03/21/some-fun-with-hydra/"/>
   <updated>2015-03-21T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/21/some-fun-with-hydra</id>
   <content type="html">&lt;p&gt;The code from this post has very little application. But it&amp;#39;s kind of fun, so I&amp;#39;ll post it.  Star
Trek: TNG is one of my favorite shows, so I&amp;#39;ve added some TNG characters to one of the Hydra
features that I&amp;#39;m testing.&lt;/p&gt;

&lt;h2 id=&quot;defhydradio-statement&quot;&gt;&lt;code&gt;defhydradio&lt;/code&gt; statement&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydradio&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;picard&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_p_ Captain Jean Luc Picard:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;riker&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_r_ Commander William Riker:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_d_ Lieutenant Commander Data:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;worf&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_w_ Worf:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;la-forge&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_f_ Geordi La Forge:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;troi&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_t_ Deanna Troi:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dr-crusher&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_c_ Doctor Beverly Crusher:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;phaser&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_h_ Set phasers to &amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;stun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;kill&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;defhydradio&lt;/code&gt; macro is akin to a namespace construct that defines multiple variables that can
assume only certain values (either &lt;code&gt;t&lt;/code&gt; or &lt;code&gt;nil&lt;/code&gt; by default), and functions to cycle those values.&lt;/p&gt;

&lt;h2 id=&quot;defhydradio-implementation&quot;&gt;&lt;code&gt;defhydradio&lt;/code&gt; implementation&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s what you may see after a &lt;code&gt;macroexpand&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/picard&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;_p_ Captain Jean Luc Picard:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;put&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;quote&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/picard&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;quote&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/picard&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra--cycle-radio&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;quote&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/picard&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/riker&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;_r_ Commander William Riker:&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;put&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;quote&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/riker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;quote&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/riker&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra--cycle-radio&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;quote&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/riker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/names&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-tng/picard&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/riker&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;hydra-tng/data&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/worf&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/la-forge&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;hydra-tng/troi&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/dr-crusher&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/phaser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you can see, each list passed to &lt;code&gt;defhydradio&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;gets a prefixed variable definition&lt;/li&gt;
&lt;li&gt;gets a &lt;code&gt;range&lt;/code&gt; property for the prefixed symbol&lt;/li&gt;
&lt;li&gt;gets a prefixed function definition that cycles the variable value based on the &lt;code&gt;range&lt;/code&gt; property&lt;/li&gt;
&lt;li&gt;gets added to &lt;code&gt;hydra-tng/names&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;defhydra-statement&quot;&gt;&lt;code&gt;defhydra&lt;/code&gt; statement&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:foreign-keys&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;run&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra--table&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/names&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
                        &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;  % -30s %% -3`%s&amp;quot;&lt;/span&gt;
                          &lt;span class=&quot;s&quot;&gt;&amp;quot;%s %%`%s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;&amp;quot;\n\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-tng/picard&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-tng/riker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-tng/data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-tng/worf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-tng/la-forge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-tng/troi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-tng/dr-crusher&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-tng/phaser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;beam-down&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;beam down&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-reset-radios&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-tng/names&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;reset&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The interesting statement in place of the docstring will actually evaluate to this docstring:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;  _p_ Captain Jean Luc Picard:   % -3`hydra-tng/picard^^^^    _h_ Set phasers to  %`hydra-tng/phaser&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  _r_ Commander William Riker:   % -3`hydra-tng/riker^^^^^&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  _d_ Lieutenant Commander Data: % -3`hydra-tng/data^^^^^^&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  _w_ Worf:                      % -3`hydra-tng/worf^^^^^^&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  _f_ Geordi La Forge:           % -3`hydra-tng/la-forge^^&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  _t_ Deanna Troi:               % -3`hydra-tng/troi^^^^^^&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  _c_ Doctor Beverly Crusher:    % -3`hydra-tng/dr-crusher&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The first line overflows a bit, but it&amp;#39;s clear what it is. There&amp;#39;s some flexibility in using
&lt;code&gt;hydra--table&lt;/code&gt;, since you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;redefine the row-column format (e.g. from 7x2 to 5x3)&lt;/li&gt;
&lt;li&gt;add more variables to &lt;code&gt;hydra-tng/names&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note also, that since &lt;code&gt;hydra-tng/names&lt;/code&gt; holds all the names, and all the names know their default
values through &lt;code&gt;range&lt;/code&gt;, it&amp;#39;s possible to reset them all at once with &lt;code&gt;hydra-reset-radios&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, here&amp;#39;s a simple implementation of &lt;code&gt;beam-down&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;beam-down&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;message&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;Beaming down: %s.&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapconcat&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;#&amp;#39;identity&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delq&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;symbol-value&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;substring&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;symbol-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
           &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-tng/picard&lt;/span&gt;
             &lt;span class=&quot;nv&quot;&gt;hydra-tng/riker&lt;/span&gt;
             &lt;span class=&quot;nv&quot;&gt;hydra-tng/data&lt;/span&gt;
             &lt;span class=&quot;nv&quot;&gt;hydra-tng/worf&lt;/span&gt;
             &lt;span class=&quot;nv&quot;&gt;hydra-tng/la-forge&lt;/span&gt;
             &lt;span class=&quot;nv&quot;&gt;hydra-tng/troi&lt;/span&gt;
             &lt;span class=&quot;nv&quot;&gt;hydra-tng/dr-crusher&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;, and &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c C-,&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-tng/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;And that&amp;#39;s it. There actually is an application of &lt;code&gt;defhydradio&lt;/code&gt; in
&lt;a href=&quot;https://github.com/abo-abo/hydra/blob/master/hydra-ox.el&quot;&gt;hydra-ox.el&lt;/a&gt;.  It&amp;#39;s not fully finished,
but you can already try it as an alternative to &lt;code&gt;org-mode&lt;/code&gt; export dispatch widget, most things are
working.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Emacs package management</title>
   <link href="https://oremacs.com/2015/03/20/managing-emacs-packages/"/>
   <updated>2015-03-20T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/20/managing-emacs-packages</id>
   <content type="html">&lt;p&gt;Lately, I&amp;#39;ve been spending some time to automate and publish my Emacs config.  Being able to quickly
reproduce your config has many advantages, the main one being that you no longer have to spend time
to make your config reproducible.&lt;/p&gt;

&lt;p&gt;Happily, most of my config is already published in many packages, I only have to figure out a nice
layer to glue them together. Below, I&amp;#39;ll show some automation for the packages managed by
&lt;code&gt;package.el&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;step-1-get-the-main-directory&quot;&gt;Step 1: get the main directory&lt;/h2&gt;

&lt;p&gt;This is an important step that many other peoples&amp;#39; configs miss, even the ones that are designed to
be distributed. You can&amp;#39;t just assume that the config will be located in &lt;code&gt;~/.emacs.d&lt;/code&gt; and rely on
Emacs defaults. Instead, it&amp;#39;s nice to be able to clone the config into a random directory and launch
an Emacs from there, without messing with the currently installed Emacs.&lt;/p&gt;

&lt;p&gt;It&amp;#39;s also useful for having multiple repositories for different versions of Emacs. ELPA packages are
byte-compiled, and the byte code can be incompatible between versions (for instance, 24.3 and 24.4).
Having two independent checkouts with ELPA directory auto-generated really helps in that case.&lt;/p&gt;

&lt;p&gt;So here is the code to get the main directory and define an ELPA directory with respect to that:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defconst&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;emacs-d&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;file-name-directory&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file-chase-links&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;load-file-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;The giant turtle on which the world rests.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;package-user-dir&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;expand-file-name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;elpa&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;emacs-d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;step-2-decide-what-you-like&quot;&gt;Step 2: decide what you like&lt;/h2&gt;

&lt;p&gt;Next, I initialize the package and define some of the packages that I like, omitting the
dependencies that they bring. Note that the code of the whole post is stored in a separate file
&lt;code&gt;packages.el&lt;/code&gt; that is not intended to be loaded on start up, so it&amp;#39;s fine to call
&lt;code&gt;package-refresh-contents&lt;/code&gt; here:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package-initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;package-archives&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;melpa&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;http://melpa.milkbox.net/packages/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;gnu&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;http://elpa.gnu.org/packages/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package-refresh-contents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defconst&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-packages&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;auto-compile&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;auto-yasnippet&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-link&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;company&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eclipse-theme&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;flx-ido&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;function-args&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;headlong&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-occasional&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-vertical-mode&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;magit&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smex&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;swiper&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;use-package&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;guide-key&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;powerline&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;slime&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cider&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;worf&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;org-download&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;make-it-so&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ukrainian-holidays&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;netherlands-holidays&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;j-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;List of packages that I like.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;step-3-install-and-upgrade&quot;&gt;Step 3: install and upgrade&lt;/h2&gt;

&lt;p&gt;The install step is pretty straightforward: install a package unless it&amp;#39;s already installed.
I tried to do something fancier for the upgrade, but in the end it was much more simple to
just call the interactive interface. The last two lines are basically equivalent to pressing
&lt;kbd&gt;Uxy&lt;/kbd&gt; interactively:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;; install required&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dolist&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-packages&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package-installed-p&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;package&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package-install&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;package&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;; upgrade installed&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;save-window-excursion&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package-list-packages&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package-menu-mark-upgrades&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package-menu-execute&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;step-4-make-it-callable&quot;&gt;Step 4: make it callable&lt;/h2&gt;

&lt;p&gt;Finally, I just create a Makefile with the following contents:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Makefile&quot; data-lang=&quot;Makefile&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emacs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?=&lt;/span&gt; emacs
&lt;span class=&quot;nf&quot;&gt;upgrade&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;emacs&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -batch -l packages.el

&lt;span class=&quot;nf&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;emacs&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -Q -l init.el

&lt;span class=&quot;nf&quot;&gt;up&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;upgrade&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Thanks to the first line, I can issue stuff like this on the shell:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emacs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;emacs24 make up
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will use the &lt;code&gt;emacs24&lt;/code&gt; executable, instead of whatever &lt;code&gt;emacs&lt;/code&gt; points to.  Since the &lt;code&gt;up&lt;/code&gt;
target depends on &lt;code&gt;upgrade&lt;/code&gt; and &lt;code&gt;run&lt;/code&gt; targets, they will be executed in that order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;upgrade&lt;/code&gt; will install / upgrade all packages in a non-interactive Emacs&lt;/li&gt;
&lt;li&gt;the &lt;code&gt;run&lt;/code&gt; target will start an interactive Emacs with already updated packages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I really like putting stuff in Makefiles, since they are very flexible, yet so easy to call.  In the
very same Makefile, I have a &lt;code&gt;profile&lt;/code&gt; target from
&lt;a href=&quot;http://oremacs.com/2015/02/24/emacs-speed-test/&quot;&gt;the post on profiling Emacs start up&lt;/a&gt;.  I also
wrote two packages related to Makefiles: &lt;a href=&quot;https://github.com/abo-abo/helm-make&quot;&gt;helm-make&lt;/a&gt; and
&lt;a href=&quot;https://github.com/abo-abo/make-it-so&quot;&gt;make-it-so&lt;/a&gt;. The latter one is actually very interesting and
deserves its own post, I should maybe just clean it up a bit.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ll just cite Gall&amp;#39;s law here:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A complex system that works is invariably found to have evolved from a simple system that
worked. A complex system designed from scratch never works and cannot be patched up to make it
work. You have to start over with a working simple system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I think it applies from both sides w.r.t. my Emacs config: it kind of works, but I really wish it
was reproducible from the start, before making it complex.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>A new Swiper demo on Youtube</title>
   <link href="https://oremacs.com/2015/03/19/swiper-on-youtubes/"/>
   <updated>2015-03-19T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/19/swiper-on-youtubes</id>
   <content type="html">&lt;h2 id=&quot;youtube-video&quot;&gt;Youtube video&lt;/h2&gt;

&lt;p&gt;Today, I&amp;#39;ve fixed a few bugs in both &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt; and &lt;code&gt;ivy&lt;/code&gt;.
Finally, the number of candidates display has also been added.  You can see the whole thing in the
&lt;a href=&quot;https://www.youtube.com/watch?v=s3qwiAtKjuA&quot;&gt;one minute video demo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here are the bindings that I&amp;#39;m using:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\C-r&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;swiper&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\C-s&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;swiper&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;integration-tests&quot;&gt;Integration tests&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ve also added some &lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/ivy-test.el&quot;&gt;integration tests&lt;/a&gt;,
if you&amp;#39;re interested. I didn&amp;#39;t know how to do exactly this type of testing before (when there&amp;#39;s input from minibuffer).
Turns out, it&amp;#39;s pretty easy to do using &lt;code&gt;execute-kbd-macro&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-expr&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Holds a test expression to evaluate with &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ivy-eval&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-result&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Holds the eval result of &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ivy-expr&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; by &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ivy-eval&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-eval&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Evaluate &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ivy-expr&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-result&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eval&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-expr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c e&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-with&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Evaluate EXPR followed by KEYS.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-expr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;execute-kbd-macro&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;vconcat&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c e&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;ivy-result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ert-deftest&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pattern: &amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pattern: &amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;42&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;s&quot;&gt;&amp;quot;42&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-with&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pattern: &amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;blue&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;yellow&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot;C-m&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;s&quot;&gt;&amp;quot;blue&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-with&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pattern: &amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;blue&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;yellow&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot;y C-m&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;s&quot;&gt;&amp;quot;yellow&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-with&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pattern: &amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;blue&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;yellow&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot;y DEL b C-m&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;s&quot;&gt;&amp;quot;blue&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-with&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pattern: &amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;blue&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;yellow&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot;z C-m&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Give the package a try, if you haven&amp;#39;t yet. You can get it from &lt;a href=&quot;http://melpa.org/#/swiper&quot;&gt;MELPA&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Find file in a Git repo with ivy</title>
   <link href="https://oremacs.com/2015/03/18/ivy-git/"/>
   <updated>2015-03-18T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/18/ivy-git</id>
   <content type="html">&lt;p&gt;I&amp;#39;m really enjoying using &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;ivy&lt;/a&gt; for matching stuff.&lt;/p&gt;

&lt;p&gt;Here is today&amp;#39;s &lt;a href=&quot;https://github.com/abo-abo/swiper/blob/master/counsel.el&quot;&gt;addition&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;couns-git&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Find file in the current Git repository.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;locate-dominating-file&lt;/span&gt;
                             &lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.git&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cands&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;split-string&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;shell-command-to-string&lt;/span&gt;
                  &lt;span class=&quot;s&quot;&gt;&amp;quot;git ls-files --full-name --&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Find file: &amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cands&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-file&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This one will allow you to find a file in your Git repository.
I&amp;#39;ve bound it like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c f&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;couns-git&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s how it looks like for selecting a file in the Emacs repo:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/couns-git.png&quot; alt=&quot;couns-git.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;The speed isn&amp;#39;t an issue for 3500 candidates, although I should try to add the number of candidates
display pretty soon. It&amp;#39;s just that there isn&amp;#39;t a good spot in the minibuffer to show that.&lt;/p&gt;

&lt;p&gt;I&amp;#39;ve also updated &lt;code&gt;ivy-next-line&lt;/code&gt; and &lt;code&gt;ivy-previous-line&lt;/code&gt; to switch to the previous history element
in case &lt;code&gt;ivy-text&lt;/code&gt; is empty. This is the exact behavior of &lt;code&gt;isearch&lt;/code&gt;, so if you bind &lt;code&gt;swiper&lt;/code&gt; to &lt;kbd&gt;C-s&lt;/kbd&gt;
and &lt;kbd&gt;C-r&lt;/kbd&gt; like I do, you&amp;#39;ll find that &lt;kbd&gt;C-s C-s&lt;/kbd&gt; and &lt;kbd&gt;C-r C-r&lt;/kbd&gt; work as expected.
Thanks to &lt;a href=&quot;https://github.com/johnmastro&quot;&gt;@johnmastro&lt;/a&gt; for the suggestion.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the current state of the keymap:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-minibuffer-map&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make-sparse-keymap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-m&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-done&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-p&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-r&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;SPC&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;self-insert-command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;DEL&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-backward-delete-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-&amp;lt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-beginning-of-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-end-of-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-next-history-element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-p&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ivy-previous-history-element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-g&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;minibuffer-keyboard-quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Keymap used in the minibuffer.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can also try &lt;code&gt;counsel&lt;/code&gt; for completing Elisp and &lt;code&gt;couns-clj&lt;/code&gt; for completing Clojure.  As you can
see, the implementation is very simple: you just get a list of strings, and you&amp;#39;re done.&lt;/p&gt;

&lt;p&gt;If you want to implement some &lt;code&gt;ivy&lt;/code&gt; completion for your favorite mode, I recommend to find the
corresponding &lt;code&gt;ac-source&lt;/code&gt; and see where it gets its list of strings.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>More Info</title>
   <link href="https://oremacs.com/2015/03/17/more-info/"/>
   <updated>2015-03-17T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/17/more-info</id>
   <content type="html">&lt;p&gt;I really liked Marcin Borkowski&amp;#39;s post on &lt;a href=&quot;http://mbork.pl/2014-12-27_Info_dispatch&quot;&gt;Info dispatch&lt;/a&gt;,
where he describes how to open several &lt;code&gt;*info*&lt;/code&gt; buffers for the most commonly used manuals.
However, as I tried to call one of these functions today, I forgot the key binding.&lt;/p&gt;

&lt;h2 id=&quot;hydra-to-the-rescue&quot;&gt;Hydra to the rescue!&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s what I&amp;#39;ve come up with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-open-info&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;topic&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Open info on TOPIC in BNAME.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-buffer&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;switch-to-buffer&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;topic&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-current-file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Info-goto-node&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;(%s)&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;topic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;info&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;topic&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-info-to&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;teal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_o_rg e_l_isp _e_macs _h_yperspec&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ora-open-info&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;org&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*org info*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ora-open-info&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;elisp&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*elisp info*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ora-open-info&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;emacs&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*emacs info*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ora-open-info&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;gcl&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*hyperspec*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-info-to/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;the-plan&quot;&gt;The Plan&lt;/h3&gt;

&lt;p&gt;I already have the &lt;kbd&gt;&amp;lt;f1&amp;gt; i&lt;/kbd&gt; key binding hard wired to my fingers. So after I&amp;#39;m in
&lt;em&gt;any&lt;/em&gt; Info buffer, I plan to press &lt;kbd&gt;t&lt;/kbd&gt; and get this dispatch:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-info-dispatch.png&quot; alt=&quot;hydra-info-dispatch.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;getting-the-hyperspec&quot;&gt;Getting the Hyperspec&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ve heard people lauding HTML while dumping on Info.
I&amp;#39;d suggest them to compare the &lt;a href=&quot;http://www.lispworks.com/documentation/HyperSpec/Front/index.htm&quot;&gt;Common Lisp Hyperspec&lt;/a&gt; web site
to this &lt;a href=&quot;http://ftp.gnu.org/gnu/gcl/gcl.info.tgz&quot;&gt;info file&lt;/a&gt; extracted from there.
Their contents are identical, but it&amp;#39;s easier and more pleasant to use Info.&lt;/p&gt;

&lt;p&gt;After I downloaded the file, I extracted it to &lt;code&gt;./etc/info/gcl.info&lt;/code&gt;, where &lt;code&gt;.&lt;/code&gt; is my &lt;code&gt;emacs-d&lt;/code&gt;.
Then I just added this directory to the Info path:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-additional-directory-list&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;expand-file-name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;etc/info/&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;emacs-d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Reading Info is pleasant and educational. In case you&amp;#39;re new to Info, there&amp;#39;s Info for Info. In Info
format! Just press &lt;kbd&gt;&amp;lt;f1&amp;gt; i h&lt;/kbd&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Try J</title>
   <link href="https://oremacs.com/2015/03/16/try-j/"/>
   <updated>2015-03-16T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/16/try-j</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;I imagine that if you&amp;#39;re reading this blog, you like to tinker with Emacs.  And people who like to
tinker with stuff probably also like to learn new programming languages, just for fun.  In that
case, if you ever want to learn a non-mainstream language, I highly recommend J.&lt;/p&gt;

&lt;p&gt;From its homepage:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;J is a modern, high-level, general-purpose, high-performance programming language. J is portable
and runs on Windows, Unix, Mac, both as a GUI and in a console. J systems can be installed and
distributed for free.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;the-appetizer&quot;&gt;The Appetizer&lt;/h2&gt;

&lt;p&gt;Things J has going for it that are high on my list:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jsoftware.com/download/j701_b_source.tar.gz&quot;&gt;GPL licensed source&lt;/a&gt;
(although it&amp;#39;s gibberish to read)&lt;/li&gt;
&lt;li&gt;a REPL&lt;/li&gt;
&lt;li&gt;short code&lt;/li&gt;
&lt;li&gt;high performance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What attracted me to J in the first place is that it consistently has the shortest solutions (and
fast-running) on &lt;a href=&quot;https://projecteuler.net/&quot;&gt;Project Euler&lt;/a&gt;.  What kept me going after the initial
wow-effect, was the extremely elegant standard functions implementation dividing things into
&lt;a href=&quot;http://www.jsoftware.com/docs/help701/dictionary/partsofspeech.htm&quot;&gt;verbs, adverbs, and conjunctions&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;something-impressive-a-sudoku-solver&quot;&gt;Something impressive: a Sudoku solver&lt;/h3&gt;

&lt;p&gt;This code is taken from the &lt;a href=&quot;http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-J.html&quot;&gt;ob-J&lt;/a&gt; page that I wrote some
time ago (you can find a lot of additional info there):&lt;/p&gt;

&lt;pre&gt;
&lt;span class=&quot;org-block-begin-line&quot;&gt;#+begin_src J :exports both
&lt;/span&gt;&lt;span class=&quot;variable-name&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;j-other&quot;&gt;=:&lt;/span&gt; &lt;span class=&quot;j-verb&quot;&gt;,&lt;/span&gt;((&lt;span class=&quot;j-verb&quot;&gt;,|:&lt;/span&gt;)&lt;span class=&quot;j-verb&quot;&gt;i.&lt;/span&gt;9 9)&lt;span class=&quot;j-verb&quot;&gt;,,.&lt;/span&gt;&lt;span class=&quot;j-adverb&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;,.&lt;/span&gt;&lt;span class=&quot;j-adverb&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;i.&lt;/span&gt;4&lt;span class=&quot;j-verb&quot;&gt;$&lt;/span&gt;3
&lt;span class=&quot;variable-name&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;j-other&quot;&gt;=:&lt;/span&gt; (&lt;span class=&quot;j-verb&quot;&gt;#=[:#~.&lt;/span&gt;)&lt;span class=&quot;j-conjunction&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;-.&lt;/span&gt;&lt;span class=&quot;j-conjunction&quot;&gt;&amp;amp;&lt;/span&gt;0
&lt;span class=&quot;variable-name&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;j-other&quot;&gt;=:&lt;/span&gt; &lt;span class=&quot;j-verb&quot;&gt;[:&lt;/span&gt;((&lt;span class=&quot;j-verb&quot;&gt;[:*&lt;/span&gt;&lt;span class=&quot;j-adverb&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;_9:&lt;/span&gt;c&lt;span class=&quot;j-adverb&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;]&lt;/span&gt;)&lt;span class=&quot;j-conjunction&quot;&gt;&quot;&lt;/span&gt;1&lt;span class=&quot;j-verb&quot;&gt;#]&lt;/span&gt;)i&lt;span class=&quot;j-conjunction&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;{+&lt;/span&gt;&lt;span class=&quot;j-conjunction&quot;&gt;&quot;&lt;/span&gt;1 1(&lt;span class=&quot;j-verb&quot;&gt;&amp;gt;:i.&lt;/span&gt;9)&lt;span class=&quot;j-verb&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;j-adverb&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;[:&lt;/span&gt;i&lt;span class=&quot;j-conjunction&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;=i.&lt;/span&gt;&lt;span class=&quot;j-conjunction&quot;&gt;&amp;amp;&lt;/span&gt;0
&lt;span class=&quot;variable-name&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;j-other&quot;&gt;=:&lt;/span&gt; &lt;span class=&quot;j-verb&quot;&gt;[:,&lt;/span&gt;&lt;span class=&quot;j-conjunction&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;$:&lt;/span&gt;&lt;span class=&quot;j-conjunction&quot;&gt;@.&lt;/span&gt;(0&lt;span class=&quot;j-verb&quot;&gt;:e.,&lt;/span&gt;)&lt;span class=&quot;j-verb&quot;&gt;[:;&lt;/span&gt;(&lt;span class=&quot;j-verb&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;j-conjunction&quot;&gt;@&lt;/span&gt;t)&lt;span class=&quot;j-conjunction&quot;&gt;&quot;&lt;/span&gt;1
&lt;span class=&quot;variable-name&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;j-other&quot;&gt;=:&lt;/span&gt; 9 9&lt;span class=&quot;j-conjunction&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;j-conjunction&quot;&gt;@&lt;/span&gt;r&lt;span class=&quot;j-conjunction&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;j-verb&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;variable-name&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;j-other&quot;&gt;=:&lt;/span&gt; 9 9 &lt;span class=&quot;j-verb&quot;&gt;$&quot;.&lt;/span&gt;&lt;span class=&quot;j-conjunction&quot;&gt;&quot;&lt;/span&gt;0&lt;span class=&quot;string&quot;&gt;'200370009009200007001004002050000800008000900006000040900100500800007600400089001'&lt;/span&gt;
s m
&lt;span class=&quot;org-block-end-line&quot;&gt;#+end_src
&lt;/span&gt;
&lt;span class=&quot;org-meta-line&quot;&gt;#+RESULTS:&lt;/span&gt;
&lt;span class=&quot;org-block-begin-line&quot;&gt;#+begin_example
&lt;/span&gt;&lt;span class=&quot;org-block&quot;&gt;2 0 0 3 7 0 0 0 9
0 0 9 2 0 0 0 0 7
0 0 1 0 0 4 0 0 2
0 5 0 0 0 0 8 0 0
0 0 8 0 0 0 9 0 0
0 0 6 0 0 0 0 4 0
9 0 0 1 0 0 5 0 0
8 0 0 0 0 7 6 0 0
4 0 0 0 8 9 0 0 1

2 8 4 3 7 5 1 6 9
6 3 9 2 1 8 4 5 7
5 7 1 9 6 4 3 8 2
1 5 2 4 9 6 8 7 3
3 4 8 7 5 2 9 1 6
7 9 6 8 3 1 2 4 5
9 6 7 1 4 3 5 2 8
8 1 3 5 2 7 6 9 4
4 2 5 6 8 9 7 3 1
&lt;/span&gt;&lt;span class=&quot;org-block-end-line&quot;&gt;#+end_example
&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;It&amp;#39;s pretty amazing that the whole implementation, not counting the example input matrix, takes only
169 characters. You can also see how functional the language is.&lt;/p&gt;

&lt;h3 id=&quot;something-simpler-a-factorial&quot;&gt;Something simpler: a factorial&lt;/h3&gt;

&lt;p&gt;To have a more simple example, here&amp;#39;s how to write down incrementally the factorial of 20:&lt;/p&gt;

&lt;pre&gt;
&lt;span class=&quot;org-block-begin-line&quot;&gt;#+begin_src J
&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;i.&lt;/span&gt;20
&lt;span class=&quot;org-block-end-line&quot;&gt;#+end_src
&lt;/span&gt;
&lt;span class=&quot;org-meta-line&quot;&gt;#+RESULTS:&lt;/span&gt;
&lt;span class=&quot;org-code&quot;&gt;: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
&lt;/span&gt;
&lt;span class=&quot;org-block-begin-line&quot;&gt;#+begin_src J
&lt;/span&gt;1 &lt;span class=&quot;j-verb&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;j-verb&quot;&gt;i.&lt;/span&gt;20
&lt;span class=&quot;org-block-end-line&quot;&gt;#+end_src
&lt;/span&gt;
&lt;span class=&quot;org-meta-line&quot;&gt;#+RESULTS:&lt;/span&gt;
&lt;span class=&quot;org-code&quot;&gt;: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
&lt;/span&gt;
&lt;span class=&quot;org-block-begin-line&quot;&gt;#+begin_src J
&lt;/span&gt;&lt;span class=&quot;j-verb&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;j-adverb&quot;&gt;/&lt;/span&gt; 1 &lt;span class=&quot;j-verb&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;j-verb&quot;&gt;i.&lt;/span&gt;20
&lt;span class=&quot;org-block-end-line&quot;&gt;#+end_src
&lt;/span&gt;
&lt;span class=&quot;org-meta-line&quot;&gt;#+RESULTS:&lt;/span&gt;
&lt;span class=&quot;org-code&quot;&gt;: 2432902008176640000
&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;The spaces are optional, I&amp;#39;ve only included them to make the code more clear.&lt;/p&gt;

&lt;h3 id=&quot;something-visual-a-sine-plot&quot;&gt;Something visual: a sine plot&lt;/h3&gt;

&lt;pre&gt;
&lt;span class=&quot;org-block-begin-line&quot;&gt;#+begin_src J
&lt;/span&gt;load &lt;span class=&quot;string&quot;&gt;'plot'&lt;/span&gt;
plot 1 &lt;span class=&quot;j-verb&quot;&gt;o.&lt;/span&gt; 0&lt;span class=&quot;j-adverb&quot;&gt;.&lt;/span&gt;1 &lt;span class=&quot;j-verb&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;j-verb&quot;&gt;i.&lt;/span&gt;200
&lt;span class=&quot;org-block-end-line&quot;&gt;#+end_src
&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;By simply pressing &lt;kbd&gt;C-c C-c&lt;/kbd&gt; on this source block you get this image generated and opened in your browser:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ob-J-sine.png&quot; alt=&quot;ob-J-sine.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-emacs-tooling&quot;&gt;The Emacs Tooling&lt;/h2&gt;

&lt;p&gt;As mentioned above, there&amp;#39;s &lt;code&gt;org-mode&lt;/code&gt; babel support for J, including session interaction.  More
importantly, there is &lt;a href=&quot;https://github.com/zellio/j-mode&quot;&gt;j-mode&lt;/a&gt;.  The same package also provides a
REPL via &lt;code&gt;jconsole&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Additionally, I wrote down a learning/assisting tool
&lt;a href=&quot;https://github.com/abo-abo/helm-j-cheatsheet&quot;&gt;helm-j-cheatsheet&lt;/a&gt;.
Here&amp;#39;s one of the screenshots:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://camo.githubusercontent.com/f3da93fe7c2fb30ffa9b1a4106dd41a6d8ee88a0/68747470733a2f2f7261772e6769746875622e636f6d2f61626f2d61626f2f68656c6d2d6a2d636865617473686565742f6d61737465722f646f632f73637265656e73686f742d322e706e67&quot; alt=&quot;helm-j-cheatsheet&quot;&gt;&lt;/p&gt;

&lt;p&gt;It allows to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;insert a function by English name&lt;/li&gt;
&lt;li&gt;look up the English name of the function by symbol&lt;/li&gt;
&lt;li&gt;open the &lt;a href=&quot;http://www.jsoftware.com/docs/help701/dictionary/d010.htm&quot;&gt;J documentation&lt;/a&gt; for a function&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;J is a very cool language to try and I hope you give it a go. I haven&amp;#39;t yet managed to find a nice
use for it, but you could say that, just as learning LISP, learning J can make you better at other
languages.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Search for things with apropos</title>
   <link href="https://oremacs.com/2015/03/15/search-with-apropos/"/>
   <updated>2015-03-15T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/15/search-with-apropos</id>
   <content type="html">&lt;p&gt;Until recently, I didn&amp;#39;t even know that &lt;code&gt;apropos&lt;/code&gt; was an actual word. I thought that it was just
some gibberish that Emacs hackers invented to name a command. Turns out, it actually has a very
appropriate meaning:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;apropos&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;preposition&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;with reference to; concerning.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;

&lt;h2 id=&quot;an-apropos-hydra&quot;&gt;An apropos Hydra&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ve just added this one to &lt;a href=&quot;https://github.com/abo-abo/hydra/blob/master/hydra-examples.el&quot;&gt;hydra-examples.el&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-apropos&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;
                         &lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_a_propos        _c_ommand&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_d_ocumentation  _l_ibrary&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_v_ariable       _u_ser-option&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;^ ^          valu_e_&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;apropos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;apropos-documentation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;apropos-variable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;apropos-command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;apropos-library&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;apropos-user-option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;apropos-value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I recommend to bind it like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c h&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-apropos/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Customary screenshot:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-apropos.png&quot; alt=&quot;hydra-apropos.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;As you can see, there are a total of 7 apropos functions available.  The most useful ones are
&lt;code&gt;apropos&lt;/code&gt;, &lt;code&gt;apropos-command&lt;/code&gt; and &lt;code&gt;apropos-variable&lt;/code&gt;.  But &lt;code&gt;apropos-value&lt;/code&gt; is very interesting as
well: it will not match an object name with the input, but instead search for all objects whose
contents match input. So, for instance, if you see something like &lt;code&gt;&amp;quot;error 42&amp;quot;&lt;/code&gt; come up, and you
don&amp;#39;t know where it&amp;#39;s coming from, it&amp;#39;s likely that some variable holds the value &lt;code&gt;42&lt;/code&gt;.  And that&amp;#39;s
when you use &lt;code&gt;apropos-variable&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Apropos is like old-school googling, and I find it highly useful in finding the Emacs information
that I need. I hope that you will find it useful as well. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>More on swiper and ivy</title>
   <link href="https://oremacs.com/2015/03/14/more-swiper-ivy-stuff/"/>
   <updated>2015-03-14T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/14/more-swiper-ivy-stuff</id>
   <content type="html">&lt;p&gt;I&amp;#39;ll describe two new things in &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt; and &lt;code&gt;ivy&lt;/code&gt; that happened
within the day. Although you can install them separately from MELPA, they still live in a single git
repository.&lt;/p&gt;

&lt;h2 id=&quot;swiper-ivy-faces-now-inherit-the-standard-ones&quot;&gt;&lt;code&gt;swiper&lt;/code&gt; / &lt;code&gt;ivy&lt;/code&gt; faces now inherit the standard ones&lt;/h2&gt;

&lt;p&gt;It&amp;#39;s a good idea by &lt;a href=&quot;https://github.com/purcell&quot;&gt;@purcell&lt;/a&gt;, and I tend to agree. So now, there are
six faces that inherit &lt;code&gt;highlight&lt;/code&gt;, &lt;code&gt;isearch-lazy-highlight-face&lt;/code&gt;, &lt;code&gt;isearch&lt;/code&gt; and &lt;code&gt;match&lt;/code&gt; faces
between them.  The advantage is that most themes re-define the above four faces as they see fit, so
the swiper faces will fit in better without customization.&lt;/p&gt;

&lt;p&gt;Still, I really enjoy the previous faces that were derived from the Swiper sprite. You can have them
as part of &lt;a href=&quot;https://github.com/abo-abo/eclipse-theme&quot;&gt;eclipse-theme&lt;/a&gt;. The theme creators can just
copy them verbatim to a light theme if they so choose.&lt;/p&gt;

&lt;p&gt;By the way, it seems that not all Emacs users are aware that you can customize faces.  You can do so
interactively for most popular packages. For example, after &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;customize-group&lt;/code&gt;
&lt;code&gt;swiper&lt;/code&gt;, you get a GUI for selecting most configurable things for &lt;code&gt;swiper&lt;/code&gt;, including the faces.&lt;/p&gt;

&lt;p&gt;The GUI will generate the code that looks something like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;custom-set-faces&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-current-match&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:background&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#e5b7c0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;elisp-completion-with-ivy&quot;&gt;Elisp completion with &lt;code&gt;ivy&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;The code to complete Elisp code at point is very simple:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;counsel&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Elisp completion at point.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bounds-of-thing-at-point&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-substring-no-properties&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;all-completions&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;obarray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-height&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ivy-read&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pattern (%s): &amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringp&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The only function above that isn&amp;#39;t one of the familiar primitives is &lt;code&gt;ivy-read&lt;/code&gt;.  But even that one
has a similar interface to that of &lt;code&gt;completing-read&lt;/code&gt; or &lt;code&gt;ido-completing-read&lt;/code&gt;.  I was using
&lt;code&gt;helm-lisp-completion-at-point&lt;/code&gt; before, but &lt;code&gt;counsel&lt;/code&gt; is much less obtrusive, while offering
comparable speed and convenience:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/counsel-1.png&quot; alt=&quot;counsel-1.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;The default minibuffer height for &lt;code&gt;ivy&lt;/code&gt; is set to 10 via &lt;code&gt;ivy-height&lt;/code&gt;.  It&amp;#39;s quite reasonable all-around, but
for &lt;code&gt;counsel&lt;/code&gt; I&amp;#39;ve set it to 7 via a let binding.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Swiper now has an ivy back end</title>
   <link href="https://oremacs.com/2015/03/13/introducing-ivy/"/>
   <updated>2015-03-13T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/13/introducing-ivy</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;Just three days ago, I wrote &lt;code&gt;swiper&lt;/code&gt; and introduced it in
&lt;a href=&quot;http://oremacs.com/2015/03/10/no-swiping/&quot;&gt;a post&lt;/a&gt;.
And while &lt;code&gt;swiper&lt;/code&gt; solved the problem of &lt;a href=&quot;https://github.com/ShingoFukuyama/helm-swoop&quot;&gt;helm-swoop&lt;/a&gt;
being awkward for me to use, &lt;code&gt;swiper&lt;/code&gt;&amp;#39;s code itself is pretty awkward, since even after using &lt;code&gt;helm&lt;/code&gt;
a dozen times in my packages, I&amp;#39;m still not well-versed in its internals.&lt;/p&gt;

&lt;p&gt;And, apparently, there are people who don&amp;#39;t like &lt;code&gt;helm&lt;/code&gt; because it updates a lot.  I don&amp;#39;t know if
it counts as a viable complaint, but I do agree that the &lt;code&gt;helm&lt;/code&gt; update time is quite long.  So I
wrote down an alternative completion back end for &lt;code&gt;swiper&lt;/code&gt;. It looks quite similar to
&lt;code&gt;ido-vertical-mode&lt;/code&gt;, although it is completely unrelated to &lt;code&gt;ido&lt;/code&gt;. In fact, the matching algorithm
currently is similar to &lt;code&gt;helm-match-plugin&lt;/code&gt;: &lt;code&gt;&amp;quot;for example&amp;quot;&lt;/code&gt; is transformed into
&lt;code&gt;&amp;quot;\\(for\\).*\\(example\\)&amp;quot;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/swiper-ivy.png&quot; alt=&quot;swiper-ivy.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-details&quot;&gt;The Details&lt;/h2&gt;

&lt;p&gt;Currently, in the &lt;code&gt;ivy&lt;/code&gt; version of &lt;code&gt;swiper&lt;/code&gt; only the anchoring algorithm is missing.  Anchoring is
what I call the process of selecting a close candidate when the number of candidates changes.  It
seems that &lt;code&gt;helm&lt;/code&gt; doesn&amp;#39;t implement an anchoring algorithm, so both &lt;code&gt;helm-swoop&lt;/code&gt; and &lt;code&gt;swiper&lt;/code&gt;
implement their own. I don&amp;#39;t know how easy it would be to write down the proper generic thing, my
current implementation for the &lt;code&gt;helm&lt;/code&gt; version of &lt;code&gt;swiper&lt;/code&gt; is quite hacky.&lt;/p&gt;

&lt;p&gt;Just to explain to you what needs to be done. Suppose there&amp;#39;s an input &amp;quot;ab&amp;quot; that matches 50
candidates, and the candidate number 42 is the current one. Now, if the user types one char to make
the input into &amp;quot;abc&amp;quot;, the number of candidates has changed to 10, and the candidate that was current
previously doesn&amp;#39;t match any more. It is up to the matcher code to decide which of the 10 candidates
has to be current now. Usually it doesn&amp;#39;t matter much, but in the case of &lt;code&gt;swiper&lt;/code&gt; it matters since
the point will be moved to the current candidate in the original window.&lt;/p&gt;

&lt;p&gt;In any case, there&amp;#39;s still a lot of things that have to be done for &lt;code&gt;ivy&lt;/code&gt;, but I think that
it&amp;#39;s quite usable now. Actually, I&amp;#39;ve already added it to my bindings:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\C-s&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;swiper&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s how it looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-swiper-1.png&quot; alt=&quot;ivy-swiper-1.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;And here&amp;#39;s an example of completion in &lt;code&gt;dired&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ivy-swiper-2.png&quot; alt=&quot;ivy-swiper-2.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;You need to have Emacs 24.4 in order to get a nicer highlight in the minibuffer that uses
&lt;code&gt;add-face-text-property&lt;/code&gt; instead of the old &lt;code&gt;propertize&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There&amp;#39;s a custom variable that decides the height of the minibuffer window, you can set it as you
like:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ivy-height&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Number of lines for the minibuffer window.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:type&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;integer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Give the new back end &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;a go&lt;/a&gt;, see if you like it. It looks quite pretty and minimalist to me, but I&amp;#39;m
biased since I made it.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ace-window display mode</title>
   <link href="https://oremacs.com/2015/03/12/ace-window-display-mode/"/>
   <updated>2015-03-12T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/12/ace-window-display-mode</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;Today, I&amp;#39;ll describe a quite recent addition to &lt;a href=&quot;https://github.com/abo-abo/ace-window&quot;&gt;ace-window&lt;/a&gt;,
which comes from the idea by &lt;a href=&quot;https://github.com/deftsp&quot;&gt;@deftsp&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why not show the &lt;code&gt;ace-window&lt;/code&gt; dispatch keys in the mode line all the time?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Certainly, there&amp;#39;s no reason not to have this option, and it actually makes the whole interface
better, since it becomes less feedback-based:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You glance at a window that you want.&lt;/li&gt;
&lt;li&gt;You know which key you have to press &lt;em&gt;before&lt;/em&gt; you call &lt;code&gt;ace-window&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;You make a single-step call instead of:

&lt;ul&gt;
&lt;li&gt;press &lt;code&gt;ace-window&lt;/code&gt; shortcut,&lt;/li&gt;
&lt;li&gt;read the dispatch char,&lt;/li&gt;
&lt;li&gt;press the dispatch char.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The feature is implemented as &lt;code&gt;ace-window-display-mode&lt;/code&gt; - a minor mode that you can toggle on or
off whenever you feel like it.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s how it looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ace-window-display-mode.png&quot; alt=&quot;ace-window-display-mode.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;As you can see, I&amp;#39;ve made &lt;code&gt;aw-keys&lt;/code&gt; list short on purpose, just to show you that the full path
will be displayed. See, for instance, the &lt;code&gt;*scratch*&lt;/code&gt; window: its path is &lt;code&gt;gf&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;/h2&gt;

&lt;p&gt;Since the implementation is quite short, I&amp;#39;ll post it here and go over a few things that might
interest people who write Elisp (on some level, please don&amp;#39;t mock me for being obvious).&lt;/p&gt;

&lt;p&gt;As per request of a curious reader, I&amp;#39;ve updated the code with the comments from below.  Don&amp;#39;t try
this at home, excessive commenting is bad style.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;; Something that modifies the Emacs behavior should&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; preferrably be implemented as a minor mode.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;define-minor-mode&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-window-display-mode&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;Minor mode for showing the ace window key in the mode line.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; And since this minor mode isn&amp;#39;t tied to a particular&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; buffer, I declare it as global.&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; An interesting quirk is that I have to put *something*&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; between the docstring and the body, otherwise it won&amp;#39;t&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; work.&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:global&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; Dispatch on the variable symbol of the mode -&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; `ace-window-display-mode`.  `define-minor-mode&amp;#39; will&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; define both a variable and function symbol.&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-window-display-mode&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;;; Update the window parameters&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aw-update&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;;; Since `mode-line-format&amp;#39; is a buffer-local&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;;; variable, I set it with `set-default&amp;#39;, in order&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;;; for the change to not just happen in the current&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;;; buffer.&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set-default&lt;/span&gt;
         &lt;span class=&quot;ss&quot;&gt;&amp;#39;mode-line-format&lt;/span&gt;
         &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window-display-mode&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:eval&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;window-parameter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;selected-window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                                     &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-window-path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
           &lt;span class=&quot;o&quot;&gt;,@&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;default-value&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;mode-line-format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;force-mode-line-update&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;;; Each time a window is created or deleted, Emacs&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;;; will run the `window-configuration-change-hook&amp;#39; -&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;;; exactly what I need to update `mode-line-format&amp;#39;.&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;window-configuration-change-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;aw-update&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set-default&lt;/span&gt;
     &lt;span class=&quot;ss&quot;&gt;&amp;#39;mode-line-format&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;assq-delete-all&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-window-display-mode&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;default-value&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;mode-line-format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;remove-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;window-configuration-change-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;aw-update&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-update&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Update ace-window-path window parameter for all windows.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy-traverse&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy-tree&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aw-window-list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;c1&quot;&gt;;; Use `set-window-parameter&amp;#39; to store a variable for&lt;/span&gt;
     &lt;span class=&quot;c1&quot;&gt;;; each window.  Buffer local variables would not work&lt;/span&gt;
     &lt;span class=&quot;c1&quot;&gt;;; here, since one buffer can be displayed in multiple&lt;/span&gt;
     &lt;span class=&quot;c1&quot;&gt;;; windows, and those would need a different key each.&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set-window-parameter&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-window-path&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;propertize&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;reverse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
       &lt;span class=&quot;ss&quot;&gt;&amp;#39;face&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;aw-mode-line-face&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Since I&amp;#39;m writing something that modifies Emacs behavior when it&amp;#39;s enabled, I first try to implement
it as a minor mode. And since this minor mode isn&amp;#39;t tied to a particular buffer, I declare it as
global.&lt;/p&gt;

&lt;p&gt;An interesting quirk is that I have to put &lt;em&gt;something&lt;/em&gt; between the docstring and the body, otherwise
it won&amp;#39;t work. In this case, I put &lt;code&gt;:global t&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Next, follows that standard dispatch on the variable symbol of the mode - &lt;code&gt;ace-window-display-mode&lt;/code&gt;.
The &lt;code&gt;define-minor-mode&lt;/code&gt; macro will make both variable and function definition for the symbol it&amp;#39;s
given:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the variable is used to check if the mode is on.&lt;/li&gt;
&lt;li&gt;the function is used to turn the mode on / off.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note the use of &lt;code&gt;assq-delete-all&lt;/code&gt;: this is for when some other package modifies the
&lt;code&gt;mode-line-format&lt;/code&gt; after &lt;code&gt;ace-window&lt;/code&gt; does. In that case, &lt;code&gt;ace-window&lt;/code&gt;&amp;#39;s entry wouldn&amp;#39;t be the first
one any more.&lt;/p&gt;

&lt;p&gt;Since &lt;code&gt;mode-line-format&lt;/code&gt; is a buffer-local variable, I set it with &lt;code&gt;set-default&lt;/code&gt;, in order for the
change to not just happen in the current buffer.&lt;/p&gt;

&lt;p&gt;Each time a window is created or deleted, Emacs will run the &lt;code&gt;window-configuration-change-hook&lt;/code&gt; -
exactly what I need to update &lt;code&gt;mode-line-format&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One final trick is to use &lt;code&gt;set-window-parameter&lt;/code&gt; to store a variable for each window.  Buffer local
variables would not work here, since one buffer can be displayed in multiple windows, and those
would need a different key each.&lt;/p&gt;

&lt;p&gt;I really like how the &lt;code&gt;avy-tree&lt;/code&gt; / &lt;code&gt;avy-traverse&lt;/code&gt; interface ended up as: the same functions are used
for selecting window and setting &lt;code&gt;mode-line-format&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you enjoy the update, and keep those interesting ideas coming!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Some git / magit / github tricks</title>
   <link href="https://oremacs.com/2015/03/11/git-tricks/"/>
   <updated>2015-03-11T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/11/git-tricks</id>
   <content type="html">&lt;p&gt;Of course, I mean &lt;em&gt;illusions&lt;/em&gt; not tricks.&lt;/p&gt;

&lt;h2 id=&quot;illusion-1-jump-to-a-magit-repository&quot;&gt;Illusion 1: jump to a magit repository&lt;/h2&gt;

&lt;p&gt;This is just a copy-paste of the code from
&lt;a href=&quot;http://iqbalansari.github.io/blog/2014/02/22/switching-repositories-with-magit/&quot;&gt;this post&lt;/a&gt; by
Iqbal Ansari.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;magit-repo-dirs&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;substring&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cl-remove-if-not&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file-remote-p&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;file-directory-p&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;project&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/.git/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;projectile-relevant-known-projects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Basically it&amp;#39;s just taking &lt;code&gt;projectile&lt;/code&gt;&amp;#39;s record of known projects, and then filtering it by whether
that project has &lt;code&gt;.git&lt;/code&gt; in its root.&lt;/p&gt;

&lt;p&gt;To get a selection of repositories, call with &lt;kbd&gt;C-u M-x&lt;/kbd&gt; &lt;code&gt;magit-status&lt;/code&gt;.
And don&amp;#39;t forget to choose &lt;code&gt;ido&lt;/code&gt; completion:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;magit-completing-read-function&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;magit-ido-completing-read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here&amp;#39;s how I use this in a dispatch:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-helm&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;helm&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-find-file&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;file&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-org-wiki&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;wiki&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current-prefix-arg&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call-interactively&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;magit-status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
       &lt;span class=&quot;s&quot;&gt;&amp;quot;git&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-locate&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;locate&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;κ&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-helm/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you&amp;#39;re wondering what the letter in &lt;code&gt;global-set-key&lt;/code&gt; is, it&amp;#39;s the Greek letter &lt;code&gt;kappa&lt;/code&gt;
(see &lt;a href=&quot;http://oremacs.com/2015/02/14/semi-xmodmap/&quot;&gt;the post on my Xmodmap setup&lt;/a&gt;).&lt;/p&gt;

&lt;h2 id=&quot;illusion-2-quickly-get-github-pull-requests-on-your-system&quot;&gt;Illusion 2: quickly get Github pull requests on your system&lt;/h2&gt;

&lt;p&gt;I learned this from some HN post that I can&amp;#39;t find now. Basically, you have to open
your &lt;code&gt;.git/config&lt;/code&gt; file and find the following contents:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;[remote &amp;quot;origin&amp;quot;]
    url = git@github.com:abo-abo/hydra.git
    fetch = +refs/heads/*:refs/remotes/origin/*
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then, modify it by adding one line (same for all repositories):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;[remote &amp;quot;origin&amp;quot;]
    url = git@github.com:abo-abo/hydra.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    fetch = +refs/pull/*/head:refs/pull/origin/*
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now, if you issue:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;git fetch --all
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can operate on your pull requests like so:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;git merge refs/pull/origin/20
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;20&lt;/code&gt; is the issue number. And after merging I finally get access to &lt;code&gt;magit&lt;/code&gt; and &lt;code&gt;ediff&lt;/code&gt; and
all that jazz to see what the change is actually about.  Before I learned this, I had to manually
add remotes with &lt;code&gt;magit-add-remote&lt;/code&gt;.  And even before that, I was just clicking the merge button
after thoughtfully browsing the diff in Firefox. Trust me, &lt;code&gt;ediff&lt;/code&gt; is orders of magnitude better.&lt;/p&gt;

&lt;h2 id=&quot;illusion-3-edit-a-github-wiki-in-emacs&quot;&gt;Illusion 3: edit a Github wiki in Emacs&lt;/h2&gt;

&lt;p&gt;Of course, I was always editing it in Emacs with
&lt;a href=&quot;https://addons.mozilla.org/en-us/firefox/addon/its-all-text/&quot;&gt;It&amp;#39;s All Text&lt;/a&gt; Firefox plugin.
But when I wanted to add an image, I actually read the manual and found out that you can simply
clone the wiki:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;git clone https://github.com/abo-abo/hydra.wiki.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Or with the ssh style, in order to not type the user name and password on pushing:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;git clone git@github.com:abo-abo/hydra.wiki.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By the way, today I&amp;#39;ve made a very large overhaul of &lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt;&amp;#39;s
README.md. So if you wanted to start writing your own hydras, but were hesitant because of the lack
of documentation, now is the time to start.&lt;/p&gt;

&lt;p&gt;If you figure out something that you think is worth documenting, you can immediately leave it on the
&lt;a href=&quot;https://github.com/abo-abo/hydra/wiki&quot;&gt;wiki&lt;/a&gt;.
By the way, here&amp;#39;s the syntax for including an image, if you were wondering:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;![hydra-helm](images/hydra-helm-unite.png)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You upload a file simply by adding it to the repository. Look Ma, no Imgur!&lt;/p&gt;

&lt;p&gt;This is actually an issue that I ran into, when I was less experienced. I included some one megabyte
gifs in the &lt;code&gt;lispy&lt;/code&gt; repository to refer to them in &lt;code&gt;README.md&lt;/code&gt;. Just a few of them resulted in a
very uncomfortable cloning time, which is an issue for Travis CI and, you know, humans.  Finally, I
had to resort to &lt;a href=&quot;http://rtyley.github.io/bfg-repo-cleaner/&quot;&gt;bfg-repo-cleaner&lt;/a&gt; to remove the gifs
from the repo history. It could all be avoided if I just posted all images on the wiki and linked to
them in &lt;code&gt;README.md&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you find these illusions useful to make you a better Emacs magician. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Introducing Swiper</title>
   <link href="https://oremacs.com/2015/03/10/no-swiping/"/>
   <updated>2015-03-10T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/10/no-swiping</id>
   <content type="html">&lt;p&gt;I like the idea of
&lt;a href=&quot;https://github.com/ShingoFukuyama/helm-swoop&quot;&gt;helm-swoop&lt;/a&gt;, but it
somehow has minor annoyances that stop me from using it, like
automatic &lt;code&gt;helm-input&lt;/code&gt;, and especially the circular candidates. Or maybe it&amp;#39;s just NIH talking.
Anyway, I&amp;#39;m rolling my own, and it&amp;#39;s called &lt;a href=&quot;https://github.com/abo-abo/swiper&quot;&gt;swiper&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/swiper.png&quot; alt=&quot;swiper.png&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;swiper-in-action&quot;&gt;Swiper in action&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s how it looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/swiper-1.png&quot; alt=&quot;swiper-1.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the search string &lt;code&gt;&amp;quot;dec fun pro&amp;quot;&lt;/code&gt; is transformed into
a regex &lt;code&gt;&amp;quot;\\(dec\\).*\\(fun\\).*\\(pro\\)&amp;quot;&lt;/code&gt;, and each group in the
matches is highlighted with a different face.  This is quite similar
to the way &lt;code&gt;re-builder&lt;/code&gt; does it. In fact it&amp;#39;s possible to use &lt;code&gt;swiper&lt;/code&gt;
as a poor man&amp;#39;s &lt;code&gt;re-builder&lt;/code&gt; (since it matches only single lines).&lt;/p&gt;

&lt;p&gt;I&amp;#39;m doing my own matching this time, as the part-swapping behavior of
&lt;code&gt;helm-match-plugin&lt;/code&gt; is more annoying than useful.&lt;/p&gt;

&lt;p&gt;Also note that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The whole &lt;code&gt;*swiper*&lt;/code&gt; buffer is fully syntax highlighted.&lt;/li&gt;
&lt;li&gt;The appropriate parts of the matches are highlighted as well.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;swiper-in-a-dired-buffer&quot;&gt;Swiper in a &lt;code&gt;dired&lt;/code&gt; buffer&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s another screenshot:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/swiper-2.png&quot; alt=&quot;swiper-2.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;It appears that &lt;code&gt;helm&lt;/code&gt; is ignoring the display of file attributes, since they have
a sort of &lt;code&gt;invisible&lt;/code&gt; property set. I kind of like this behavior.&lt;/p&gt;

&lt;h2 id=&quot;see-how-the-faces-are-recycled&quot;&gt;See how the faces are recycled&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ve defined only 4 faces currently (foxes aren&amp;#39;t unicorns, the
palette is quite limited), so they loop about if you have many groups:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/swiper-3.png&quot; alt=&quot;swiper-3.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;Yup, the technology is there. Although a &lt;code&gt;powerline&lt;/code&gt; theme for the
&lt;code&gt;helm&lt;/code&gt; mode line is still missing.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>lispy point history</title>
   <link href="https://oremacs.com/2015/03/09/lispy-point-history/"/>
   <updated>2015-03-09T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/09/lispy-point-history</id>
   <content type="html">&lt;p&gt;It was kind of disappointing to summarize in
&lt;a href=&quot;/2015/03/08/lispy.0.24.0-is-out/&quot;&gt;the last post&lt;/a&gt;
that there weren&amp;#39;t many new features for
&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy 0.24.0&lt;/a&gt;. So I thought long and hard and came up with something
quite obvious: since &lt;code&gt;lispy&lt;/code&gt; offers commands to quickly manipulate point and mark, it should offer one
to quickly restore them.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the bulk of the new code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-pos-ring&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;make-ring&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Ring for point and mark position history.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-pos-ring&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy--remember&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Store the current point and mark in history.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;region-active-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy--bounds-dwim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-ref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-pos-ring&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-pos-ring&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-ref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-pos-ring&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-pos-ring&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-back&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Move point to a previous position&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;zerop&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-length&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-pos-ring&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;user-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;At beginning of point history&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;pt&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-remove&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-pos-ring&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;consp&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy--mark&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;deactivate-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, I&amp;#39;m using &lt;code&gt;lispy-pos-ring&lt;/code&gt; made with &lt;code&gt;make-ring&lt;/code&gt; to store the
last 200 point and mark positions. In Elisp, a ring is basically a stack backed by a vector.
When the vector space overflows, the older stuff is overwritten.&lt;/p&gt;

&lt;p&gt;In this ring I store each time either the point, or a cons of the
point and mark if the region is active. This way possible to restore
the region even if it was deactivated several movement commands ago.&lt;/p&gt;

&lt;p&gt;I&amp;#39;ve put &lt;code&gt;lispy--remember&lt;/code&gt; into the most used navigation commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;j&lt;/kbd&gt; - &lt;code&gt;lispy-down&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;k&lt;/kbd&gt; - &lt;code&gt;lispy-up&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;h&lt;/kbd&gt; - &lt;code&gt;lispy-left&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;l&lt;/kbd&gt; - &lt;code&gt;lispy-right&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;f&lt;/kbd&gt; - &lt;code&gt;lispy-flow&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;i&lt;/kbd&gt; - &lt;code&gt;lispy-mark-car&lt;/code&gt; (when the region is active)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;a&lt;/kbd&gt; - &lt;code&gt;lispy-ace-paren&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And &lt;code&gt;lispy-back&lt;/code&gt; is now bound to &lt;kbd&gt;b&lt;/kbd&gt;. The previous binding of
&lt;kbd&gt;b&lt;/kbd&gt; - &lt;code&gt;lispy-store-region-and-buffer&lt;/code&gt; is now bound to
&lt;kbd&gt;xB&lt;/kbd&gt; (quite close to &lt;kbd&gt;B&lt;/kbd&gt; - the binding for
&lt;code&gt;lispy-ediff-regions&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;I really like the new command, it&amp;#39;s especially useful to reverse
&lt;kbd&gt;h&lt;/kbd&gt; and &lt;kbd&gt;l&lt;/kbd&gt;.  Previously, they could be reversed
with &lt;kbd&gt;f&lt;/kbd&gt;, but that can get annoying if you have to press it
many times. This results in a much more relaxed editing - I know that
whatever I press, I can restore the point position quickly if needed.&lt;/p&gt;

&lt;p&gt;This feature is added to the already present list of safeguards:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;j&lt;/kbd&gt; and &lt;kbd&gt;k&lt;/kbd&gt; are guaranteed not to exit the parent list.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;&amp;gt;&lt;/kbd&gt; and &lt;kbd&gt;&amp;lt;&lt;/kbd&gt; are guaranteed not to exit the parent list.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C&lt;/kbd&gt; reverses itself.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here&amp;#39;s a recipe to copy the third item of the current list and move
the point back: &lt;kbd&gt;4mnb&lt;/kbd&gt;. You can use it to copy a function&amp;#39;s
docstring if you&amp;#39;re in Elisp.  You&amp;#39;ll need &lt;kbd&gt;3mnb&lt;/kbd&gt; for
Clojure, since it weirdly has the docstring &lt;em&gt;before&lt;/em&gt; the arguments.  I
think it&amp;#39;s pretty cool: by typing &lt;kbd&gt;3mnb&lt;/kbd&gt; I&amp;#39;m basically
calling &lt;code&gt;(kill-new (caddr (current-sexp)))&lt;/code&gt; on my own code.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>lispy 0.24.0 is out</title>
   <link href="https://oremacs.com/2015/03/08/lispy.0.24.0-is-out/"/>
   <updated>2015-03-08T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/08/lispy.0.24.0-is-out</id>
   <content type="html">&lt;p&gt;The last release was a month ago, and there have been 70 commits to
master since then.  If you&amp;#39;re not familiar with &lt;code&gt;lispy&lt;/code&gt;, see
&lt;a href=&quot;/2015/01/19/lispy.0.21.0-is-out/&quot;&gt;my intro post for version 0.21.0&lt;/a&gt;.
I&amp;#39;ll just copy &lt;a href=&quot;https://github.com/abo-abo/lispy/releases/tag/0.24.0&quot;&gt;the release notes&lt;/a&gt; here,
while adding a few things.&lt;/p&gt;

&lt;h2 id=&quot;fixes&quot;&gt;Fixes&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;DEL&lt;/kbd&gt; behaves properly after a string and one space.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-k&lt;/kbd&gt; works better for expressions preceded with &amp;quot;#&amp;quot;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;3 &lt;/kbd&gt; should not add a space when there is one already.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;#&lt;/kbd&gt; will not add a space after a comma.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-j&lt;/kbd&gt; works better in comments after a quote.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lispy--eval-elisp-form&lt;/code&gt; first arg is now named &lt;code&gt;lispy-form&lt;/code&gt; instead of &lt;code&gt;form&lt;/code&gt;. It was impossible
to evaluate an unrelated &lt;code&gt;form&lt;/code&gt; variable with the previous behavior.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;F&lt;/kbd&gt; again works properly when jumping to a jar (e.g. to &lt;code&gt;defn&lt;/code&gt;) from Clojure source.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-k&lt;/kbd&gt; won&amp;#39;t call &lt;code&gt;delete-region&lt;/code&gt; in some obscure branches.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;enhancements&quot;&gt;Enhancements&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;P&lt;/kbd&gt; (&lt;code&gt;lispy-paste&lt;/code&gt;) will add a newline when called from start of line.  This way,
&lt;kbd&gt;nP&lt;/kbd&gt; becomes equivalent to &lt;kbd&gt;c&lt;/kbd&gt; (&lt;code&gt;lispy-clone&lt;/code&gt;). Of course, it&amp;#39;s more flexible: you
can do e.g. &lt;kbd&gt;nkP&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;xb&lt;/kbd&gt; (&lt;code&gt;lispy-bind-variable&lt;/code&gt;) now works on regions as well. Use it to bind the current
sexp or region as a let-bound variable: it will put you in &lt;code&gt;iedit&lt;/code&gt;. When you&amp;#39;re done with &lt;code&gt;iedit&lt;/code&gt;, press
&lt;kbd&gt;M-m&lt;/kbd&gt; (&lt;code&gt;lispy-mark-symbol&lt;/code&gt;) to exit &lt;code&gt;iedit&lt;/code&gt;. If you need to move the let binding around, use
a combination of &lt;kbd&gt;C&lt;/kbd&gt; (&lt;code&gt;lispy-convolute&lt;/code&gt;) and &lt;kbd&gt;h&lt;/kbd&gt; (&lt;code&gt;lispy-left&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;g&lt;/kbd&gt; will ignore &lt;code&gt;loaddefs.el&lt;/code&gt; for Elisp.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-m&lt;/kbd&gt; works better in unbalanced buffers, which should be an rare thing.&lt;/li&gt;
&lt;li&gt;add &lt;code&gt;defhydra&lt;/code&gt; to &lt;code&gt;lispy-tag-arity&lt;/code&gt;: now &lt;kbd&gt;g&lt;/kbd&gt; will recognize &lt;code&gt;defhydra&lt;/code&gt; statements.&lt;/li&gt;
&lt;li&gt;The tag logic was improved to do less parsing.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lispy-outline&lt;/code&gt; was updated to match the standard &lt;code&gt;^;;;&lt;/code&gt; outline regex. Try pressing &lt;kbd&gt;I&lt;/kbd&gt;
in e.g. org.el, it&amp;#39;s quite beautiful.&lt;/li&gt;
&lt;li&gt;All &lt;code&gt;lispy-eval&lt;/code&gt; functions will preserve the match data.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;&amp;gt;&lt;/kbd&gt; will delete the extra whitespace while slurping.&lt;/li&gt;
&lt;li&gt;Added &lt;code&gt;undercover&lt;/code&gt;/Coveralls test coverage report.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;H&lt;/kbd&gt; (&lt;code&gt;lispy-ace-symbol-replace&lt;/code&gt;) is now a Hydra: type &lt;kbd&gt;h&lt;/kbd&gt; to delete more, type
&lt;kbd&gt;u&lt;/kbd&gt; to undo.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Q&lt;/kbd&gt; (&lt;code&gt;lispy-ace-char&lt;/code&gt;) now uses &lt;code&gt;avy&lt;/code&gt; to jump. This change allows to cover this
function with a test.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New features&lt;/h2&gt;

&lt;h3 id=&quot;p-can-now-iterate-dolist-variables-in-elisp&quot;&gt;&lt;kbd&gt;p&lt;/kbd&gt; can now iterate &lt;code&gt;dolist&lt;/code&gt; variables in Elisp.&lt;/h3&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-cl&quot; data-lang=&quot;cl&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;called range&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;number-sequence&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dolist&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;i=%d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pressing &lt;kbd&gt;p&lt;/kbd&gt; with point where &lt;code&gt;|&lt;/code&gt; is, will&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;call &lt;code&gt;range&lt;/code&gt; and set &lt;code&gt;i&lt;/code&gt; to 1&lt;/li&gt;
&lt;li&gt;set &lt;code&gt;i&lt;/code&gt; to 2&lt;/li&gt;
&lt;li&gt;set &lt;code&gt;i&lt;/code&gt; to 3&lt;/li&gt;
&lt;li&gt;set &lt;code&gt;i&lt;/code&gt; to nil&lt;/li&gt;
&lt;li&gt;call &lt;code&gt;range&lt;/code&gt; and set &lt;code&gt;i&lt;/code&gt; to 1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is another step toward &lt;code&gt;edebug&lt;/code&gt;-less debugging, adding to special behavior for &lt;code&gt;let&lt;/code&gt;, &lt;code&gt;cond&lt;/code&gt;
and &lt;code&gt;labels&lt;/code&gt;. Remember that you can drop out of &lt;code&gt;edebug&lt;/code&gt; with &lt;kbd&gt;Z&lt;/kbd&gt; (&lt;code&gt;lispy-edebug-stop&lt;/code&gt;).
This function will take the current function arguments that &lt;code&gt;edebug&lt;/code&gt; provides, store them in
top-level, and exit &lt;code&gt;edebug&lt;/code&gt;.
This is really cool for setting up entry conditions for a function that you want to debug,
or even a function with an empty body that you want to write. Why am I so eager to exit &lt;code&gt;edebug&lt;/code&gt;?
Because it puts the code in read-only mode, which is quite restrictive.&lt;/p&gt;

&lt;h2 id=&quot;incompatible-changes&quot;&gt;Incompatible changes&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lispy-helm-columns&lt;/code&gt; is now a list &lt;code&gt;&amp;#39;(60 80)&lt;/code&gt;. The first number is
the width of the tag name column, the second number is the width of
both tag name and tag file. The tag name column is left-aligned, while the file column is right-aligned.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;j&lt;/kbd&gt; and &lt;kbd&gt;k&lt;/kbd&gt; should now move to outline when at
beginning of comment. The previous behavior was to look for the first
sexp in the direction. You can still do that with &lt;kbd&gt;f&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;I&lt;/kbd&gt; (&lt;code&gt;lispy-shiftab&lt;/code&gt;) is now a two-way cycle, instead of
three-way, like &lt;code&gt;org-mode&lt;/code&gt;.  The contents can be obtained with
&lt;kbd&gt;C-u I&lt;/kbd&gt; or &lt;kbd&gt;C-u C-TAB&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;It seems that &lt;code&gt;lispy&lt;/code&gt; is winding down feature-wise, which is a good
thing, because I&amp;#39;m almost out of keys - there&amp;#39;s only &lt;kbd&gt;Y&lt;/kbd&gt; and
&lt;kbd&gt;U&lt;/kbd&gt; left.&lt;/p&gt;

&lt;p&gt;Possible next steps would be to improve the test coverage (currently
48%) and the documentation.  Perhaps I&amp;#39;ll try to implement some
automation for generating
&lt;a href=&quot;http://oremacs.com/lispy/&quot;&gt;the function reference&lt;/a&gt;, or learn some
texinfo and write an actual manual, see how &lt;code&gt;ox-texinfo&lt;/code&gt; holds up.&lt;/p&gt;

&lt;p&gt;I hope that you&amp;#39;ll grow to enjoy &lt;code&gt;lispy&lt;/code&gt; as much as I do. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>org-mode block templates in Hydra</title>
   <link href="https://oremacs.com/2015/03/07/hydra-org-templates/"/>
   <updated>2015-03-07T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/07/hydra-org-templates</id>
   <content type="html">&lt;p&gt;Here&amp;#39;s a new Hydra for you:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-org-template&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:hint&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_c_enter  _q_uote    _L_aTeX:&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_l_atex   _e_xample  _i_ndex:&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_a_scii   _v_erse    _I_NCLUDE:&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_s_rc     ^ ^        _H_TML:&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_h_tml    ^ ^        _A_SCII:&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;e&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;q&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;c&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;l&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;h&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;a&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;L&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;L&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;i&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;I&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;I&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;H&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;H&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;self-insert-command&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ins&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hot-expand&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Expand org template.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-try-structure-completion&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I bind it for myself like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;looking-back&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-org-template/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;self-insert-command&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This means that when I press &lt;kbd&gt;&amp;lt;&lt;/kbd&gt; from the start of the
line, a Hydra will be called instead of inserting &lt;code&gt;&amp;lt;&lt;/code&gt;, otherwise &lt;code&gt;&amp;lt;&lt;/code&gt;
will be inserted.&lt;/p&gt;

&lt;p&gt;As the default insert method for &lt;code&gt;org-mode&lt;/code&gt; blocks is already pretty
convenient, this Hydra is more of an illustration than anything,
especially of the new &lt;code&gt;:hint nil&lt;/code&gt; feature.&lt;/p&gt;

&lt;p&gt;Just to remind you, each head has four placeholders:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;key binding&lt;/li&gt;
&lt;li&gt;body&lt;/li&gt;
&lt;li&gt;hint&lt;/li&gt;
&lt;li&gt;plist&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a Hydra is active, it will show its doc in the echo area in the
bottom of the frame.  This doc is composed of two parts: the body doc
and the heads&amp;#39; doc.  The body doc you specify yourself, the heads&amp;#39; doc
is built by concatenating the key binding and the hint for each head
into a (single) line.&lt;/p&gt;

&lt;p&gt;If you don&amp;#39;t specify a hint for a head, it&amp;#39;s assumed to be &lt;code&gt;&amp;quot;&amp;quot;&lt;/code&gt;; this
head&amp;#39;s binding will still be in the heads&amp;#39; doc. If you don&amp;#39;t want a
head&amp;#39;s binding to be in the heads&amp;#39; doc, set the hint to nil.  This is
commonly done because a head is already documented in the body doc.
It can sometimes become tedious to set all the hints to nil, for
instance in the Hydra above, I would need to do it 13 times. Hence
the &lt;code&gt;:hint nil&lt;/code&gt; shortcut.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s how it looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-org-template.png&quot; alt=&quot;hydra-org-template.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;I&amp;#39;m not a Scrabble pro: &lt;code&gt;clash&lt;/code&gt; for word score 10 is my result, although
a longer word would break the nice column layout.
The first two columns contain &lt;code&gt;begin&lt;/code&gt;/&lt;code&gt;end&lt;/code&gt; templates, while the
third one contains the one-line templates.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Select the previous window with ace-window</title>
   <link href="https://oremacs.com/2015/03/06/ace-window-toggle/"/>
   <updated>2015-03-06T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/06/ace-window-toggle</id>
   <content type="html">&lt;p&gt;It&amp;#39;s strange that I haven&amp;#39;t implemented this feature before, as it&amp;#39;s
quite a common usage pattern:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You select a window with &lt;code&gt;ace-window&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You do some stuff there.&lt;/li&gt;
&lt;li&gt;You want to return the previous window.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;aw-flip-window&quot;&gt;&lt;code&gt;aw-flip-window&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;In the step 3, you have to go though the whole &lt;code&gt;aw-keys&lt;/code&gt; dispatch,
only to select a window which can be pre-determined. Not any more, if
you call &lt;code&gt;aw-flip-window&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-flip-window&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Switch to the window you were previously in.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aw-switch-to-window&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aw--pop-window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So now, you could have a grid of 10 windows, select one of them with
&lt;code&gt;ace-window&lt;/code&gt;, and switch indefinitely between it and the previous
window with &lt;code&gt;ace-flip-window&lt;/code&gt;, while ignoring the other 8.&lt;/p&gt;

&lt;h2 id=&quot;aw-ignored-buffers&quot;&gt;&lt;code&gt;aw-ignored-buffers&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Remember that if you have some window that you never want to switch to
with &lt;code&gt;ace-window&lt;/code&gt;, you can add it to &lt;code&gt;aw-ignored-buffers&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-ignored-buffers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;*Calc Trail*&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*LV*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;List of buffers to ignore when selecting window.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;repeat&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It&amp;#39;s not a big deal, but it&amp;#39;s convenient at least for this scenario:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I start with one active window.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;calc&lt;/code&gt;; now I have three windows.&lt;/li&gt;
&lt;li&gt;I can toggle back and forth between &lt;code&gt;calc&lt;/code&gt; and the main window with
&lt;code&gt;ace-window&lt;/code&gt; without having to type &lt;code&gt;aw-keys&lt;/code&gt;, since &lt;code&gt;*Calc Trail*&lt;/code&gt; is
ignored, so that makes only two total windows.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;selecting-last-window-during-the-ace-window-dispatch&quot;&gt;Selecting last window during the &lt;code&gt;ace-window&lt;/code&gt; dispatch&lt;/h2&gt;

&lt;p&gt;This is a really cool feature, in my opinion: for all three actions -
&lt;code&gt;aw-select-window&lt;/code&gt;, &lt;code&gt;aw-swap-window&lt;/code&gt;, and &lt;code&gt;aw-delete-window&lt;/code&gt;, you can
select the previous window as a target with the same key &lt;kbd&gt;n&lt;/kbd&gt;.
This is, of course, customizable:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-flip-keys&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Keys which should select the last window.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:set&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sym&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;sym&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw--flip-keys&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;aref&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So you could have a whole list of bindings that select the previous
window during the &lt;code&gt;aw-keys&lt;/code&gt; dispatch. This is cool because there&amp;#39;s no
visual feedback necessary, so this binding can be easily added to the
muscle memory. The bindings don&amp;#39;t necessarily need to be single keys,
anything with one chord, e.g. &lt;kbd&gt;C-f&lt;/kbd&gt;, is acceptable.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s how I&amp;#39;ve set it up for myself:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ν&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;csetq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-flip-keys&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;n&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ν&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This means that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I can select the previous window with &lt;kbd&gt;νν&lt;/kbd&gt; - a double call to &lt;code&gt;ace-window&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I can swap with the previous window with &lt;kbd&gt;ψνν&lt;/kbd&gt;, &lt;kbd&gt;ψ&lt;/kbd&gt; calls &lt;code&gt;universal-argument&lt;/code&gt; for me.&lt;/li&gt;
&lt;li&gt;I can delete the previous window with &lt;kbd&gt;ψψνν&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://github.com/luciferasm&quot;&gt;@luciferasm&lt;/a&gt; for the idea, I
hope you&amp;#39;ll enjoy the new feature.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Testing your .emacs sanity</title>
   <link href="https://oremacs.com/2015/03/05/testing-init-sanity/"/>
   <updated>2015-03-05T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/05/testing-init-sanity</id>
   <content type="html">&lt;p&gt;Here&amp;#39;s a little snippet that came up as a Stack Overflow answer once:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-test-emacs&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;async&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;async-start&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;shell-command-to-string&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;&amp;quot;emacs --batch --eval \&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;(condition-case e&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;    (progn&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;      (load \\\&amp;quot;~/.emacs\\\&amp;quot;)&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;      (message \\\&amp;quot;-OK-\\\&amp;quot;))&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  (error&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;   (message \\\&amp;quot;ERROR!\\\&amp;quot;)&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;   (signal (car e) (cdr e))))\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;-OK-&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;called-interactively-p&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;any&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;All is well&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;switch-to-buffer-other-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*startup error*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;search-backward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ERROR!&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This function will quietly run a batch Emacs with your current config
to see if it errors out or not.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;in case that there were no start up errors, it will echo &amp;quot;All is well&amp;quot;&lt;/li&gt;
&lt;li&gt;when there&amp;#39;s an error, it will pop to a &lt;code&gt;*startup error*&lt;/code&gt; buffer with the error description&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The nice thing about this is that in case of an error you have a
functional Emacs to fix that error, since fixing errors with &lt;code&gt;emacs
-Q&lt;/code&gt; is quite painful.&lt;/p&gt;

&lt;p&gt;Another approach could be to just start a new Emacs instance, and
close the window in case there isn&amp;#39;t an error.  So all that the code
above does is automate closing the window (sort of, since the window
never opens). Still, I think it&amp;#39;s pretty cool. And you could attach it
to the &lt;code&gt;after-save-hook&lt;/code&gt; of your .emacs, or a timer.&lt;/p&gt;

&lt;p&gt;You could even configure Emacs to send you an email in case it notices
that there will be an error on the next start up. Or add the test to
&lt;code&gt;before-save-hook&lt;/code&gt; and abort the save in case it results in an
error. That&amp;#39;s some HAL 9000 level stuff right there:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I&amp;#39;m sorry Dave, I&amp;#39;m afraid I can&amp;#39;t do that.&lt;/p&gt;
&lt;/blockquote&gt;
</content>
 </entry>
 
 <entry>
   <title>Eclipse theme</title>
   <link href="https://oremacs.com/2015/03/04/eclipse-theme/"/>
   <updated>2015-03-04T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/04/eclipse-theme</id>
   <content type="html">&lt;p&gt;I started using Emacs around 2010-2011 when I needed an environment
for C++ and LaTeX.  The default color theme was horrendous (it still
is), and I don&amp;#39;t fancy myself a designer, so I just copied a color
theme of the thing that I was using previously: Eclipse.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abo-abo/eclipse-theme&quot;&gt;This theme&lt;/a&gt; modifies almost
nothing except the font lock faces, and looks reasonable while called
with &lt;code&gt;-nw&lt;/code&gt;, although I don&amp;#39;t see why anyone wouldn&amp;#39;t want to take
advantage of what graphical Emacs has to offer.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s a sampler:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/eclipse-theme.png&quot; alt=&quot;eclipse-theme.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;It&amp;#39;s shown together with my fork of
&lt;a href=&quot;https://github.com/abo-abo/powerline&quot;&gt;powerline&lt;/a&gt;.  I&amp;#39;ll try to merge
it as a theme eventually, I&amp;#39;m delaying it because &lt;code&gt;powerline&lt;/code&gt; isn&amp;#39;t
very easy to understand/modify.&lt;/p&gt;

&lt;p&gt;Eclipse theme should be on MELPA soon, I hope you&amp;#39;ll enjoy it. I&amp;#39;ve
tried probably 30 themes on MELPA, but I just can&amp;#39;t part with
&lt;code&gt;eclipse-theme&lt;/code&gt;. I&amp;#39;m guessing that it&amp;#39;s a feeling that most theme creators share.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ace-window full path</title>
   <link href="https://oremacs.com/2015/03/03/ace-window-full-path/"/>
   <updated>2015-03-03T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/03/ace-window-full-path</id>
   <content type="html">&lt;p&gt;I just closed a really helpful
&lt;a href=&quot;https://github.com/abo-abo/ace-window/issues/21&quot;&gt;issue&lt;/a&gt; for
&lt;code&gt;ace-window&lt;/code&gt;.  Turns out that there&amp;#39;s a plugin for vim called
Easymotion that&amp;#39;s very similar to &lt;code&gt;ace-jump-mode&lt;/code&gt;.  And that plugin
doesn&amp;#39;t highlight the leading chars one by one, but instead gives them
all at once.  Which is a pretty good idea, since it&amp;#39;s more convenient
to read the whole path at once and type it in at once rather than:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;read one char&lt;/li&gt;
&lt;li&gt;type one char&lt;/li&gt;
&lt;li&gt;read one more char&lt;/li&gt;
&lt;li&gt;type one more char&lt;/li&gt;
&lt;li&gt;... (maybe more steps)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To turn on the new behavior:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-leading-char-style&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Although this will only have an effect once you have more than 10 windows.
But this method really improves the functions from avy-jump.el.
I&amp;#39;ve added some more commands and renamed the old ones since yesterday.&lt;/p&gt;

&lt;h2 id=&quot;avy-jump-demos&quot;&gt;avy-jump demos&lt;/h2&gt;

&lt;h3 id=&quot;avi-goto-char-2&quot;&gt;&lt;code&gt;avi-goto-char-2&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s how I like to bind &lt;code&gt;avi-goto-char-2&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-&amp;#39;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avi-goto-char-2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here&amp;#39;s the result of &lt;kbd&gt;C-&amp;#39; bu&lt;/kbd&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avi-goto-char-2.png&quot; alt=&quot;avi-goto-char-2&quot;&gt;&lt;/p&gt;

&lt;p&gt;As you can see, nothing is overwritten by the overlay - it&amp;#39;s appended
after the search chars. In the screenshot above, I have &lt;code&gt;avi-background&lt;/code&gt; at nil; you can set it to
t if you want a gray background.&lt;/p&gt;

&lt;h3 id=&quot;avi-goto-char&quot;&gt;&lt;code&gt;avi-goto-char&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;After binding &lt;code&gt;avi-goto-char&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;π&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avi-goto-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s the result of &lt;kbd&gt;π b&lt;/kbd&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avi-goto-char.png&quot; alt=&quot;avi-goto-char&quot;&gt;&lt;/p&gt;

&lt;h3 id=&quot;avi-goto-line&quot;&gt;&lt;code&gt;avi-goto-line&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;After binding &lt;code&gt;avi-goto-line&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-g f&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avi-goto-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s the result of &lt;kbd&gt;M-g f&lt;/kbd&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avi-goto-line.png&quot; alt=&quot;avi-goto-line&quot;&gt;&lt;/p&gt;

&lt;p&gt;I&amp;#39;ve also added:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;avi-copy-line&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;avi-move-line&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;avi-copy-region&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These functions use the method of &lt;code&gt;avi-goto-line&lt;/code&gt; to copy/move stuff.
It might be useful for line-based text.&lt;/p&gt;

&lt;h3 id=&quot;avi-goto-word-0&quot;&gt;&lt;code&gt;avi-goto-word-0&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s the simple definition and the binding:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avi-goto-word-0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Jump to a word start in current window.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avi-keys&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;number-sequence&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?a&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avi--regex-candidates&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\b\\sw&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avi--goto&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avi--process&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avi--overlay-pre&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-g e&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avi-goto-word-0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There might be quite a lot of candidates for this one, but there&amp;#39;s no call to &lt;code&gt;read-char&lt;/code&gt;.
Here&amp;#39;s what happens after &lt;kbd&gt;M-g e&lt;/kbd&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avi-goto-word-0.png&quot; alt=&quot;avi-goto-word-0&quot;&gt;&lt;/p&gt;

&lt;h3 id=&quot;avi-goto-word-1&quot;&gt;&lt;code&gt;avi-goto-word-1&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s a version of it that reads one char:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avi-goto-word-1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Jump to a word start in current window.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Read one char with which the word should start.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avi--regex-candidates&lt;/span&gt;
                     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt;
                      &lt;span class=&quot;s&quot;&gt;&amp;quot;\\b&amp;quot;&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read-char&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;char: &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avi--goto&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avi--process&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avi--overlay-pre&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-g w&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avi-goto-word-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s what happens after &lt;kbd&gt;M-g w b&lt;/kbd&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avi-goto-word-1.png&quot; alt=&quot;avi-goto-word-1&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Give the new functions a go and see if you like them. New ideas are
welcome, especially pertaining to ripping off vim plugins. I did the
vimtutor once, but I have no idea how vim plugins work. But it turns
out that I like Easymotion.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ace-window without ace</title>
   <link href="https://oremacs.com/2015/03/02/ace-window-without-ace/"/>
   <updated>2015-03-02T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/03/02/ace-window-without-ace</id>
   <content type="html">&lt;p&gt;Today, &lt;a href=&quot;https://github.com/abo-abo/ace-window&quot;&gt;ace-window&lt;/a&gt; is dropping
the dependency on &lt;code&gt;ace-jump-mode&lt;/code&gt;. Most of the dependency was already
dropped in &lt;code&gt;0.7.0&lt;/code&gt;, when I had to fix &lt;code&gt;ace-window&lt;/code&gt; to work better with
&lt;code&gt;defhydra&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The change will not be user-visible, unless you relied on some
customizations of &lt;code&gt;ace-jump-mode&lt;/code&gt; to transfer to &lt;code&gt;ace-window&lt;/code&gt;. You&amp;#39;ll
be able to transfer your customizations to similarly named variables.&lt;/p&gt;

&lt;p&gt;The reason for the move is that, due to the implementation of
&lt;code&gt;ace-jump-mode&lt;/code&gt;, it&amp;#39;s hard to wrap its calls, since the function exits
before any of the red chars are selected by the user. Also,
&lt;code&gt;ace-jump-mode&lt;/code&gt; uses its own &lt;code&gt;defstruct&lt;/code&gt;s for candidates while I&amp;#39;d
rather have plain lists, but that&amp;#39;s a minor issue.&lt;/p&gt;

&lt;h2 id=&quot;new-back-end-avy-el&quot;&gt;New back end: avy.el&lt;/h2&gt;

&lt;p&gt;I tried to pinpoint the most generic algorithm that &lt;code&gt;ace-jump-mode&lt;/code&gt; implements and wrote it down
in &lt;code&gt;avy&lt;/code&gt;. Here&amp;#39;s the core of the implementation:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-subdiv&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Distribute N in B terms in a balanced way.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;floor&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;expt&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;delta&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;n2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;delta&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;n1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;append&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make-list&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make-list&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-tree&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lst&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Coerce LST into a balanced tree.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;The degree of the tree is the length of KEYS.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;KEYS are placed appropriately on internal nodes.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;len&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cl-labels&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cl-pairlis&lt;/span&gt;
                  &lt;span class=&quot;nv&quot;&gt;keys&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;leaf&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ks&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;copy-sequence&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                     &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dolist&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy-subdiv&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pop&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                                   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;leaf&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pop&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy-multipop&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
                         &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nreverse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The first function, &lt;code&gt;avy-subdiv&lt;/code&gt;, tries to split a number in terms of the base in a way that
the most leaves have the lowest level:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy-subdiv&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;=&amp;gt; (5 5 5 5 22)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy-subdiv&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;=&amp;gt; (4 6 16 16)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy-subdiv&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;=&amp;gt; (9 9 24)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy-subdiv&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;=&amp;gt; (16 26)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here&amp;#39;s an example of what &lt;code&gt;avy-tree&lt;/code&gt; produces:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy-tree&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Acid green&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Aero blue&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Almond&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Amaranth&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;Amber&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Amethyst&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Apple green&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Aqua&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;Aquamarine&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Auburn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Aureolin&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Azure&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;Beige&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Black&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Bronze&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Blue&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Burgundy&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Candy apple red&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;=&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Acid green&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Aero blue&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Almond&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Amaranth&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Amber&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Amethyst&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Apple green&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Aqua&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Aquamarine&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Auburn&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Aureolin&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Azure&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Beige&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Black&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Bronze&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Blue&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Burgundy&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;leaf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Candy apple red&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I think the library turned out to be pretty clean, since it knows
nothing of points, buffers or overlays, and imposes no restrictions on
the type of leaf items and keys.&lt;/p&gt;

&lt;h2 id=&quot;some-cool-avy-based-commands&quot;&gt;Some cool &lt;code&gt;avy&lt;/code&gt;-based commands&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ll list them together with the code, so it&amp;#39;s easier to see what they do.
The basic customizable variable is this one:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-keys&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;?a&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?s&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?d&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?f&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?g&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?h&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?j&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?k&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?l&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Keys for jumping.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that, while &lt;code&gt;ace-jump-mode&lt;/code&gt; has 52 selection chars by default, I
prefer to have only the 8 chars on the home row. This means that I&amp;#39;ll
usually have to go around one level deeper, but the characters are
easy to find and press.&lt;/p&gt;

&lt;h3 id=&quot;avy-jump-double-char&quot;&gt;&lt;code&gt;avy-jump-double-char&lt;/code&gt;&lt;/h3&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-jump-double-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Read two chars and jump to them in current window.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy--process&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy--regex-candidates&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read-char&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;char 1: &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read-char&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;char 2: &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;selected-window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy--goto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This one will read two chars and then offer avy-selection for the
matches. This is a pretty sensible approach for a pool of 8 keys,
since usually 3 chars total will be necessary, with the first two
being in natural succession.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s a screenshot of me typing in a natural two-char sequence &amp;quot;do&amp;quot;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avy-jump-double-char.png&quot; alt=&quot;avy-jump-double-char&quot;&gt;&lt;/p&gt;

&lt;p&gt;As you see, with 8 keys, 8 candidates will have depth 1, and another 8
candidates will have depth 2. The sorting preference is for the first
candidates to have lower depth.&lt;/p&gt;

&lt;h3 id=&quot;avy-jump-line&quot;&gt;&lt;code&gt;avy-jump-line&lt;/code&gt;&lt;/h3&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Elisp&quot; data-lang=&quot;Elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-jump-line&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Jump to a line start in current buffer.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;we&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;window-end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;window-start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;we&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;selected-window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
              &lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forward-line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy--process&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nreverse&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy--goto&lt;/span&gt;
                  &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This one is quite nice, since I always have less than &lt;code&gt;8*8=64&lt;/code&gt; lines in any window.
Here&amp;#39;s how it looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avy-jump-line.png&quot; alt=&quot;avy-jump-line&quot;&gt;&lt;/p&gt;

&lt;p&gt;I removed the gray background, since the leading chars are always in an expected position.&lt;/p&gt;

&lt;h3 id=&quot;avy-jump-isearch&quot;&gt;&lt;code&gt;avy-jump-isearch&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Saving the most clever one for last:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;avy-jump-isearch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Jump to one of the current isearch candidates.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy--regex-candidates&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;isearch-string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy--process&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;candidates&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;avy--goto&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;isearch-done&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;isearch-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;avy-jump-isearch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I don&amp;#39;t mind not being able to &lt;code&gt;isearch-forward-regexp&lt;/code&gt; for a single
quote without using &lt;kbd&gt;C-q&lt;/kbd&gt; (&lt;code&gt;quoted-insert&lt;/code&gt;).  In return, I
get the ability to &lt;em&gt;very&lt;/em&gt; quickly jump to a search candidate on
screen. I like this command the most. In case when there&amp;#39;s only one match, it&amp;#39;s a faster way
to call &lt;code&gt;isearch-done&lt;/code&gt; (than &lt;kbd&gt;C-m&lt;/kbd&gt;).
Here&amp;#39;s the result of &lt;kbd&gt;C-s&lt;/kbd&gt; &lt;code&gt;sen&lt;/code&gt; &lt;kbd&gt;&amp;#39;&lt;/kbd&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/avy-jump-isearch.png&quot; alt=&quot;avy-jump-isearch&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ve used the new functionality for a few days already, so it
shouldn&amp;#39;t be fragile. If the newest MELPA version bugs out for you,
you can fall back to version &lt;code&gt;0.7.1&lt;/code&gt; on
&lt;a href=&quot;http://stable.melpa.org/#/ace-window&quot;&gt;MELPA Stable&lt;/a&gt; and post
&lt;a href=&quot;https://github.com/abo-abo/ace-window/issues&quot;&gt;an issue&lt;/a&gt;.  Finally, I
hope that some people will take advantage of avy.el simplicity and
come up with some cool new commands to share with me. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hydra-repeat</title>
   <link href="https://oremacs.com/2015/02/28/hydra-repeat/"/>
   <updated>2015-02-28T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/28/hydra-repeat</id>
   <content type="html">&lt;p&gt;Did you know that you can repeat the most recent Emacs command with &lt;code&gt;repeat&lt;/code&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Repeat most recently executed command.
If REPEAT-ARG is non-nil (interactively, with a prefix argument),
supply a prefix argument to that command.  Otherwise, give the
command the same prefix argument it was given before, if any.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The default binding to repeat is &lt;kbd&gt;C-x z&lt;/kbd&gt;. You can then
continue with just &lt;kbd&gt;z&lt;/kbd&gt;: &lt;kbd&gt;C-x zzzzzzzz&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Unfortunately, since &lt;code&gt;defhydra&lt;/code&gt; defines new command names based on the
ones that you give it, passing &lt;code&gt;repeat&lt;/code&gt; as one of the heads will not
work. So I&amp;#39;ve added &lt;code&gt;hydra-repeat&lt;/code&gt; that&amp;#39;s supposed to work in the same way.&lt;/p&gt;

&lt;p&gt;So now, I can define a Hydra like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;vi&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-repeat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-vi/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And if I press &lt;kbd&gt;C-v 4l..&lt;/kbd&gt;, it will result in movement forward (&lt;code&gt;forward-char&lt;/code&gt;) by 4 chars 3 times:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;first time from &lt;kbd&gt;4l&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;other two times, with the same prefix 4, from &lt;kbd&gt;..&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Customizing ace-window leading char</title>
   <link href="https://oremacs.com/2015/02/27/ace-window-leading-char/"/>
   <updated>2015-02-27T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/27/ace-window-leading-char</id>
   <content type="html">&lt;p&gt;With a recent change, it&amp;#39;s now possible to customize
&lt;a href=&quot;https://github.com/abo-abo/ace-window&quot;&gt;ace-window&lt;/a&gt; like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;custom-set-faces&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aw-leading-char-face&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:inherit&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-jump-face-foreground&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:height&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;3.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s how it will look like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/ace-window-lead.png&quot; alt=&quot;ace-window-lead.png&quot;&gt;&lt;/p&gt;

&lt;p&gt;It&amp;#39;s slightly annoying that the buffer contents have to shift to
accommodate for a larger character, but there&amp;#39;s no way around it.
Besides, you can customize the face features other than height, like
foreground and background colors etc.&lt;/p&gt;

&lt;p&gt;Note that in the screenshot, I&amp;#39;m using my usual &lt;code&gt;ace-window&lt;/code&gt; setup,
i.e. home row keys and no background:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;use-package&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;:init&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-keys&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;?a&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?s&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?d&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?f&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?g&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?h&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?j&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?k&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?l&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw-background&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Compilation-style check-declare-file</title>
   <link href="https://oremacs.com/2015/02/26/compilation-check-declare/"/>
   <updated>2015-02-26T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/26/compilation-check-declare</id>
   <content type="html">&lt;p&gt;As a follow-up to my older post on &lt;a href=&quot;/2015/02/13/elisp-linting/&quot;&gt;Elisp linting options&lt;/a&gt;,
I&amp;#39;ve made &lt;code&gt;check-declare-file&lt;/code&gt; and &lt;code&gt;check-declare-directory&lt;/code&gt; give out warnings similar to those
that e.g. &lt;code&gt;byte-compile-file&lt;/code&gt; gives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;each warning now has a location in a file-line-column format&lt;/li&gt;
&lt;li&gt;you can click on the link to jump to the warning location&lt;/li&gt;
&lt;li&gt;&lt;code&gt;first-error&lt;/code&gt; / &lt;code&gt;next-error&lt;/code&gt; / &lt;code&gt;previous-error&lt;/code&gt; work as well&lt;/li&gt;
&lt;li&gt;the warning line blinks momentarily with each jump&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here&amp;#39;s how it looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/check-declare.png&quot; alt=&quot;check-declare&quot;&gt;&lt;/p&gt;

&lt;p&gt;You can already use this feature if you&amp;#39;re on Emacs trunk, otherwise
you&amp;#39;ll have to wait for 25.1 to come out.&lt;/p&gt;

&lt;p&gt;There&amp;#39;s also a new custom variable that you can set to get a more strict check:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;check-declare-ext-errors&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Unless you set it, the standard behavior is to issue a &lt;code&gt;&amp;quot;skipping
external file&amp;quot;&lt;/code&gt; message when checking a statement like the one above.
The reason is that the external package might not be loaded or
something.  As long as I&amp;#39;m checking, I prefer to check everything, so
there&amp;#39;s no reason not to have &lt;code&gt;check-declare-ext-errors&lt;/code&gt; always true.&lt;/p&gt;

&lt;h2 id=&quot;a-trick-to-actually-load-slime-repl&quot;&gt;A trick to actually load &lt;code&gt;slime-repl&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s the Makefile target for &lt;code&gt;check-declare&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Makefile&quot; data-lang=&quot;Makefile&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;check-declare&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;CASKEMACS&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -batch &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;LOAD&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -l check-declare.elt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here are the contents of check-declare.elt:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;check-declare-ext-errors&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;lispy.el&amp;quot;&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;&amp;quot;lispy-inline.el&amp;quot;&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;&amp;quot;le-clojure.el&amp;quot;&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;&amp;quot;le-scheme.el&amp;quot;&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;&amp;quot;le-lisp.el&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;load-path&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;file-name-directory&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;locate-library&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;slime&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot;contrib/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;slime-repl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;check-declare-files&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you see, I first find where slime.el is located using &lt;code&gt;locate-library&lt;/code&gt;, and then add the
contrib sub-directory to the &lt;code&gt;load-path&lt;/code&gt;. After this, it&amp;#39;s finally possible to &lt;code&gt;(require &amp;#39;slime-repl)&lt;/code&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Rectangle-mode Hydra</title>
   <link href="https://oremacs.com/2015/02/25/rectangle-hydra/"/>
   <updated>2015-02-25T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/25/rectangle-hydra</id>
   <content type="html">&lt;p&gt;Today, I&amp;#39;ll show a very useful hydra that I found yesterday on the
&lt;a href=&quot;https://github.com/abo-abo/hydra/wiki/Rectangle-Operations&quot;&gt;hydra wiki&lt;/a&gt;.
The idea is by &lt;a href=&quot;https://github.com/zhaojiangbin&quot;&gt;@zhaojiangbin&lt;/a&gt;, I&amp;#39;ve
made some minor changes to get the arrows to work the way that I like,
and made all keys into plain letters.&lt;/p&gt;

&lt;h2 id=&quot;the-code&quot;&gt;The code&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-ex-point-mark&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;rectangle-mark-mode&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;exchange-point-and-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mk&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rectangle-mark-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-rectangle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:body-pre&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rectangle-mark-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                           &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pink&lt;/span&gt;
                           &lt;span class=&quot;nb&quot;&gt;:post&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;deactivate-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  ^_k_^     _d_elete    _s_tring     |\\     ‗,,,--,,‗&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_h_   _l_   _o_k        _y_ank       /,&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`.-&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;`&amp;#39;   .‗  \-;;,‗&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  ^_j_^     _n_ew-copy  _r_eset     |,4-  ) )‗   .;.(  `&amp;#39;-&amp;#39;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;^^^^        _e_xchange  _u_ndo     &amp;#39;---&amp;#39;&amp;#39;(‗/.‗)-&amp;#39;(‗\‗)&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;^^^^        ^ ^         _p_aste&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forward-char&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-ex-point-mark&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;n&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;copy-rectangle-as-kill&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;delete-rectangle&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;region-active-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;deactivate-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rectangle-mark-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;y&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;yank-rectangle&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;undo&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;string-rectangle&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;kill-rectangle&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-x SPC&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-rectangle/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There was a lot of screen estate left over, so I added some ASCII-art. I wanted something
related to syrup, or at least pancakes, but instead I found a cat. Apparently, it&amp;#39;s very
easy to find pictures of cats on the internet. Who knew.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s how it looks like in-action:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-rectangle.png&quot; alt=&quot;hydra-rectangle&quot;&gt;&lt;/p&gt;

&lt;p&gt;The pink variation is pretty useful here, since it doesn&amp;#39;t get in the
way of e.g. &lt;kbd&gt;DEL&lt;/kbd&gt; or &lt;kbd&gt;C-n&lt;/kbd&gt; or &lt;kbd&gt;C-e&lt;/kbd&gt; or inserting spaces.&lt;/p&gt;

&lt;p&gt;I&amp;#39;ve been using it today for editing some table data in &lt;code&gt;org-mode&lt;/code&gt;,
and it feels pretty efficient.&lt;/p&gt;

&lt;h2 id=&quot;some-explanations&quot;&gt;Some explanations&lt;/h2&gt;

&lt;p&gt;What does what:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;d&lt;/kbd&gt; deletes rectangle; it&amp;#39;s similar to &lt;kbd&gt;C-d&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;n&lt;/kbd&gt; copies rectangle; it&amp;#39;s similar to &lt;kbd&gt;M-w&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;o&lt;/kbd&gt; exits; it&amp;#39;s very easy to press.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;e&lt;/kbd&gt; exchanges the point and mark; it&amp;#39;s also quite useful to re-activate the region
if you disabled it with &lt;kbd&gt;n&lt;/kbd&gt; or &lt;kbd&gt;r&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;s&lt;/kbd&gt; fills the selected rectangle with a string.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;y&lt;/kbd&gt; yanks the rectangle that you saved before with &lt;kbd&gt;n&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;r&lt;/kbd&gt; deactivates or activates the rectangle at point.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;u&lt;/kbd&gt; calls &lt;code&gt;undo&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;p&lt;/kbd&gt; kills the rectangle; it&amp;#39;s similar to &lt;kbd&gt;C-w&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Profile your Emacs start-up time</title>
   <link href="https://oremacs.com/2015/02/24/emacs-speed-test/"/>
   <updated>2015-02-24T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/24/emacs-speed-test</id>
   <content type="html">&lt;p&gt;I bet I could compete for the shortest &lt;code&gt;~/.emacs&lt;/code&gt; ever:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;(load &amp;quot;~/Dropbox/source/site-lisp/init&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;However, it being one line doesn&amp;#39;t make it start up any faster.
Here&amp;#39;s what I have in my Makefile beside &lt;code&gt;init.el&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Makefile&quot; data-lang=&quot;Makefile&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;profile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    emacs -Q -l git/profile-dotemacs/profile-dotemacs.el &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    --eval &lt;span class=&quot;s2&quot;&gt;&amp;quot;(setq profile-dotemacs-file \&lt;/span&gt;
&lt;span class=&quot;s2&quot;&gt;        (setq load-file-name \&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;abspath init.el&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;\&amp;quot;))&amp;quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    -f profile-dotemacs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The package that I&amp;#39;m using,
&lt;a href=&quot;http://randomsample.de/profile-dotemacs.el&quot;&gt;profile-dotemacs.el&lt;/a&gt;
comes from David Engster, one of the major contributors to CEDET, so
you know it&amp;#39;s got to be good.  Once you launch it as I showed above,
it will give you the times that various sections took to load in an
overlay.&lt;/p&gt;

&lt;p&gt;On very sunny days I can almost get Emacs to start under one second,
although when I checked just now, it turned out to be &lt;code&gt;1.20s&lt;/code&gt;.  I
value short start up time very highly, since due to my messing with
Elisp, the Emacs global state can become so messed up that it&amp;#39;s a lot
faster to just restart it, rather than spend 10 minutes surgically
restoring the state. And, of course, it&amp;#39;s a bonus for using Emacs on a
laptop, which I do at home.&lt;/p&gt;

&lt;p&gt;I&amp;#39;ve used two methods to shorten the boot time, I&amp;#39;ll describe them below.&lt;/p&gt;

&lt;h2 id=&quot;use-package-idle-option&quot;&gt;&lt;code&gt;use-package&lt;/code&gt; &lt;code&gt;:idle&lt;/code&gt; option&lt;/h2&gt;

&lt;p&gt;This one is a big time saver, since &lt;code&gt;org-mode&lt;/code&gt; just takes so long to load:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;use-package&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;:defer&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;:idle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;oleh/org&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I&amp;#39;m cautious not to abuse &lt;code&gt;:idle&lt;/code&gt;, since if it happens that I start
Emacs and start frantically typing all over the place, Emacs will
never get to be idle and the &lt;code&gt;:idle&lt;/code&gt; statements won&amp;#39;t load.  So I only
use it for &lt;code&gt;org&lt;/code&gt; and one or two other things.&lt;/p&gt;

&lt;h2 id=&quot;autoloading-stuff&quot;&gt;autoloading stuff&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s some helper code for this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;update-all-autoloads&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;emacs-d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;generated-autoload-file&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;expand-file-name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;loaddefs.el&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;file-exists-p&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;generated-autoload-file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;with-current-buffer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-file-noselect&lt;/span&gt;
                            &lt;span class=&quot;nv&quot;&gt;generated-autoload-file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;;;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;save-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;update-directory-autoloads&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;oleh&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;oleh/modes&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;emacs-d&lt;/code&gt; is the directory of my &lt;code&gt;init.el&lt;/code&gt;.
The directory &lt;code&gt;modes&lt;/code&gt; contains 44 Elisp files for each major mode or package that I customize.&lt;/p&gt;

&lt;p&gt;For instance, here are the contents of &lt;code&gt;Info.el&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ora-para-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ora-para-up&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;recenter-top-bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;backward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;forward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;forward-word&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;backward-word&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;beginning-of-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;end-of-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;beginning-of-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;E&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;end-of-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-Info-hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is one of the simpler ones, I think it would take around a week
of posts to cover what I have in &lt;code&gt;magit.el&lt;/code&gt;. The file &lt;code&gt;Info.el&lt;/code&gt; never
gets loaded until I open a buffer in &lt;code&gt;Info-mode&lt;/code&gt;.
Here&amp;#39;s what gets loaded every time:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;emacs-d&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;loaddefs.el&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;Info-mode-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;oleh-Info-hook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;My &lt;code&gt;loaddefs.el&lt;/code&gt; is just over 1000 lines and is automatically
generated by &lt;code&gt;update-all-autoloads&lt;/code&gt;. And here are the lines in
&lt;code&gt;loaddefs.el&lt;/code&gt; responsible for loading &lt;code&gt;Info.el&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;autoload&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;oleh-Info-hook&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;oleh/modes/Info&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\&lt;/span&gt;


&lt;span class=&quot;s&quot;&gt;\(fn)&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So the statements above are cheap to load.  Actually, the largest
chunk of my start up time, 28 percent, is taken by:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;eclipse-theme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I don&amp;#39;t know why it takes so long to call &lt;code&gt;custom-theme-set-faces&lt;/code&gt;, it&amp;#39;s a mystery.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hydra 0.11.0 is out</title>
   <link href="https://oremacs.com/2015/02/23/hydra-0.11.0/"/>
   <updated>2015-02-23T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/23/hydra-0.11.0</id>
   <content type="html">&lt;p&gt;As usual, I&amp;#39;ll just re-state the
&lt;a href=&quot;https://github.com/abo-abo/hydra/releases/tag/0.11.0&quot;&gt;release notes&lt;/a&gt;
and add some more notes in the end.&lt;/p&gt;

&lt;h2 id=&quot;fixes&quot;&gt;Fixes&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Emacs 24.3 (and maybe earlier versions) compatibility added&lt;/li&gt;
&lt;li&gt;(hydra-cleanup): Should not delete buffer first when window is dedicated.&lt;/li&gt;
&lt;li&gt;(lv-message): Should not deactivate mark.&lt;/li&gt;
&lt;li&gt;quit signals are intercepted, so that proper clean-up is done.&lt;/li&gt;
&lt;li&gt;no defuns with the same name will be generated in case some heads&amp;#39; cmd parts coincide&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New Features&lt;/h2&gt;

&lt;h3 id=&quot;pink-body-color&quot;&gt;Pink body color&lt;/h3&gt;

&lt;p&gt;When body color is pink, and hydra intercepts a binding which isn&amp;#39;t a head, instead of quitting the
hydra and executing the binding (default red behavior), it will execute the binding and &lt;strong&gt;not quit&lt;/strong&gt;
the hydra. This type of hydra is very similar to &lt;code&gt;define-minor-mode&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So now, pink and amaranth are body colors that are a flavor of the default red that, instead of
quitting when a non-head binding is intercepted, respectively run the binding or issue a warning.&lt;/p&gt;

&lt;h3 id=&quot;teal-body-color&quot;&gt;Teal body color&lt;/h3&gt;

&lt;p&gt;Teal color behaves similarly to amaranth (issues a warning when intercepting foreign bindings),
but the default behavior for each head is to quit.&lt;/p&gt;

&lt;p&gt;The following evaluates to true:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;macroexpand&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-test&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;amaranth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-b&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-c&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-d&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-e&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-f&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;macroexpand&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-test&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;teal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-a&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So if you want to write less, use teal color in this case.&lt;/p&gt;

&lt;h3 id=&quot;alternative-color-less-syntax&quot;&gt;Alternative color-less syntax&lt;/h3&gt;

&lt;p&gt;The color syntax is working quite well, since I was able to keep an almost full backward-compatibility:
once you pinpoint a color it will have that behavior, all the new behaviors will be released under a new color.&lt;/p&gt;

&lt;p&gt;Some might prefer an alternative set of switches rather than colors. New compat switches are:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;- &amp;quot;:exit nil&amp;quot; for &amp;quot;:color red&amp;quot;; You don&amp;#39;t have to specify either
  option in the body, since they are the default behavior that was
  available on Hydra release
- &amp;quot;:exit t&amp;quot; for &amp;quot;:color blue&amp;quot;
- &amp;quot;:foreign-keys warn&amp;quot; for &amp;quot;:color amaranth&amp;quot;
- &amp;quot;:foreign-keys warn :exit t&amp;quot; for &amp;quot;:color teal&amp;quot;
- &amp;quot;:foreign-keys run&amp;quot; for &amp;quot;:color pink&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The property &lt;code&gt;:exit&lt;/code&gt; can be inherited and overridden in the same way as &lt;code&gt;:color&lt;/code&gt; red or blue.&lt;/p&gt;

&lt;p&gt;The following evaluates to true:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;macroexpand&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-test&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-b&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-c&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-d&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-e&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-f&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;macroexpand&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-test&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-a&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The following two are exactly the same as the two above:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;macroexpand&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-test&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-b&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-c&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-d&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-e&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-f&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;macroexpand&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-test&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-a&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun-f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;ruby-style-string-interpolation-in-docstrings&quot;&gt;Ruby-style string interpolation in docstrings&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s an example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-marked-items&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Number of marked items: %(length (dired-get-marked-files))&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Auto-revert mode is:    %`auto-revert-mode&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mark&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;mark&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To enable this behavior, the docstring has to start with a newline (which will be stripped).  This
makes sense, since you usually want to align extensive docstrings, like I did this one.  The escape
syntax for variables is such that you can auto-complete them with &lt;code&gt;company-mode&lt;/code&gt;.  Both variables
and sexps can use &lt;code&gt;format&lt;/code&gt; style width specifiers. See the documentation of &lt;code&gt;format&lt;/code&gt; for more
details.&lt;/p&gt;

&lt;h3 id=&quot;examples-7-9-added-to-hydra-examples-el&quot;&gt;Examples 7-9 added to hydra-examples.el&lt;/h3&gt;

&lt;p&gt;These examples explain Ruby-style interpolation.&lt;/p&gt;

&lt;h3 id=&quot;updated-faces&quot;&gt;Updated faces&lt;/h3&gt;

&lt;p&gt;I&amp;#39;ve updated each face to match their color by default. Remember, that you can customize each
face interactively with &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;customize-group&lt;/code&gt; &lt;code&gt;hydra&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;alternative-grey-scale-or-custom-faces&quot;&gt;Alternative grey-scale or custom faces&lt;/h3&gt;

&lt;p&gt;If you don&amp;#39;t want colors for some reason, you can customize &lt;code&gt;hydra-fontify-head-function&lt;/code&gt; to your
taste.&lt;/p&gt;

&lt;p&gt;As an example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-fontify-head-function&lt;/span&gt;
      &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-fontify-head-greyscale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This function is already defined in hydra.el, but you could define a similar one on your own:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-fontify-head-greyscale&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;head&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Produce a pretty string from HEAD and BODY.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;HEAD&amp;#39;s binding is returned as a string wrapped with [] or {}.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra--head-color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;head&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;[%s]&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;s&quot;&gt;&amp;quot;(%s)&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;new-switch-body-pre&quot;&gt;New switch :body-pre&lt;/h3&gt;

&lt;p&gt;This sexp or function will be prepended to the prefix/body function.
Here&amp;#39;s an example of use:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/init-pos&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:body-pre&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/init-pos&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                    &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pink&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;vi&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; arrows&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; exit points&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi/init-pos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ins&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;C-n&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forward-line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;C-p&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forward-line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:exit&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, upon entering the hydra, the point position will be saved. And upon quitting, it will be
restored.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you&amp;#39;re enjoying the new updates as much as I do.
Since the last release, there are two new blog posts about using hydra that I&amp;#39;m aware of:
by &lt;a href=&quot;http://howardism.org/Technical/Emacs/lists-and-key-sequences.html&quot;&gt;Howard Abrams&lt;/a&gt; and
&lt;a href=&quot;http://kitchingroup.cheme.cmu.edu/blog/2015/02/22/org-mode-links-meet-hydra/&quot;&gt;John Kitchin&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Additionally, &lt;a href=&quot;https://github.com/hura&quot;&gt;@hura&lt;/a&gt;,
&lt;a href=&quot;https://github.com/kaushalmodi&quot;&gt;@kaushalmodi&lt;/a&gt;, and
&lt;a href=&quot;https://github.com/glucas&quot;&gt;@glucas&lt;/a&gt; have made some additions to the
&lt;a href=&quot;https://github.com/abo-abo/hydra/wiki&quot;&gt;Hydra wiki&lt;/a&gt;. Anyone is welcome
to share their useful hydras there. Thanks a lot and happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Saving match data in-between Elisp evals</title>
   <link href="https://oremacs.com/2015/02/22/saving-match-data/"/>
   <updated>2015-02-22T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/22/saving-match-data</id>
   <content type="html">&lt;p&gt;This is a new feature I&amp;#39;ve added recently to &lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;
that&amp;#39;s useful when debugging regex-related code.&lt;/p&gt;

&lt;p&gt;The gist of it is that the match data is a single global object in Emacs.
So if you call &lt;code&gt;string-match&lt;/code&gt; with your &lt;kbd&gt;C-x C-e&lt;/kbd&gt;, there&amp;#39;s no
guarantee that e.g. &lt;code&gt;match-beginning&lt;/code&gt; will return the proper thing with another &lt;kbd&gt;C-x C-e&lt;/kbd&gt;,
since any package running in your Emacs could mess with the match data (packages that use timers
or post-command hooks etc.).&lt;/p&gt;

&lt;p&gt;After getting annoyed by this a few times, I&amp;#39;ve finally added a
fail-safe to &lt;kbd&gt;e&lt;/kbd&gt; (&lt;code&gt;lispy-eval&lt;/code&gt;) and &lt;kbd&gt;p&lt;/kbd&gt;
(&lt;code&gt;lispy-eval-other-window&lt;/code&gt;). Here&amp;#39;s how it looks like:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-eval-match-data&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy--eval-elisp-form&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;form&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lexical&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Eval FORM and return its value.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;If LEXICAL is t, evaluate using lexical scoping.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Restore and save &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`lispy-eval-match-data&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; appropriately,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;so that no other packages disturb the match data.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fset&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;\,&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;identity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set-match-data&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-eval-match-data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eval&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;form&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lexical&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-eval-match-data&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fset&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;\,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There&amp;#39;s also a little dance of ignoring comma operators in the rare
case when I want to eval &lt;em&gt;inside&lt;/em&gt; a backquoted list.  The two
functions that you can take away from this exercise are &lt;code&gt;match-data&lt;/code&gt;
and &lt;code&gt;set-match-data&lt;/code&gt; which appropriately return and store a list of
integers. Keeping the string separate from the regex match is a neat
way to improve performance.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Embedding sexps in Hydra docstrings</title>
   <link href="https://oremacs.com/2015/02/21/hydra-docstring-sexp/"/>
   <updated>2015-02-21T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/21/hydra-docstring-sexp</id>
   <content type="html">&lt;p&gt;In &lt;a href=&quot;/2015/02/20/buffer-menu-hydra/&quot;&gt;yesterday&amp;#39;s post&lt;/a&gt;
I showed how to embed variable values into the docstring, among other
things. Today, I&amp;#39;ve extended this approach to work with s-expressions.
Here&amp;#39;s how it looks like:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-marked-items&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Number of marked items: %(length (dired-get-marked-files))&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mark&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;mark&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This piece of code will remind you how many files you&amp;#39;ve marked so far each
time you press &lt;kbd&gt;m&lt;/kbd&gt;.
By the way, this is the 64th post on the blog; I found out by pressing
&lt;kbd&gt;tm&lt;/kbd&gt; in &lt;code&gt;dired&lt;/code&gt; buffer or the &lt;code&gt;_posts&lt;/code&gt; directory.
Also, I don&amp;#39;t think that I&amp;#39;ve showed passing &lt;code&gt;&amp;quot;&amp;quot;&lt;/code&gt; as the keyboard prefix parameter
before. Apparently, it works and just translates to this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-marked-items/dired-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s how it looks like:
&lt;img src=&quot;/download/hydra-docstring-sexp.png&quot; alt=&quot;hydra-docstring-sexp&quot;&gt;&lt;/p&gt;

&lt;p&gt;There&amp;#39;s no need for a quitting key, it will auto-vanish when you press
anything other than &lt;kbd&gt;m&lt;/kbd&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hydra for Buffer-menu</title>
   <link href="https://oremacs.com/2015/02/20/buffer-menu-hydra/"/>
   <updated>2015-02-20T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/20/buffer-menu-hydra</id>
   <content type="html">&lt;p&gt;Here&amp;#39;s a little code I&amp;#39;ve made today for &lt;code&gt;Buffer-menu-mode&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;small&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-buffer-menu&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pink&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  Mark               Unmark             Actions            Search&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;-------------------------------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_m_: mark          _u_: unmark        _x_: execute       _R_: re-isearch&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_s_: save          _U_: unmark up     _b_: bury          _I_: isearch&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_d_: delete                           _g_: refresh       _O_: multi-occur&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_D_: delete up                        _T_: files only: %`Buffer-menu-files-only&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_~_: modified&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-mark&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-unmark&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;U&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-backup-unmark&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-delete&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;D&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-delete-backwards&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-save&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;~&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-not-modified&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;x&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-execute&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-bury&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;revert-buffer&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;T&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-toggle-files-only&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;O&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-multi-occur&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;I&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-isearch-buffers&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;R&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-isearch-buffers-regexp&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-select&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;select&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-other-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;other-window&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;quit-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-buffer-menu/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/small&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can change the color on the top to your taste: either red or pink or amaranth will work.
For extensive Hydras I tend to pick pink, since I don&amp;#39;t want to quit by accident, while still keeping
the non-head bindings. For small ones, red is better.
Here&amp;#39;s how the result looks like:
&lt;img src=&quot;/download/hydra-buffer-menu.png&quot; alt=&quot;hydra-buffer-menu&quot;&gt;&lt;/p&gt;

&lt;p&gt;You can install the cow with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;apt-get moo
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I didn&amp;#39;t list it in the source, since Jekyll would wrap the long lines. The source is already in &lt;a href=&quot;https://github.com/abo-abo/hydra/blob/master/hydra-examples.el#L191&quot;&gt;hydra-examples.el&lt;/a&gt;.
You only have to:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-examples&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Buffer-menu-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-buffer-menu/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I&amp;#39;ve been hearing some opinions lately that the growing number of
Hydra options makes it intimidating or unclear. I hope that&amp;#39;s not the
majority&amp;#39;s feeling and that the gentle repetitiveness of this example
proves otherwise.&lt;/p&gt;

&lt;p&gt;On the other hand, I&amp;#39;ve started reading &amp;quot;The Reasoned Schemer&amp;quot; this
week. Now that&amp;#39;s intimidating.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Two new Hydra colors - pink and teal</title>
   <link href="https://oremacs.com/2015/02/19/hydra-colors-reloaded/"/>
   <updated>2015-02-19T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/19/hydra-colors-reloaded</id>
   <content type="html">&lt;p&gt;Two new colors are being added up to a total of five: red, blue,
amaranth, pink and teal.
I should carefully restate what they do to avoid confusion.&lt;/p&gt;

&lt;h2 id=&quot;the-three-rules-of-hydratics&quot;&gt;The three rules of Hydratics&lt;/h2&gt;

&lt;p&gt;&lt;strike&gt;1. A hydra may not injure a human being or, through inaction, allow a human being to come to harm.&lt;/strike&gt;&lt;/p&gt;

&lt;p&gt;Seriously though, see below.&lt;/p&gt;

&lt;h3 id=&quot;rule-1-hydra-heads-are-either-red-or-blue&quot;&gt;Rule 1: Hydra heads are either red or blue&lt;/h3&gt;

&lt;p&gt;Once you&amp;#39;re in a Hydra state:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;calling a red head will call the command and continue the state&lt;/li&gt;
&lt;li&gt;calling a blue head will call the command and stop the state&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They may have a reddish or a bluish face that isn&amp;#39;t exactly red or
blue, but that&amp;#39;s what they are underneath. I hope you get what I mean.&lt;/p&gt;

&lt;h3 id=&quot;rule-2-red-or-blue-is-inherited-from-the-body-color&quot;&gt;Rule 2: red or blue is inherited from the body color&lt;/h3&gt;

&lt;p&gt;This is merely a convenience, you can still explicitly override each
head to be blue or red:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if the body is red, amaranth or pink, the heads inherit red&lt;/li&gt;
&lt;li&gt;if the body is blue or teal, the heads inherit blue&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;rule-3&quot;&gt;Rule 3:&lt;/h3&gt;

&lt;p&gt;When you call a binding which isn&amp;#39;t a head:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;amaranth, teal and pink Hydras will intercept it&lt;/li&gt;
&lt;li&gt;red and blue Hydras will quit and let Emacs execute your binding&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, on intercepting a non-head, amaranth and teal will issue a
warning and do nothing without quitting. And pink will try to call the
intercepted command without quitting. Currently only non-prefix
bindings can be called, since I haven&amp;#39;t figured out how to do it for prefixes.&lt;/p&gt;

&lt;h3 id=&quot;a-nice-table-to-sum-things-up&quot;&gt;A nice table to sum things up&lt;/h3&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://github.com/kaushalmodi&quot;&gt;@kaushalmodi&lt;/a&gt; for pointing me in this direction:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;|----------+-----------+-----------------------+-----------------|
| Body     | Head      | Executing NON-HEADS   | Executing HEADS |
| Color    | Inherited |                       |                 |
|          | Color     |                       |                 |
|----------+-----------+-----------------------+-----------------|
| amaranth | red       | Disallow and Continue | Continue        |
| teal     | blue      | Disallow and Continue | Quit            |
| pink     | red       | Allow and Continue    | Continue        |
| red      | red       | Allow and Quit        | Continue        |
| blue     | blue      | Allow and Quit        | Quit            |
|----------+-----------+-----------------------+-----------------|
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;the-extra-awesome-ruby-style-hydra-docstrings&quot;&gt;The extra-awesome Ruby-style Hydra docstrings&lt;/h2&gt;

&lt;p&gt;Turns out learning Ruby wasn&amp;#39;t a complete waste of time, at least I
learned about string interpolation. And now I&amp;#39;m sticking it into Elisp
packages, first &lt;a href=&quot;https://github.com/abo-abo/tiny&quot;&gt;tiny&lt;/a&gt;, and now
&lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;How it works:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-toggle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;pink&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_a_ abbrev-mode:       %`abbrev-mode&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_d_ debug-on-error:    %`debug-on-error&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_f_ auto-fill-mode:    %`auto-fill-function&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_g_ golden-ratio-mode: %`golden-ratio-mode&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_t_ truncate-lines:    %`truncate-lines&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;_w_ whitespace-mode:   %`whitespace-mode&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;abbrev-mode&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;toggle-debug-on-error&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;auto-fill-mode&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;golden-ratio-mode&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;toggle-truncate-lines&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;whitespace-mode&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c C-v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-toggle/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, using e.g. &lt;code&gt;&amp;quot;_a_&amp;quot;&lt;/code&gt; translates to &lt;code&gt;&amp;quot;a&amp;quot;&lt;/code&gt; with proper face.  More
interestingly, e.g.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;foobar %`abbrev-mode&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;translates roughly to&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;foobar %S&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;abbrev-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This means that you actually see the state of the mode that you&amp;#39;re
changing.  The escape syntax was chosen with another intent in mind:
because of the backquote, if you have &lt;code&gt;company-mode&lt;/code&gt; on, you can
complete the symbols while in string.&lt;/p&gt;

&lt;p&gt;See how it looks like in action:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-toggle-pink.png&quot; alt=&quot;hydra-toggle-pink&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;small-note-on-pink-hydras&quot;&gt;Small note on pink Hydras&lt;/h2&gt;

&lt;p&gt;It&amp;#39;s useful for instance it the above example, when I don&amp;#39;t care about
self-inserting, but I still want to do navigation. Basically pink
Hydra is the closest thing to an actual minor mode. Thanks to
&lt;a href=&quot;https://github.com/angelic-sedition&quot;&gt;@angelic-sedition&lt;/a&gt; for the idea.&lt;/p&gt;

&lt;h2 id=&quot;small-note-on-teal-hydras&quot;&gt;Small note on teal Hydras&lt;/h2&gt;

&lt;p&gt;It provides an interface similar to &lt;code&gt;magit&lt;/code&gt; dispatch: pressing
appropriate keys does things and pressing the wrong keys issues a
warning. The only difference between teal and amaranth is the color
inheritance, otherwise they behave exactly the same.  This means that
if you want a non-quitting Hydra that will end up with more blue
heads, start with teal, otherwise, start with amaranth.
Thanks to &lt;a href=&quot;https://github.com/ffevotte&quot;&gt;@ffevotte&lt;/a&gt; for the idea.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;It feels like things are finally falling into place with this package.
I hope that you like the new changes and find new cool uses for the added abilities.
Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Reverting nonsense</title>
   <link href="https://oremacs.com/2015/02/18/undo-nonsense/"/>
   <updated>2015-02-18T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/18/undo-nonsense</id>
   <content type="html">&lt;p&gt;It happens to me frequently when making a demo, or just experimenting
around that I want to revert the buffer to the last saved
state. Obviously such a command exists in Emacs, and it&amp;#39;s
unsurprisingly called &lt;code&gt;revert-buffer&lt;/code&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Replace current buffer text with the text of the visited file on disk.
This undoes all changes since the file was visited or saved.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But the poor old &lt;code&gt;revert-buffer&lt;/code&gt; isn&amp;#39;t bound by default in Emacs. The perfect binding for it is &lt;kbd&gt;C-x C-r&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-x C-r&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;revert-buffer&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I believe the lambda is used to get the &amp;quot;no questions asked&amp;quot;
treatment.  Anyway, by default Emacs binds &lt;kbd&gt;C-x C-r&lt;/kbd&gt; to
&lt;code&gt;find-file-read-only&lt;/code&gt;, which really is a trash-tier command.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why is &lt;code&gt;find-file-read-only&lt;/code&gt; useless?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Because &lt;kbd&gt;C-x C-q&lt;/kbd&gt; is bound to &lt;code&gt;read-only-mode&lt;/code&gt; - a really
good command (made even better with &lt;code&gt;wdired&lt;/code&gt; and &lt;code&gt;wgrep&lt;/code&gt;).  So
&lt;code&gt;find-file-read-only&lt;/code&gt; is just &lt;kbd&gt;C-x C-f C-x C-q&lt;/kbd&gt;. And I don&amp;#39;t
ever recall needing to use that, since &lt;kbd&gt;v&lt;/kbd&gt;
(&lt;code&gt;dired-view-file&lt;/code&gt;) is almost equivalent if not better.&lt;/p&gt;

&lt;p&gt;As a bonus, &lt;kbd&gt;C-x C-r&lt;/kbd&gt; is mnemonic for &amp;quot;revert&amp;quot;.&lt;/p&gt;

&lt;h2 id=&quot;auto-reverting&quot;&gt;Auto-reverting&lt;/h2&gt;

&lt;p&gt;While on the topic, let me mention &lt;code&gt;auto-revert-mode&lt;/code&gt;. I have this in my config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-auto-revert-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This way, if any opened and saved file was modified outside of Emacs, it will be updated
in a short while. I was able to use this to a great advantage when writing the SVG picture
for the &lt;a href=&quot;/2015/02/14/semi-xmodmap/&quot;&gt;Xmodmap post&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I opened the SVG in the default image mode in one Emacs instance&lt;/li&gt;
&lt;li&gt;and opened the same document in XML mode in another (mode is toggled with &lt;kbd&gt;C-c C-c&lt;/kbd&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With that setup, I was able to see the picture update as I was inputting the XML.
Here&amp;#39;s some Elisp for XML generation, if you&amp;#39;re interested&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;make-row&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;row-str&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ix&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;iy&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fill&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapconcat&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;g&amp;gt;&amp;lt;text x=\&amp;quot;%d\&amp;quot; y=\&amp;quot;%d\&amp;quot; style=\&amp;quot;font-size:10px;fill:%s;font-family:Deja Vu Sans Mono\&amp;quot;&amp;gt;%s&amp;lt;/text&amp;gt;&amp;lt;/g&amp;gt;&amp;quot;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ix&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;iy&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;fill&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;elt&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;row-str&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringp&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;y&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make-string&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;number-sequence&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;row-str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;make-row&lt;/span&gt;
 &lt;span class=&quot;s&quot;&gt;&amp;quot;QWERTYUIOP&amp;quot;&lt;/span&gt;
 &lt;span class=&quot;mi&quot;&gt;95&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;140&lt;/span&gt;
 &lt;span class=&quot;s&quot;&gt;&amp;quot;#2b2828&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; =&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The last statement would generate:
&lt;g&gt;&lt;text x=&quot;95&quot; y=&quot;140&quot; style=&quot;font-size:10px;fill:#2b2828;font-family:Deja Vu Sans Mono&quot;&gt;Q&lt;/text&gt;&lt;/g&gt;
&lt;g&gt;&lt;text x=&quot;125&quot; y=&quot;140&quot; style=&quot;font-size:10px;fill:#2b2828;font-family:Deja Vu Sans Mono&quot;&gt;W&lt;/text&gt;&lt;/g&gt;
&lt;g&gt;&lt;text x=&quot;155&quot; y=&quot;140&quot; style=&quot;font-size:10px;fill:#2b2828;font-family:Deja Vu Sans Mono&quot;&gt;E&lt;/text&gt;&lt;/g&gt;
&lt;g&gt;&lt;text x=&quot;185&quot; y=&quot;140&quot; style=&quot;font-size:10px;fill:#2b2828;font-family:Deja Vu Sans Mono&quot;&gt;R&lt;/text&gt;&lt;/g&gt;
&lt;g&gt;&lt;text x=&quot;215&quot; y=&quot;140&quot; style=&quot;font-size:10px;fill:#2b2828;font-family:Deja Vu Sans Mono&quot;&gt;T&lt;/text&gt;&lt;/g&gt;
&lt;g&gt;&lt;text x=&quot;245&quot; y=&quot;140&quot; style=&quot;font-size:10px;fill:#2b2828;font-family:Deja Vu Sans Mono&quot;&gt;Y&lt;/text&gt;&lt;/g&gt;
&lt;g&gt;&lt;text x=&quot;275&quot; y=&quot;140&quot; style=&quot;font-size:10px;fill:#2b2828;font-family:Deja Vu Sans Mono&quot;&gt;U&lt;/text&gt;&lt;/g&gt;
&lt;g&gt;&lt;text x=&quot;305&quot; y=&quot;140&quot; style=&quot;font-size:10px;fill:#2b2828;font-family:Deja Vu Sans Mono&quot;&gt;I&lt;/text&gt;&lt;/g&gt;
&lt;g&gt;&lt;text x=&quot;335&quot; y=&quot;140&quot; style=&quot;font-size:10px;fill:#2b2828;font-family:Deja Vu Sans Mono&quot;&gt;O&lt;/text&gt;&lt;/g&gt;
&lt;g&gt;&lt;text x=&quot;365&quot; y=&quot;140&quot; style=&quot;font-size:10px;fill:#2b2828;font-family:Deja Vu Sans Mono&quot;&gt;P&lt;/text&gt;&lt;/g&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hydra 0.10.0 is out</title>
   <link href="https://oremacs.com/2015/02/17/hydra-0.10.0/"/>
   <updated>2015-02-17T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/17/hydra-0.10.0</id>
   <content type="html">&lt;p&gt;As usual, I&amp;#39;ll just re-state the
&lt;a href=&quot;https://github.com/abo-abo/hydra/releases/tag/0.10.0&quot;&gt;release notes&lt;/a&gt;,
while maybe adding a bit of flavor.&lt;/p&gt;

&lt;h2 id=&quot;new-features&quot;&gt;New features&lt;/h2&gt;

&lt;h3 id=&quot;define-hydra-heads-that-dont-show-up-in-the-hint-at-all&quot;&gt;Define Hydra heads that don&amp;#39;t show up in the hint at all&lt;/h3&gt;

&lt;p&gt;This can be done by setting the head&amp;#39;s hint explicitly to &lt;code&gt;nil&lt;/code&gt;, instead of the usual string. For
instance, if you always tend to bind the arrows to &lt;kbd&gt;hjkl&lt;/kbd&gt;, there&amp;#39;s no point to show a hint
for them.&lt;/p&gt;

&lt;h3 id=&quot;use-a-dedicated-window-for-hydra-hints&quot;&gt;Use a dedicated window for Hydra hints&lt;/h3&gt;

&lt;p&gt;Since version &lt;code&gt;0.10.0&lt;/code&gt;, setting &lt;code&gt;hydra-lv&lt;/code&gt; to &lt;code&gt;t&lt;/code&gt; (the default setting) will make it use a dedicated
window right above the Echo Area for hints. This has the advantage that you can immediately see any
&lt;code&gt;message&lt;/code&gt; output from the functions that you call, since Hydra no longer uses &lt;code&gt;message&lt;/code&gt; to display
the hint. You can still have the old behavior by setting &lt;code&gt;hydra-lv&lt;/code&gt; to &lt;code&gt;nil&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;How it looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-lv.png&quot; alt=&quot;hydra-lv&quot;&gt;&lt;/p&gt;

&lt;p&gt;Here, an error was triggered by &lt;code&gt;previous-line&lt;/code&gt; and the message is displayed without interrupting
the hint.&lt;/p&gt;

&lt;h3 id=&quot;allow-duplicate-functions-in-heads&quot;&gt;Allow duplicate functions in heads&lt;/h3&gt;

&lt;p&gt;Duplicate functions will be concatenated in the hint.
This was already covered in &lt;a href=&quot;/2015/02/16/hydra-multi/&quot;&gt;yesterday&amp;#39;s post&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;add-option-to-font-lock-defhydra&quot;&gt;Add option to font-lock &lt;code&gt;defhydra&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;If you want to nicely font-lock your &lt;code&gt;defhydra&lt;/code&gt; statements, just add this to your config:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-add-font-lock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Additionally, &lt;code&gt;defhydra&lt;/code&gt; is now to be indented as a &lt;code&gt;defun&lt;/code&gt;, so it will be indented like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-goto-line&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-g&amp;quot;&lt;/span&gt;
                           &lt;span class=&quot;nb&quot;&gt;:pre&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;linum-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                           &lt;span class=&quot;nb&quot;&gt;:post&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;linum-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                           &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;goto-line&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;line&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;char&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that the indentation of the body argument is as if it was data
and not code, i.e. the proper one. As you see, I even added &lt;code&gt;defhydra&lt;/code&gt;
to the blog&amp;#39;s Pygments list for Elisp.&lt;/p&gt;

&lt;h2 id=&quot;incompatible-changes&quot;&gt;Incompatible changes&lt;/h2&gt;

&lt;p&gt;The macro &lt;code&gt;hydra-create&lt;/code&gt;, as well as the variables that were supposed
to be used with it (&lt;code&gt;hydra-example-text-scale&lt;/code&gt;,
&lt;code&gt;hydra-example-move-window-splitter&lt;/code&gt;, &lt;code&gt;hydra-example-goto-error&lt;/code&gt;,
&lt;code&gt;hydra-example-windmove&lt;/code&gt;) were removed. All the functionality is still
there in hydra-examples.el with the better &lt;code&gt;defhydra&lt;/code&gt; macro.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you like the new changes. And if you&amp;#39;re byte-compiling
your code that uses &lt;code&gt;defhydra&lt;/code&gt;, don&amp;#39;t forget to re-compile. Also, the
latest version of &lt;code&gt;ace-window&lt;/code&gt; will ignore &lt;code&gt;*LV*&lt;/code&gt; buffer while
switching, as it did for &lt;code&gt;*Calc Trail*&lt;/code&gt; before.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Binding one function multiple times in Hydra</title>
   <link href="https://oremacs.com/2015/02/16/hydra-multi/"/>
   <updated>2015-02-16T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/16/hydra-multi</id>
   <content type="html">&lt;p&gt;Here&amp;#39;s a recent feature that&amp;#39;s now available in &lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-zoom&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f2&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;zoom&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-increase&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;in&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-decrease&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;out&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;text-scale-set&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;reset&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;text-scale-set&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:bind&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;2&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;text-scale-set&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:bind&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, the entry points are &lt;kbd&gt;&amp;lt;f2&amp;gt; g&lt;/kbd&gt;, &lt;kbd&gt;&amp;lt;f2&amp;gt; l&lt;/kbd&gt;, and &lt;kbd&gt;&amp;lt;f2&amp;gt; 0&lt;/kbd&gt;, the
others aren&amp;#39;t bound in the global map.
You can also have the same function in both red and blue versions. Here&amp;#39;s how the hint will look like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-multi.png&quot; alt=&quot;hydra-multi&quot;&gt;&lt;/p&gt;

&lt;p&gt;The multiply-defined functions will be neatly grouped together.&lt;/p&gt;

&lt;p&gt;If you remember, &lt;code&gt;(text-scale-set 0)&lt;/code&gt; uses a sexp syntax for a Hydra
head: it will be wrapped in &lt;code&gt;(lambda () (interactive) ...)&lt;/code&gt; automatically.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Doing sudo stuff with tramp</title>
   <link href="https://oremacs.com/2015/02/15/sudo-stuffs/"/>
   <updated>2015-02-15T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/15/sudo-stuffs</id>
   <content type="html">&lt;p&gt;Somehow, I accumulated a few files owned by root that should have been
owned by me. Below, I&amp;#39;ll describe a solution to get rid of them based
on &lt;code&gt;dired&lt;/code&gt; and &lt;code&gt;tramp&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;step-one-open-the-directory-with-sudo-privileges&quot;&gt;Step one: open the directory with sudo privileges&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ll obviously need the sudo privilege to change the owner of a file owned
by root. Might as well start with that.&lt;/p&gt;

&lt;p&gt;Thankfully, I do have a shortcut:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;sudired&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;tramp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;expand-file-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^/sudo:&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;user-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Already in sudo&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/sudo::&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;!&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;sudired&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The function above will open the current directory in sudo mode. I
decided to bind it to &lt;kbd&gt;!&lt;/kbd&gt;, since the default &lt;kbd&gt;&amp;amp;&lt;/kbd&gt;
seems strictly better than &lt;kbd&gt;!&lt;/kbd&gt;. The function will ask you for
the password once.  Afterwards, you can open other directories without
having to enter the password.&lt;/p&gt;

&lt;h2 id=&quot;step-two-find-dired&quot;&gt;Step two: &lt;code&gt;find-dired&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;So now, while in sudo mode of the directory in question:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Call &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;find-dired&lt;/code&gt;. It&amp;#39;s not bound by default, and I
don&amp;#39;t bind it myself since it&amp;#39;s quite situational (I do bind
&lt;code&gt;find-name-dired&lt;/code&gt; to &lt;kbd&gt;F&lt;/kbd&gt; in &lt;code&gt;dired-mode&lt;/code&gt; though).&lt;/li&gt;
&lt;li&gt;It prompts you for the directory. I just press &lt;kbd&gt;RET&lt;/kbd&gt;, since the default one is what I need.&lt;/li&gt;
&lt;li&gt;Next, it prompts for &lt;code&gt;find&lt;/code&gt; args. These are the arguments to the
UNIX command &lt;code&gt;find&lt;/code&gt;. Here, I need to pass &lt;code&gt;-user root&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The command has finished and I can see the results. I can select
some of them by pressing &lt;kbd&gt;m&lt;/kbd&gt; (&lt;code&gt;dired-mark&lt;/code&gt;) a few times, or
mark them all at once with &lt;kbd&gt;t&lt;/kbd&gt; (&lt;code&gt;dired-toggle-marks&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Finally, call &lt;kbd&gt;O&lt;/kbd&gt; (&lt;code&gt;dired-do-chown&lt;/code&gt;) on the marked files and enter &lt;code&gt;oleh&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Done. I&amp;#39;m sure that the admin types can cook up some &lt;code&gt;find&lt;/code&gt;-&lt;code&gt;exec&lt;/code&gt;-&lt;code&gt;chown&lt;/code&gt; combo to do the same thing,
but the &lt;code&gt;find-dired&lt;/code&gt; approach is both simpler and more flexible, since I can confirm and edit the list
of files being changed.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Semimap - .Xmodmap with semicolon as an additional modifier</title>
   <link href="https://oremacs.com/2015/02/14/semi-xmodmap/"/>
   <updated>2015-02-14T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/14/semi-xmodmap</id>
   <content type="html">&lt;p&gt;Today, I&amp;#39;ll share my keyboard layout, based on QWERTY, that
facilitates all tech-related activities, especially Emacs.  I&amp;#39;ve been
using a version of this for about three years now, and only a single
key has been changed in the last two years. Without further ado,
&lt;a href=&quot;https://github.com/abo-abo/semimap&quot;&gt;here it is&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/semi-qwerty.png&quot; alt=&quot;semimap&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-most-visible-change&quot;&gt;The most visible change&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ve made &lt;kbd&gt;;&lt;/kbd&gt; stop inserting &lt;code&gt;;&lt;/code&gt; and instead act as
&lt;code&gt;Mode_switch&lt;/code&gt;: a modifier similar to control or meta.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I&amp;#39;m pressing &lt;kbd&gt;;-j&lt;/kbd&gt; to enter &lt;kbd&gt;;&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;I&amp;#39;m pressing &lt;kbd&gt;;-d&lt;/kbd&gt; to enter &lt;kbd&gt;:&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I&amp;#39;m giving up the ability to press &lt;kbd&gt;;&lt;/kbd&gt; with a single key,
and remapping &lt;kbd&gt;:&lt;/kbd&gt; from one two-key combination to another
two-key combination.&lt;/p&gt;

&lt;p&gt;In return, I&amp;#39;m getting a QWERTY with all these wonderful shortcuts.&lt;/p&gt;

&lt;h2 id=&quot;the-rsi-savers&quot;&gt;The RSI-savers&lt;/h2&gt;

&lt;p&gt;The general ones are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;RET&lt;/kbd&gt; on &lt;kbd&gt;;-v&lt;/kbd&gt; (symmetric with &lt;kbd&gt;C-m&lt;/kbd&gt;)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;DEL&lt;/kbd&gt; on &lt;kbd&gt;;-o&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you&amp;#39;re writing a bunch of C++, &lt;kbd&gt;_&lt;/kbd&gt; on &lt;kbd&gt;;-s&lt;/kbd&gt; is very good.&lt;/p&gt;

&lt;p&gt;Likewise, &lt;kbd&gt;-&lt;/kbd&gt; on &lt;kbd&gt;;-a&lt;/kbd&gt; is great for LISP.&lt;/p&gt;

&lt;p&gt;For LaTeX, &lt;kbd&gt;&amp;#92;&lt;/kbd&gt; on &lt;kbd&gt;;-w&lt;/kbd&gt; is good since I switched from
a keyboard that had it near &lt;kbd&gt;z&lt;/kbd&gt; to a keyboard that has it near &lt;kbd&gt;RET&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;I&amp;#39;m guessing &lt;kbd&gt;~&lt;/kbd&gt; on &lt;kbd&gt;;-t&lt;/kbd&gt; isn&amp;#39;t bad for shell, but I don&amp;#39;t use it that much.&lt;/p&gt;

&lt;h2 id=&quot;the-basic-remaps&quot;&gt;The basic remaps&lt;/h2&gt;

&lt;p&gt;These are just char-for-char remaps. They are composable, for instance
I have &lt;code&gt;dired-jump&lt;/code&gt; on &lt;kbd&gt;C-:&lt;/kbd&gt;, which means that I&amp;#39;m pressing
&lt;kbd&gt;C-;-d&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Some math symbols are mnemonic: &lt;kbd&gt;e&lt;/kbd&gt;-equal,
&lt;kbd&gt;l&lt;/kbd&gt;-lesser, &lt;kbd&gt;g&lt;/kbd&gt;-greater.
If you&amp;#39;re using &lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;, it might become more clear for you
why I&amp;#39;ve put &lt;code&gt;lispy-slurp&lt;/code&gt; on &lt;kbd&gt;&amp;gt;&lt;/kbd&gt; and &lt;code&gt;lispy-barf&lt;/code&gt; on &lt;kbd&gt;&amp;lt;&lt;/kbd&gt;. Although
pressing these keys with a shift isn&amp;#39;t the worst thing, having them on the home row is pretty cool.&lt;/p&gt;

&lt;h2 id=&quot;the-pairs&quot;&gt;The pairs&lt;/h2&gt;

&lt;p&gt;Here are the translations meant for pairs:
&lt;kbd&gt;q&lt;/kbd&gt; - &lt;kbd&gt;θ&lt;/kbd&gt;,
&lt;kbd&gt;f&lt;/kbd&gt; - &lt;kbd&gt;φ&lt;/kbd&gt;,
&lt;kbd&gt;r&lt;/kbd&gt; - &lt;kbd&gt;ρ&lt;/kbd&gt;,
&lt;kbd&gt;c&lt;/kbd&gt; - &lt;kbd&gt;σ&lt;/kbd&gt;.
These are meant for Emacs and &lt;code&gt;.inputrc&lt;/code&gt;. In both cases, e.g. &lt;kbd&gt;φ&lt;/kbd&gt; should insert &lt;code&gt;()&lt;/code&gt; and
go backward one char. Here&amp;#39;s my &lt;code&gt;.inputrc&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;set input-meta on
set output-meta on
set convert-meta off
&amp;quot;θ&amp;quot;:&amp;quot;&amp;quot;\C-b&amp;quot;&amp;quot;
&amp;quot;ω&amp;quot;:&amp;quot;&amp;#39;\C-b&amp;#39;&amp;quot;
&amp;quot;\e\C-l&amp;quot;:&amp;quot;\C-e | less\C-m&amp;quot;
&amp;quot;υ&amp;quot;:&amp;quot;&amp;gt;\C-b&amp;lt;&amp;quot;
&amp;quot;σ&amp;quot;:&amp;quot;}\C-b{&amp;quot;
&amp;quot;φ&amp;quot;:&amp;quot;)\C-b(&amp;quot;
&amp;quot;ρ&amp;quot;:&amp;quot;]\C-b[&amp;quot;

set completion-ignore-case on
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With this &lt;code&gt;.inputrc&lt;/code&gt;, it&amp;#39;s like I have some kind of electric mode in my bash.
In Emacs, the pairs are bound in a straightforward way:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ins-brackets&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;major-mode&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;term-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;term-send-raw-string&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;term-send-raw-string&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^B&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;region-active-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy--surround-region&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[]&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ρ&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ins-brackets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For LISP, I use &lt;code&gt;lispy&lt;/code&gt;-specific bindings:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;φ&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-parens&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;σ&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-braces&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ρ&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-brackets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;θ&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-quotes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;χ&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;the-rest-of-the-greek-chars&quot;&gt;The rest of the Greek chars&lt;/h2&gt;

&lt;p&gt;These are bound to various Emacs functions. In fact, I initially started with all Greek chars, and
bound e.g.:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ε&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When these remap-type bindings became mature, I&amp;#39;ve put them directly
into &lt;code&gt;.Xmodmap&lt;/code&gt;, which gave the advantage of being able to compose the
keys.&lt;/p&gt;

&lt;p&gt;These bindings are as good and usable as the control plus lower case
chars. Use them wisely and you can get a very ergonomic setup. Some
ideas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;switching buffers on &lt;kbd&gt;;-h&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;switching windows on &lt;kbd&gt;;-n&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;jumping to bookmarks on &lt;kbd&gt;;-m&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;the-shifted-digits&quot;&gt;The shifted digits&lt;/h2&gt;

&lt;p&gt;I find it much easier to press e.g. &lt;kbd&gt;;-4&lt;/kbd&gt; to insert &lt;code&gt;$&lt;/code&gt;,
rather than &lt;kbd&gt;S-4&lt;/kbd&gt;. I also restored the justice of &lt;code&gt;0&lt;/code&gt; coming &lt;strong&gt;before&lt;/strong&gt; &lt;code&gt;1&lt;/code&gt; by mapping
&lt;kbd&gt;;-&amp;#96;&lt;/kbd&gt; to &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you&amp;#39;ll find some use and enjoyment in these ramappings, if
you&amp;#39;re not afraid to experiment a little.  The cost of losing the
semicolon is pretty minor, the bigger issue is in finding the
unmodified QWERTY extremely sluggish after using this approach.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Elisp linting options</title>
   <link href="https://oremacs.com/2015/02/13/elisp-linting/"/>
   <updated>2015-02-13T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/13/elisp-linting</id>
   <content type="html">&lt;p&gt;I discovered today that I was using &lt;code&gt;declare-function&lt;/code&gt; in a wrong way.
So I&amp;#39;ll share how to use it properly.&lt;/p&gt;

&lt;h2 id=&quot;declare-function&quot;&gt;&lt;code&gt;declare-function&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;I was just using it to shut up the byte compiler&amp;#39;s &lt;code&gt;&amp;quot;not known to be
defined&amp;quot;&lt;/code&gt; warning.  Turns out that it can also be used to check if the
functions actually exist in the file to which they point to. You can
use &lt;code&gt;check-declare-file&lt;/code&gt; to check one file, or
&lt;code&gt;check-declare-directory&lt;/code&gt; to recursively check the whole directory.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s an example output:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;Warning (check-declare): helm-info.el said `Info-goto-node&amp;#39; was defined in info.el.gz: arglist mismatch
Warning (check-declare): helm-info.el said `Info-find-node&amp;#39; was defined in info.el.gz: arglist mismatch
Warning (check-declare): helm-plugin.el said `Info-goto-node&amp;#39; was defined in info.el.gz: arglist mismatch
Warning (check-declare): helm-plugin.el said `Info-find-node&amp;#39; was defined in info.el.gz: arglist mismatch
Warning (check-declare): helm-emms.el said `with-current-emms-playlist&amp;#39; was defined in emms.el: function not found
Warning (check-declare): projectile.el said `ggtags-ensure-project&amp;#39; was defined in ggtags.el: file not found
Warning (check-declare): projectile.el said `ggtags-update-tags&amp;#39; was defined in ggtags.el: file not found
Warning (check-declare): async-bytecomp.el said `package-desc-reqs&amp;#39; was defined in package.el.gz: function not found
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;My mistake was assuming that the &lt;code&gt;FILE&lt;/code&gt; argument of &lt;code&gt;declare-function&lt;/code&gt;
was somehow related to &lt;code&gt;require&lt;/code&gt;.  But of course it had to be simply
the name of the file that contains the said function. If the referenced file is in an external package,
e.g. &lt;code&gt;(declare-function cider-repl-return &amp;quot;ext:cider-repl&amp;quot;)&lt;/code&gt; can be used.&lt;/p&gt;

&lt;h2 id=&quot;checkdoc&quot;&gt;&lt;code&gt;checkdoc&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;This one is actually very useful once you embrace it.  It will
&lt;em&gt;tsk-tsk&lt;/em&gt; you until all your functions are documented. And since
you&amp;#39;re already writing a docstring, might as well make it
good. Sometimes this leads me to removing a function that&amp;#39;s called
only once, just so that I don&amp;#39;t have to document it.&lt;/p&gt;

&lt;h2 id=&quot;byte-compile-file&quot;&gt;&lt;code&gt;byte-compile-file&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Leaving the obvious for last. This will speed up the code in addition to checking for errors.
In &lt;code&gt;dired&lt;/code&gt; you can use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;several &lt;kbd&gt;m&lt;/kbd&gt; (&lt;code&gt;dired-mark&lt;/code&gt;) followed by &lt;kbd&gt;B&lt;/kbd&gt; (&lt;code&gt;dired-do-byte-compile&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;a single &lt;kbd&gt;*%&lt;/kbd&gt; (&lt;code&gt;dired-mark-files-regexp&lt;/code&gt;) &lt;code&gt;el$&lt;/code&gt; followed by &lt;kbd&gt;B&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I even have a &lt;code&gt;compile&lt;/code&gt; target in &lt;code&gt;lispy&lt;/code&gt;&amp;#39;s &lt;a href=&quot;https://github.com/abo-abo/lispy/blob/master/Makefile&quot;&gt;Makefile&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Makefile&quot; data-lang=&quot;Makefile&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;compile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;CASK&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;exec&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;EMACS&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -batch &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;LOAD&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -l lispy-test.el -l compile.elt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here are the contents of compile.elt:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;check-declare&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;check-declare-ext-errors&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;lispy.el&amp;quot;&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;&amp;quot;lispy-inline.el&amp;quot;&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;&amp;quot;le-clojure.el&amp;quot;&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;&amp;quot;le-scheme.el&amp;quot;&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;&amp;quot;le-lisp.el&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapc&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;byte-compile-file&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ert&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;check-declare-files&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Occasionally ido</title>
   <link href="https://oremacs.com/2015/02/12/ido-occasional/"/>
   <updated>2015-02-12T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/12/ido-occasional</id>
   <content type="html">&lt;p&gt;As I was refactoring my &lt;code&gt;.emacs&lt;/code&gt;, I found a silly wrapper around
&lt;code&gt;describe-function&lt;/code&gt; that uses &lt;code&gt;ido-completing-read&lt;/code&gt;.  I think I was
aware at the time that
&lt;a href=&quot;https://github.com/DarwinAwardWinner/ido-ubiquitous&quot;&gt;ido-ubiquitous&lt;/a&gt;
could simply make &lt;code&gt;describe-function&lt;/code&gt; use &lt;code&gt;ido-completing-read&lt;/code&gt;. The
problem was that it also affected the &lt;code&gt;completing-read&lt;/code&gt; in functions
that became &lt;code&gt;headlong-bookmark-jump&lt;/code&gt; from
&lt;a href=&quot;https://github.com/abo-abo/headlong&quot;&gt;headlong&lt;/a&gt;
(see &lt;a href=&quot;/2015/01/06/rushing-headlong/&quot;&gt;the corresponding post&lt;/a&gt;
if you missed it).&lt;/p&gt;

&lt;h2 id=&quot;a-bit-of-code-to-make-things-right&quot;&gt;A bit of code to make things right&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-occasional-completing-read&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;prompt&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;collection&lt;/span&gt;
     &lt;span class=&quot;kp&quot;&gt;&amp;amp;optional&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;predicate&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;require-match&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;initial-input&lt;/span&gt;
       &lt;span class=&quot;nv&quot;&gt;hist&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;inherit-input-method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Use &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ido-completing-read&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; if the collection isn&amp;#39;t too large.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;Fall back to &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`completing-read&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; otherwise.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;filtered-collection&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;all-completions&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;collection&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;predicate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;filtered-collection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-completing-read&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;prompt&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;filtered-collection&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;require-match&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;initial-input&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hist&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;completing-read&lt;/span&gt;
       &lt;span class=&quot;nv&quot;&gt;prompt&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;collection&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;predicate&lt;/span&gt;
       &lt;span class=&quot;nv&quot;&gt;require-match&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;initial-input&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hist&lt;/span&gt;
       &lt;span class=&quot;nv&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;inherit-input-method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defmacro&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;with-ido-completion&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fun&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Wrap FUN in another interactive function with ido completion.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;intern&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;symbol-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/with-ido&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
     &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Forward to &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`%S&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; with ido completion.&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fun&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;completing-read-function&lt;/span&gt;
            &lt;span class=&quot;ss&quot;&gt;&amp;#39;ido-occasional-completing-read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call-interactively&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fun&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The only thing that &lt;code&gt;ido-occasional-completing-read&lt;/code&gt; does is to
pre-filter &lt;code&gt;collection&lt;/code&gt; with &lt;code&gt;predicate&lt;/code&gt; and pass it on to
&lt;code&gt;ido-completing-read&lt;/code&gt;. And &lt;code&gt;with-ido-completion&lt;/code&gt; is just a convenience wrapper.&lt;/p&gt;

&lt;h2 id=&quot;example&quot;&gt;Example&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f1&amp;gt; f&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with-ido-completion&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;describe-function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f1&amp;gt; v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with-ido-completion&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;describe-variable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f2&amp;gt; i&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with-ido-completion&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;info-lookup-symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;with-ido-completion&lt;/code&gt; will generate
e.g. &lt;code&gt;describe-function/with-ido&lt;/code&gt;, which will subsequently be bound to
&lt;kbd&gt;&amp;lt;f1&amp;gt; f&lt;/kbd&gt;. The good-old &lt;code&gt;describe-function&lt;/code&gt; is left unaffected.&lt;/p&gt;

&lt;p&gt;Note, that if I turn on &lt;code&gt;helm-mode&lt;/code&gt; at this point, it will override
&lt;code&gt;describe-function&lt;/code&gt; with its own completion, but it will not touch
&lt;code&gt;describe-function/with-ido&lt;/code&gt; which I bound. This can be useful e.g. if
I want to use &lt;code&gt;helm-mode&lt;/code&gt; (or &lt;code&gt;icy-mode&lt;/code&gt; or &lt;code&gt;icomplete-mode&lt;/code&gt;) for some
completion, but not all.&lt;/p&gt;

&lt;p&gt;You can find the package at &lt;a href=&quot;https://github.com/abo-abo/ido-occasional&quot;&gt;ido-occasional&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Elisp newbie-style</title>
   <link href="https://oremacs.com/2015/02/11/elisp-newbie-style/"/>
   <updated>2015-02-11T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/11/elisp-newbie-style</id>
   <content type="html">&lt;p&gt;I&amp;#39;ve been cleaning up my .emacs lately, with the intention to put my
whole config on Github. Today, I&amp;#39;ll show you a useful function for
describing the current buffer&amp;#39;s key bindings. The function will
generate something like this (with all letters, of course):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;; (global-set-key (kbd &amp;quot;a&amp;quot;) &amp;#39;self-insert-command)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (global-set-key (kbd &amp;quot;C-b&amp;quot;) &amp;#39;backward-char)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (global-set-key (kbd &amp;quot;M-c&amp;quot;) &amp;#39;subword-capitalize)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (global-set-key (kbd &amp;quot;C-M-d&amp;quot;) &amp;#39;down-list)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (global-set-key (kbd &amp;quot;η&amp;quot;) &amp;#39;save-and-switch-buffer)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (global-set-key (kbd &amp;quot;C-θ&amp;quot;) &amp;#39;ins-single-quotes)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (global-set-key (kbd &amp;quot;M-ι&amp;quot;) &amp;#39;nil)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (global-set-key (kbd &amp;quot;C-M-κ&amp;quot;) &amp;#39;nil)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;First, I&amp;#39;ll show you how I wrote it down as a newbie, and
then today&amp;#39;s corrections with some remarks.&lt;/p&gt;

&lt;h2 id=&quot;old-style&quot;&gt;Old style&lt;/h2&gt;

&lt;p&gt;Please don&amp;#39;t try this at home:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys-latin&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;loop&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?a&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?z&lt;/span&gt;
     &lt;span class=&quot;nv&quot;&gt;collect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys-greek&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;loop&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?α&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?ω&lt;/span&gt;
     &lt;span class=&quot;nv&quot;&gt;collect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys-describe-prefix&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;-&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;prin1-to-string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;key-binding&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;binding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt;
               &lt;span class=&quot;s&quot;&gt;&amp;quot;;; (global-set-key (kbd \&amp;quot;&amp;quot;&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;binding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;) &amp;#39;&amp;quot;&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;binding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;s&quot;&gt;&amp;quot;)\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;concat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys-describe-prefixes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;with-output-to-temp-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*Bindings*&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f-letters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;princ&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;keys-describe-prefix&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;f-letters&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;princ&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\n\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
               &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;keys-latin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;keys-greek&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;corrections&quot;&gt;Corrections&lt;/h2&gt;

&lt;h3 id=&quot;redundant-autoloads&quot;&gt;Redundant autoloads&lt;/h3&gt;

&lt;p&gt;Since the entry point of the whole thing is &lt;code&gt;keys-describe-prefixes&lt;/code&gt;, only it needs to be autoloaded.
Once an autoloaded function is called, it will load the whole buffer. So if e.g. &lt;code&gt;keys-latin&lt;/code&gt; is
not being used anywhere else outside this file, it doesn&amp;#39;t need an autoload.&lt;/p&gt;

&lt;h3 id=&quot;redundant-functions&quot;&gt;Redundant functions&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;keys-latin&lt;/code&gt; and &lt;code&gt;keys-greek&lt;/code&gt; are actually very small and not used anywhere else. It might be better
to just inline them into &lt;code&gt;keys-describe-prefixes&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;redundant-libraries&quot;&gt;Redundant libraries&lt;/h3&gt;

&lt;p&gt;Here, &lt;code&gt;dash&lt;/code&gt; is required just for the &lt;code&gt;-&amp;gt;&amp;gt;&lt;/code&gt; macro, which can actually
be obtained from a core library &lt;code&gt;subr-x&lt;/code&gt; as &lt;code&gt;thread-last&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;But even then, it&amp;#39;s just better to unwind the whole thing. After that, it becomes clear that
the three consecutive &lt;code&gt;mapcar&lt;/code&gt;s could be folded into a single &lt;code&gt;mapcar&lt;/code&gt; with the help of a &lt;code&gt;let&lt;/code&gt; binding.&lt;/p&gt;

&lt;p&gt;After the fold, it starts to look silly, since I&amp;#39;m &lt;code&gt;cons&lt;/code&gt;ing just to
take a &lt;code&gt;car&lt;/code&gt; and &lt;code&gt;cdr&lt;/code&gt; later:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys-describe-prefix&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;concat&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;binding&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;
                          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;prin1-to-string&lt;/span&gt;
                           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;key-binding&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt;
               &lt;span class=&quot;s&quot;&gt;&amp;quot;;; (global-set-key (kbd \&amp;quot;&amp;quot;&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;binding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;) &amp;#39;&amp;quot;&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;binding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;s&quot;&gt;&amp;quot;)\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
          &lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s a simplification, removing &lt;code&gt;binding&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys-describe-prefix&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;concat&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt;
               &lt;span class=&quot;s&quot;&gt;&amp;quot;;; (global-set-key (kbd \&amp;quot;&amp;quot;&lt;/span&gt;
               &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;
               &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;) &amp;#39;&amp;quot;&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;prin1-to-string&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;key-binding&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
               &lt;span class=&quot;s&quot;&gt;&amp;quot;)\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
          &lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I guess that I didn&amp;#39;t know about &lt;code&gt;format&lt;/code&gt; function back then, and the fact that &lt;code&gt;&amp;quot;%S&amp;quot;&lt;/code&gt; key is equivalent
to &lt;code&gt;prin1-to-string&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys-describe-prefix&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;concat&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;;; (global-set-key (kbd \&amp;quot;%s\&amp;quot;) &amp;#39;%S)\n&amp;quot;&lt;/span&gt;
                      &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;key-binding&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
          &lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next, the combination &lt;code&gt;(apply #&amp;#39;concat (mapcar ...))&lt;/code&gt; is already implemented in C as &lt;code&gt;mapconcat&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys-describe-prefix&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapconcat&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;;; (global-set-key (kbd \&amp;quot;%s\&amp;quot;) &amp;#39;%S)&amp;quot;&lt;/span&gt;
               &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;key-binding&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
   &lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the end, &lt;code&gt;keys-describe-prefix&lt;/code&gt; turned out to be so small that I could just inline it into
&lt;code&gt;keys-describe-prefixes&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;final-version&quot;&gt;Final version&lt;/h2&gt;

&lt;p&gt;Note that here I also replaced &lt;code&gt;mapcar&lt;/code&gt; with &lt;code&gt;dolist&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;;;###autoload&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keys-describe-prefixes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;with-output-to-temp-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*Bindings*&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dolist&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letter-group&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt;
                           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cl-loop&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?a&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?z&lt;/span&gt;
                                    &lt;span class=&quot;nv&quot;&gt;collect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cl-loop&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?α&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;?ω&lt;/span&gt;
                                    &lt;span class=&quot;nv&quot;&gt;collect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dolist&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;princ&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapconcat&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;;; (global-set-key (kbd \&amp;quot;%s\&amp;quot;) &amp;#39;%S)&amp;quot;&lt;/span&gt;
                            &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;
                            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;key-binding&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
                &lt;span class=&quot;nv&quot;&gt;letter-group&lt;/span&gt;
                &lt;span class=&quot;s&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;princ&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\n\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I hope that this sort of analysis can be useful for people starting to
learn Elisp.  And if you have corrections for the final version, do
let me know, I don&amp;#39;t mind being schooled, as long as I get better in
the end.&lt;/p&gt;

&lt;p&gt;The output of &lt;code&gt;keys-describe-prefixes&lt;/code&gt; can be used to learn some
bindings that you didn&amp;#39;t know about, and also as a template to
redefine some bindings that you don&amp;#39;t need.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Easy ido improvement</title>
   <link href="https://oremacs.com/2015/02/10/ido-backspace/"/>
   <updated>2015-02-10T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/10/ido-backspace</id>
   <content type="html">&lt;p&gt;Heh, I guess I was so busy at work that I missed the opportunity to
make an especially good post for the 50-post landmark. At least
according to &lt;kbd&gt;M-=&lt;/kbd&gt; (&lt;code&gt;count-words-region&lt;/code&gt;) in my &lt;strong&gt;_posts&lt;/strong&gt;&amp;#39;
&lt;code&gt;dired&lt;/code&gt; buffer, this is the 53rd post.&lt;/p&gt;

&lt;h2 id=&quot;ido-backspace&quot;&gt;&lt;code&gt;ido-backspace&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;This echoes to my very second post,
&lt;a href=&quot;/2014/12/21/helm-backspace/&quot;&gt;easy helm improvement&lt;/a&gt;,
which was about implementing a similar function for &lt;code&gt;helm&lt;/code&gt;.
So here it is:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;delsel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-backspace&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Forward to &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`backward-delete-char&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;On error (read-only), quit without selecting.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;condition-case&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;backward-delete-char&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;minibuffer-keyboard-quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-common-completion-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;DEL&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ido-backspace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With this setup, when e.g. calling &lt;code&gt;ido-switch-buffer&lt;/code&gt;, you can cancel
with &lt;kbd&gt;DEL&lt;/kbd&gt;.  This, of course, will also work for
&lt;a href=&quot;https://github.com/nonsequitur/smex&quot;&gt;smex&lt;/a&gt; and
&lt;a href=&quot;https://github.com/magit/magit&quot;&gt;some&lt;/a&gt;
&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;other&lt;/a&gt; packages that allow for
&lt;code&gt;ido&lt;/code&gt; completion:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;magit-completing-read-function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;magit-ido-completing-read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-completion-method&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ido&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that the &lt;code&gt;define-key&lt;/code&gt; part of the code takes an advantage of a
recent patch to &lt;code&gt;ido&lt;/code&gt; that&amp;#39;s available in the trunk.  You can find the
old way of binding keys for &lt;code&gt;ido&lt;/code&gt; in an earlier post,
&lt;a href=&quot;/2015/01/09/ido-find-file-tilde/&quot;&gt;tilde in ido-find-file&lt;/a&gt;.
That post actually played a small role in speeding up the patch, for
which we should thank &lt;a href=&quot;https://github.com/tarsius&quot;&gt;@tarsius&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Note that this behavior will not affect &lt;code&gt;ido-find-file&lt;/code&gt;, since it has its own map.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ido-vertical - like ido, but vertical!</title>
   <link href="https://oremacs.com/2015/02/09/ido-vertical/"/>
   <updated>2015-02-09T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/09/ido-vertical</id>
   <content type="html">&lt;h2 id=&quot;intro&quot;&gt;Intro&lt;/h2&gt;

&lt;p&gt;As I was releasing &lt;a href=&quot;https://github.com/abo-abo/lispy/releases/tag/0.23.0&quot;&gt;lispy 0.23.0&lt;/a&gt;, which added
an option for methods of jumping to semantic tags other than &lt;code&gt;helm&lt;/code&gt;, I&amp;#39;ve discovered
&lt;a href=&quot;https://github.com/gempesaw/ido-vertical-mode.el&quot;&gt;ido-vertical-mode&lt;/a&gt;. I also made some changes to
it, so now it looks like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lispy-ido-vertical.png&quot; alt=&quot;lispy-ido-vertical&quot;&gt;&lt;/p&gt;

&lt;p&gt;The changes are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the current text is highlighted in all matches&lt;/li&gt;
&lt;li&gt;the current number of total matches is displayed in the first line&lt;/li&gt;
&lt;li&gt;I also customized the face for the first match and the only match (you can&amp;#39;t see that one here)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Helm is still the big gun when it comes to completing lists with hundreds of candidates,
but with the above changes, &lt;code&gt;ido-vertical-mode&lt;/code&gt; comes close to what I need when jumping to tags.
The only thing missing now is that the selected candidate is always on the first line,
even when I press &lt;kbd&gt;C-n&lt;/kbd&gt;, which isn&amp;#39;t very intuitive.&lt;/p&gt;

&lt;h2 id=&quot;stuff-related-to-lispy-release&quot;&gt;Stuff related to &lt;code&gt;lispy&lt;/code&gt; release&lt;/h2&gt;

&lt;h3 id=&quot;other-completion-methods-available-in-lispy-goto&quot;&gt;Other completion methods available in &lt;code&gt;lispy-goto&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Depending on the modes you have enabled, you can complete with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;helm&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ido&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ido-vertical-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;icomplete-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;icy-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;no mode, just plain completion&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;lispy-eval-other-window-now-uses-ace-window&quot;&gt;&lt;code&gt;lispy-eval-other-window&lt;/code&gt; now uses &lt;code&gt;ace-window&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This function bound to &lt;kbd&gt;p&lt;/kbd&gt; is very convenient for debugging
Elisp: it allows you to eval the current sexp in the context of other
window. This is very powerful: you can run and debug your function as
you write it, statement by statement. Previously, this setup was
viable only in a two-window split, because using &lt;code&gt;other-window&lt;/code&gt;, it
wasn&amp;#39;t predictable in which window the eval would take place.  Now, if
there are more than two windows, &lt;code&gt;aw-select&lt;/code&gt; will select the window
for the eval.  This selection will be remembered, so you don&amp;#39;t have to
select for the following evals, unless the window configuration
changes.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;There are more changes that you can find in
&lt;a href=&quot;https://github.com/abo-abo/lispy/releases/tag/0.23.0&quot;&gt;the release notes&lt;/a&gt;
if you&amp;#39;re interested. You can find the new &lt;code&gt;ido-vertical&lt;/code&gt; stuff in
&lt;a href=&quot;https://github.com/abo-abo/ido-vertical-mode.el&quot;&gt;my fork&lt;/a&gt;, until it
gets merged.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hydra 0.9.0 is out</title>
   <link href="https://oremacs.com/2015/02/08/hydra-0.9.0/"/>
   <updated>2015-02-08T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/08/hydra-0.9.0</id>
   <content type="html">&lt;p&gt;I&amp;#39;ll just list the new features from the &lt;a href=&quot;https://github.com/abo-abo/hydra/releases/tag/0.9.0&quot;&gt;release notes&lt;/a&gt; here.&lt;/p&gt;

&lt;h2 id=&quot;keyboard-quit&quot;&gt;Keyboard quit&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;hydra-keyboard-quit&lt;/code&gt; set to &lt;code&gt;&amp;quot;C-g&amp;quot;&lt;/code&gt; means that it&amp;#39;s possible to quit an amaranth Hydra
with &lt;kbd&gt;C-g&lt;/kbd&gt;. You can customize this variable.&lt;/p&gt;

&lt;h2 id=&quot;pre-and-post-refinement&quot;&gt;&lt;code&gt;:pre&lt;/code&gt; and &lt;code&gt;:post&lt;/code&gt; refinement&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;:post&lt;/code&gt; and &lt;code&gt;:pre&lt;/code&gt; keys in the body &lt;code&gt;PLIST&lt;/code&gt; can be either a single
sexp or a function name. The function doesn&amp;#39;t need to be interactive.&lt;/p&gt;

&lt;h2 id=&quot;support-for-local-hydra-heads-via-bind-property&quot;&gt;Support for local Hydra heads via &lt;code&gt;:bind&lt;/code&gt; property&lt;/h2&gt;

&lt;p&gt;Example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-next-error&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-x&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;next-error&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;`&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;next&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;next&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:bind&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;previous&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:bind&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;binds &lt;kbd&gt;C-x &amp;#96;&lt;/kbd&gt; to &lt;code&gt;next-error&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;does not bind &lt;kbd&gt;C-x j&lt;/kbd&gt; and &lt;kbd&gt;C-x k&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;you can still do &lt;kbd&gt;C-x &amp;#96;jjkk&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks, &lt;a href=&quot;https://github.com/ffevotte&quot;&gt;@ffevotte&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;support-for-bind-property-in-hydra-body&quot;&gt;Support for &lt;code&gt;:bind&lt;/code&gt; property in Hydra body&lt;/h2&gt;

&lt;p&gt;The body, like the heads will recognize the &lt;code&gt;:bind&lt;/code&gt; property in &lt;code&gt;PLIST&lt;/code&gt;.
The heads will inherit it, just like they do with &lt;code&gt;:color&lt;/code&gt;.
The &lt;code&gt;:bind&lt;/code&gt; property can be nil or a lambda of &lt;code&gt;global-set-key&lt;/code&gt; format.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-goto&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-g&amp;quot;&lt;/span&gt;
                      &lt;span class=&quot;nb&quot;&gt;:bind&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bind-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;goto-line&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;goto-line&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:bind&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;goto-char&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;bind-key&lt;/code&gt; will be used to bind &lt;code&gt;goto-char&lt;/code&gt; to &lt;kbd&gt;M-g c&lt;/kbd&gt;,
since &lt;kbd&gt;c&lt;/kbd&gt; head has inherited body&amp;#39;s &lt;code&gt;:bind&lt;/code&gt; property. Note
that since &lt;code&gt;bind-key&lt;/code&gt; is a macro, it was necessary to wrap it in a
lambda.&lt;/p&gt;

&lt;p&gt;However, &lt;code&gt;global-set-key&lt;/code&gt; will be used to bind &lt;code&gt;goto-line&lt;/code&gt; to &lt;kbd&gt;M-g g&lt;/kbd&gt;, this &lt;code&gt;:bind&lt;/code&gt; property
was overridden in the &lt;kbd&gt;g&lt;/kbd&gt; head.&lt;/p&gt;

&lt;p&gt;Since this commit, it&amp;#39;s not possible to pass a lambda instead of the
whole &lt;code&gt;BODY&lt;/code&gt; argument, as was advertised before. Just put it on
&lt;code&gt;:bind&lt;/code&gt; now.&lt;/p&gt;

&lt;h2 id=&quot;hydra-body-will-pass-the-initial-current-prefix-arg-along&quot;&gt;&lt;code&gt;hydra/body&lt;/code&gt; will pass the initial &lt;code&gt;current-prefix-arg&lt;/code&gt; along&lt;/h2&gt;

&lt;p&gt;Example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;vi&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now, &lt;kbd&gt;C-u C-z l&lt;/kbd&gt; will result in &lt;code&gt;(forward-char 4)&lt;/code&gt;. All the other &lt;kbd&gt;l&lt;/kbd&gt;
will normally call &lt;code&gt;(forward-char 1)&lt;/code&gt;, unless an additional prefix is given.  The previous
behavior allowed only for &lt;kbd&gt;C-z C-u l&lt;/kbd&gt; to get &lt;code&gt;(forward-char 4)&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;allow-a-sexp-as-heads-cmd-parameter&quot;&gt;Allow a sexp as head&amp;#39;s CMD parameter&lt;/h2&gt;

&lt;p&gt;Example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-launcher&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;Launch&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;man&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;man&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;browse-url&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;http://www.reddit.com/r/emacs/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;reddit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;browse-url&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;http://www.emacswiki.org/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;emacswiki&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;shell&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;shell&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c r&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-launcher/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;kbd&gt;r&lt;/kbd&gt; and &lt;kbd&gt;w&lt;/kbd&gt; heads are using this feature.
Here&amp;#39;s what will be generated, if you&amp;#39;re interested:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-launcher/lambda-w&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Create a hydra with no body and the heads:&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;\&amp;quot;h\&amp;quot;:    &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`man&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;\&amp;quot;r\&amp;quot;:    `(browse-url \&amp;quot;http://www.reddit.com/r/emacs/\&amp;quot;)&amp;#39;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;\&amp;quot;w\&amp;quot;:    `(browse-url \&amp;quot;http://www.emacswiki.org/\&amp;quot;)&amp;#39;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;\&amp;quot;s\&amp;quot;:    &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`shell&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;\&amp;quot;q\&amp;quot;:    &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`nil&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;The body can be accessed via &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`hydra-launcher/body&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;Call the head: `(browse-url \&amp;quot;http://www.emacswiki.org/\&amp;quot;)&amp;#39;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-disable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;quote&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-disable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call-interactively&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;browse-url&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;http://www.emacswiki.org/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;obsolete-declarations&quot;&gt;Obsolete declarations&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;hydra-create&lt;/code&gt; and all old examples in hydra-examples.el are now obsolete.
You can still use them for a short while, but they will be removed soon.&lt;/p&gt;

&lt;p&gt;You should take the time to switch from &lt;code&gt;hydra-create&lt;/code&gt; to &lt;code&gt;defhydra&lt;/code&gt;. All the old examples
are provided in the new style in hydra-examples.el. However, they will not be evaluated
through &lt;code&gt;(require &amp;#39;hydra-examples)&lt;/code&gt; unless you &lt;code&gt;(setq hydra-examples-verbatim t)&lt;/code&gt;
beforehand.  This is because I have no idea what kind of bindings will work for you, you
should decide yourself.  But I am providing you with a template. The number of examples
has also grown to six.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>A new Hydra demo on Youtube</title>
   <link href="https://oremacs.com/2015/02/07/hydra-on-youtubes/"/>
   <updated>2015-02-07T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/07/hydra-on-youtubes</id>
   <content type="html">&lt;p&gt;This will be a short post sharing two pieces of information.&lt;/p&gt;

&lt;h2 id=&quot;a-hydra-demo-is-on-youtube&quot;&gt;A Hydra demo is on Youtube&lt;/h2&gt;

&lt;p&gt;Here is the &lt;a href=&quot;https://www.youtube.com/watch?v=_qZliI1BKzI&quot;&gt;link&lt;/a&gt;, and here is the current window-switching code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-window&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;amaranth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;window&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-up&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;split-window-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;windmove-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;vert&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;x&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;split-window-below&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;windmove-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;horz&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;transpose-frame&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;#39;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;delete-other-windows&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;one&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ace&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-swap-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;swap&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-delete-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;del&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-maximize-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ace-one&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-switch-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;buf&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;headlong-bookmark-jump&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;bmk&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;ace-window-0-7-0-is-out&quot;&gt;&lt;code&gt;ace-window 0.7.0&lt;/code&gt; is out&lt;/h2&gt;

&lt;p&gt;You can see the release notes &lt;a href=&quot;https://github.com/abo-abo/ace-window/releases/tag/0.7.0&quot;&gt;here&lt;/a&gt;.
There&amp;#39;s not a whole lot of user-visible changes, but a large portion of the code was re-written
to facilitate the use of the API. I hope that no new bugs were introduced with this change,
you can still fall back to &lt;a href=&quot;https://github.com/abo-abo/ace-window/releases/tag/0.6.1&quot;&gt;0.6.1&lt;/a&gt; and send
me &lt;a href=&quot;https://github.com/abo-abo/ace-window/issues&quot;&gt;an issue&lt;/a&gt; if something broke. There&amp;#39;s a benefit
in the long run, just see how simple the code has become:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-maximize-window&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Ace maximize window.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;select-window&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aw-select&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; Ace - Maximize Window&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;delete-other-windows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;aw-select&lt;/code&gt; just returns a selected window, and nothing else. Very easy to use.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>The Elisp Synergy</title>
   <link href="https://oremacs.com/2015/02/06/the-synergy/"/>
   <updated>2015-02-06T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/06/the-synergy</id>
   <content type="html">&lt;p&gt;After having written &lt;a href=&quot;https://github.com/abo-abo?tab=repositories&quot;&gt;a few Emacs packages&lt;/a&gt;, it happens
sometimes when I&amp;#39;m reading questions on &lt;a href=&quot;http://emacs.stackexchange.com/questions&quot;&gt;Emacs Stack Exchange&lt;/a&gt;,
I think to myself that either:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I&amp;#39;ve done this before in package X&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;or:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This feature would fit nicely in package Y&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;On very rare occasions it happens that a question matches two packages at once.
Here is such a &lt;a href=&quot;http://emacs.stackexchange.com/questions/8006/&quot;&gt;question&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;h3 id=&quot;is-there-a-yasnippet-producing-a-prepopulated-doxygen-comment&quot;&gt;Is there a yasnippet producing a prepopulated doxygen comment?&lt;/h3&gt;

&lt;p&gt;For the following C++ function:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;bool importantStuff(double a, double b);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It should output the following snippet, perhaps without the tags:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;/**
* &amp;lt;Insert description of importantStuff&amp;gt;
*
* @param a &amp;lt;Insert description of a&amp;gt;
* @param b &amp;lt;Insert description of b&amp;gt;
* @return &amp;lt;Insert description of the return value&amp;gt;
*/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;

&lt;p&gt;Well, I&amp;#39;ve got a package called &lt;a href=&quot;https://github.com/abo-abo/function-args&quot;&gt;function-args&lt;/a&gt;
for C++ that uses CEDET to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;display tool-tips with function arguments&lt;/li&gt;
&lt;li&gt;jump to a semantic tag in current file&lt;/li&gt;
&lt;li&gt;do a bit of completion&lt;/li&gt;
&lt;li&gt;do a bit of generation (like inherited function signatures)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the expansion part can be handled by &lt;a href=&quot;https://github.com/abo-abo/auto-yasnippet&quot;&gt;auto-yasnippet&lt;/a&gt;, which
I&amp;#39;ve covered in &lt;a href=&quot;/2015/01/30/auto-yasnippet/&quot;&gt;an earlier post&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-code&quot;&gt;The code&lt;/h2&gt;

&lt;p&gt;I think it might be useful to look at the code, since it&amp;#39;s small and shows how to use &lt;code&gt;CEDET&lt;/code&gt;&amp;#39;s and
&lt;code&gt;auto-yasnippet&lt;/code&gt;&amp;#39;s API:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;moo-doxygen&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Generate a doxygen yasnippet and expand it with &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`aya-expand&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;The point should be on the top-level function name.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;move-beginning-of-line&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tag&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;semantic-current-tag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;semantic-tag-of-class-p&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tag&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Expected function, got %S&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;semantic-tag-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;attrs&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;semantic-tag-attributes&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;args&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;plist-get&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;attrs&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:arguments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ord&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aya-current&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;
             &lt;span class=&quot;s&quot;&gt;&amp;quot;/**&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;* $1&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;%s&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;* @return $%d&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;*/&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapconcat&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;* @param %s $%d&amp;quot;&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;incf&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ord&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
              &lt;span class=&quot;nv&quot;&gt;args&lt;/span&gt;
              &lt;span class=&quot;s&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;incf&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ord&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aya-expand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;the-bonus&quot;&gt;The bonus&lt;/h2&gt;

&lt;p&gt;If you&amp;#39;re interested in &lt;a href=&quot;http://www.doxygen.org/&quot;&gt;Doxygen&lt;/a&gt;, here&amp;#39;s a
bit of code that I found laying around. It will prettify
e.g. &lt;code&gt;&amp;lt;tt&amp;gt;Numerical Recipies&amp;lt;/tt&amp;gt;&lt;/code&gt; to &lt;font color=&quot;#8b4513&quot;&gt;Numerical
Recipies&lt;/font&gt; in the comments.
This code uses a similar approach to the one used in my posts
about &lt;a href=&quot;/2015/01/11/pretty-elisp-regex/&quot;&gt;prettifying Elisp regex&lt;/a&gt;,
and &lt;a href=&quot;/2015/01/23/eltex/&quot;&gt;ElTeX&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defface&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;font-lock-doxygen-face&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:foreground&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;SaddleBrown&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:background&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#f7f7f7&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;Special face to highlight doxygen tags such as &amp;lt;tt&amp;gt;...&amp;lt;/tt&amp;gt;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;and &amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt;.&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;:group&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;font-lock-highlighting-faces&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;font-lock-add-keywords&lt;/span&gt;
 &lt;span class=&quot;ss&quot;&gt;&amp;#39;c++-mode&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\(&amp;lt;\\(?:code\\|tt\\)&amp;gt;\&amp;quot;?\\)\\([^&amp;lt;]*?\\)\\(\&amp;quot;?&amp;lt;/\\(?:code\\|tt\\)&amp;gt;\\)&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;prog1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string-no-properties&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;expr-len&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr-len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;compose-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-beginning&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-end&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;aref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;compose-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-beginning&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-end&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;aref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;compose-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-beginning&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-end&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;aref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expr-len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;font-lock-doxygen-face&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that the code listed here will be useful to someone other than
me. It&amp;#39;s a nice highlight of how a language can be made &lt;em&gt;much&lt;/em&gt; cooler
by just having a package manager that allows to quickly glue various
things together.  I mean, what would happen to JavaScript without npm
(besides stopping people requiring Angular just to use arrays)?&lt;/p&gt;

&lt;p&gt;C++, on the other hand, is too cool to care about such things as
package managers and modules and stuff.  But we&amp;#39;re stuck with it for
performance reasons, so might as well try to make the experience more
bearable by adding some niceties to &lt;code&gt;c++-mode&lt;/code&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Introducing amaranth Hydras</title>
   <link href="https://oremacs.com/2015/02/05/amaranth-hydra/"/>
   <updated>2015-02-05T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/05/amaranth-hydra</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;An &lt;font color=&quot;#e52b50&quot;&gt;amaranth&lt;/font&gt; planted in a garden near a &lt;font color=&quot;#FF007F&quot;&gt;Rose-Tree&lt;/font&gt;, thus addressed it:
&amp;quot;What a lovely flower is the &lt;font color=&quot;#FF007F&quot;&gt;Rose&lt;/font&gt;, a favorite alike with Gods and
with men. I envy you your beauty and your perfume.&amp;quot; The &lt;font color=&quot;#FF007F&quot;&gt;Rose&lt;/font&gt;
replied, &amp;quot;I indeed, dear &lt;font color=&quot;#e52b50&quot;&gt;Amaranth&lt;/font&gt;, flourish but for a brief season!
If no cruel hand pluck me from my stem, yet I must perish by an
early doom. But thou art immortal and dost never fade, but bloomest
for ever in renewed youth.&amp;quot;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Prompted by the &lt;a href=&quot;https://github.com/abo-abo/hydra/issues/17&quot;&gt;&amp;quot;Avoid exiting the hydra on hitting a wrong key&amp;quot;&lt;/a&gt; issue,
I decided to add a new body color for Hydra. Turns out that there exists a color that represents
immortality, and it&amp;#39;s called &lt;font color=&quot;#e52b50&quot;&gt;amaranth&lt;/font&gt;. It&amp;#39;s also very pretty.&lt;/p&gt;

&lt;p&gt;So what &lt;font color=&quot;#e52b50&quot;&gt;amaranth&lt;/font&gt; Hydras do basically, is make it impossible to quit them.
Of course, it would be totally lame if there wasn&amp;#39;t at least one way to quit them.
And what better to utilize for this purpose,
than the good-old quitters - the &lt;font color=&quot;#2A00FF&quot;&gt;blue&lt;/font&gt; Hydra heads.&lt;/p&gt;

&lt;h2 id=&quot;an-example-code&quot;&gt;An Example code&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:pre&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;set-cursor-color&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#e52b50&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;:post&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;set-cursor-color&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#ffffff&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;amaranth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;vi&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;set-mark-command&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;mark&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;move-beginning-of-line&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;beg&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;move-end-of-line&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;end&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;delete-region&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;del&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;y&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;kill-ring-save&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;yank&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This Hydra has only three exit points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;q&lt;/kbd&gt;, which does nothing&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;y&lt;/kbd&gt;, which copies the active region&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;d&lt;/kbd&gt;, which deletes the active region&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition to the usual arrows on &lt;kbd&gt;hjkl&lt;/kbd&gt;, &lt;kbd&gt;a&lt;/kbd&gt; and
&lt;kbd&gt;e&lt;/kbd&gt; move to beginning and end of line respectively.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you like the new idea, also thanks to
&lt;a href=&quot;https://github.com/vkazanov&quot;&gt;@vkazanov&lt;/a&gt; for the push in this
direction. Things should be backwards-compatible, so this feature
costs you nothing if you&amp;#39;re not using it. See the release notes for &lt;a href=&quot;https://github.com/abo-abo/hydra/releases/tag/0.8.0&quot;&gt;0.8.0&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One more thanks goes to Sridhar Ratnakumar for &lt;a href=&quot;http://oremacs.com/2015/01/30/auto-yasnippet/#comment-1833552123&quot;&gt;this suggestion&lt;/a&gt;
that lead to an improvement in &lt;a href=&quot;https://github.com/abo-abo/auto-yasnippet&quot;&gt;auto-yasnippet&lt;/a&gt;. Thanks to this improvement,
I was able to quickly wrap words like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;&amp;lt;font color=&amp;quot;#FF007F&amp;quot;&amp;gt;Rose&amp;lt;/font&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>New in Hydra - :pre and :post clauses</title>
   <link href="https://oremacs.com/2015/02/04/pre-hydra-post/"/>
   <updated>2015-02-04T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/04/pre-hydra-post</id>
   <content type="html">&lt;p&gt;Only three commits happened since &lt;code&gt;0.6.1&lt;/code&gt;, but already &lt;a href=&quot;https://github.com/abo-abo/hydra/releases/tag/0.7.0&quot;&gt;0.7.0&lt;/a&gt; has to
be released, since the behavior has changed slightly.&lt;/p&gt;

&lt;h2 id=&quot;the-ultimate-window-switching-setup-revised&quot;&gt;The ultimate window switching setup, revised&lt;/h2&gt;

&lt;p&gt;The code from the &lt;a href=&quot;/2015/02/03/one-hydra-two-hydra/&quot;&gt;last post&lt;/a&gt; had to be changed.
Note that only &lt;code&gt;ace-window&lt;/code&gt;-related heads are affected, since &lt;code&gt;ace-window&lt;/code&gt; uses &lt;code&gt;set-transient-map&lt;/code&gt; as well.
This was necessary to fix &lt;a href=&quot;https://github.com/abo-abo/hydra/issues/15&quot;&gt;issue #15&lt;/a&gt; (unable to use &lt;code&gt;goto-line&lt;/code&gt; in a Hydra, since it requires input).&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-window&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;window&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-up&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-window-end-once-hook&lt;/span&gt;
                    &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-window/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-disable&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;ace&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;split-window-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;windmove-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;vert&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;x&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;split-window-below&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;windmove-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;horz&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-window-end-once-hook&lt;/span&gt;
                    &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-window/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-disable&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;swap&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;transpose-frame&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;#39;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-window-end-once-hook&lt;/span&gt;
                    &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-window/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-disable&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;del&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;delete-other-windows&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;one&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-maximize-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ace-one&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can also see an awesome addition sneak in, with &lt;code&gt;transpose-frame&lt;/code&gt;
on &lt;kbd&gt;t&lt;/kbd&gt;.&lt;/p&gt;

&lt;h3 id=&quot;technical-note&quot;&gt;Technical note&lt;/h3&gt;

&lt;p&gt;If you look closely at the code, you&amp;#39;ll see the &lt;code&gt;ace-window&lt;/code&gt;-related
lambdas throwing the &lt;code&gt;hydra-disable&lt;/code&gt; symbol. If the Hydra code catches
that symbol, it will not call &lt;code&gt;set-transient-map&lt;/code&gt; again, effectively
making the head that threw the symbol blue.  In this example, though,
&lt;code&gt;ace-window&lt;/code&gt;-related functions are still red, since the Hydra is
resumed by calling &lt;code&gt;hydra-window/body&lt;/code&gt; in &lt;code&gt;ace-window-end-once-hook&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is a trick that I have to play because of how &lt;code&gt;ace-jump-mode&lt;/code&gt;
works.  Hopefully, it won&amp;#39;t be needed for other commands. But still,
it&amp;#39;s a simple trick that you can use if you want to have a head quit
conditionally, or something.&lt;/p&gt;

&lt;h2 id=&quot;goto-line-ad-infinum&quot;&gt;&lt;code&gt;goto-line&lt;/code&gt; ad infinum&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-test&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-g&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;goto-line&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;goto-line&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With the Hydra above, it&amp;#39;s possible to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-g g&lt;/kbd&gt; &lt;code&gt;10&lt;/code&gt; &lt;kbd&gt;RET&lt;/kbd&gt; to go to line &lt;code&gt;10&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;g&lt;/kbd&gt; &lt;code&gt;20&lt;/code&gt; &lt;kbd&gt;RET&lt;/kbd&gt; to go to line &lt;code&gt;20&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;g&lt;/kbd&gt; &lt;code&gt;50&lt;/code&gt; &lt;kbd&gt;RET&lt;/kbd&gt; to go to line &lt;code&gt;50&lt;/code&gt; etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;change-the-cursor-color-when-a-hydra-is-active&quot;&gt;Change the cursor color when a Hydra is active&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s how the new &lt;code&gt;:pre&lt;/code&gt; and &lt;code&gt;:post&lt;/code&gt; statements work:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:pre&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;set-cursor-color&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#40e0d0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;:post&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;set-cursor-color&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#ffffff&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;vi&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this example, the cursor color will change for the duration of the Hydra.
Both &lt;code&gt;:pre&lt;/code&gt; and &lt;code&gt;:post&lt;/code&gt; should match to a single Elisp statement; you can use &lt;code&gt;progn&lt;/code&gt; to tie
a bunch of statements together if you want.&lt;/p&gt;

&lt;h2 id=&quot;a-more-evil-helm&quot;&gt;A more evil &lt;code&gt;helm&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Lit Wakefield has a nice &lt;a href=&quot;http://angelic-sedition.github.io/blog/2015/02/03/a-more-evil-helm/&quot;&gt;article&lt;/a&gt; on
using &lt;code&gt;hydra&lt;/code&gt; and &lt;code&gt;helm&lt;/code&gt; together. Do check it out, I&amp;#39;ll certainly steal some of his code.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you don&amp;#39;t have an objection to Hydra being developed at a
fast pace with many features popping up. I try my best to keep things
backwards compatible, but I really want to quickly fix the areas where
the code is lacking. Thanks to all the people contributing
&lt;a href=&quot;https://github.com/abo-abo/hydra/issues&quot;&gt;issues&lt;/a&gt;, especially
&lt;a href=&quot;https://github.com/atykhonov&quot;&gt;@atykhonov&lt;/a&gt; and
&lt;a href=&quot;https://github.com/nandryshak&quot;&gt;@nandryshak&lt;/a&gt; for the last two, which are the core
of this version bump.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>One Hydra Two Hydra Red Hydra Blue Hydra</title>
   <link href="https://oremacs.com/2015/02/03/one-hydra-two-hydra/"/>
   <updated>2015-02-03T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/03/one-hydra-two-hydra</id>
   <content type="html">&lt;p&gt;Hydra evolution picks up the pace with
&lt;a href=&quot;https://github.com/abo-abo/hydra/releases/tag/0.6.1&quot;&gt;hydra 0.6.1&lt;/a&gt;.
This version adds prefix arguments to all Hydras.&lt;/p&gt;

&lt;h2 id=&quot;some-examples&quot;&gt;Some Examples&lt;/h2&gt;

&lt;h3 id=&quot;look-ma-no-modifiers&quot;&gt;Look ma, no modifiers!&lt;/h3&gt;

&lt;p&gt;Now it&amp;#39;s possible to write this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-vi&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;vi&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;forward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And now &lt;kbd&gt;C-z 5j7l&lt;/kbd&gt; will move 5 lines down and 7 characters
left, still with the option to press &lt;kbd&gt;h&lt;/kbd&gt;, &lt;kbd&gt;j&lt;/kbd&gt;,
&lt;kbd&gt;k&lt;/kbd&gt;, &lt;kbd&gt;l&lt;/kbd&gt; some more.&lt;/p&gt;

&lt;p&gt;Additionally &lt;kbd&gt;C-z C-u C-u C-u k&lt;/kbd&gt; will move 64 lines up, since &lt;kbd&gt;C-u&lt;/kbd&gt; multiplies its
argument by 4 each time.&lt;/p&gt;

&lt;h3 id=&quot;the-good-old-zoom&quot;&gt;The good-old zoom&lt;/h3&gt;

&lt;p&gt;If you remember, this was the original Hydra:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-zoom&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f2&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;zoom&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-increase&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;in&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-decrease&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;out&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now, &lt;kbd&gt;&amp;lt;f2&amp;gt; g 4g 2l&lt;/kbd&gt; will zoom in 5 times, and zoom out 2
times for a total of +3 zoom.&lt;/p&gt;

&lt;h3 id=&quot;the-good-old-move-splitter&quot;&gt;The good-old move-splitter&lt;/h3&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-splitter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;splitter&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-up&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This Hydra can benefit from numeric arguments as well: &lt;kbd&gt;C-M-s l
40l&lt;/kbd&gt; will quickly make the right window a lot smaller.&lt;/p&gt;

&lt;p&gt;If I wanted to type &lt;kbd&gt;C-M-s 40 l&lt;/kbd&gt;, I would have to use this definition instead:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-s&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-splitter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;splitter&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-up&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For that case, I would get the hint immediately after &lt;kbd&gt;C-M-s&lt;/kbd&gt; and would be able to give the numeric argument immediately,
but I wouldn&amp;#39;t be able to bind anything else on &lt;kbd&gt;C-M-s&lt;/kbd&gt; as a prefix, e.g.:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-s z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;recenter-top-bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The code above would give the error &lt;code&gt;&amp;quot;Key sequence C-M-s z starts with non-prefix key C-M-s&amp;quot;&lt;/code&gt;.
So you can pick the method that you prefer, the choice is there.&lt;/p&gt;

&lt;h2 id=&quot;the-ultimate-window-switching-setup&quot;&gt;The ultimate window switching setup&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-window&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;window&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-up&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-window-end-once-hook&lt;/span&gt;
                    &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-window/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;ace&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;split-window-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;windmove-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;vert&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;x&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;split-window-below&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;windmove-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;horz&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-window-end-once-hook&lt;/span&gt;
                    &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-window/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;swap&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-window-end-once-hook&lt;/span&gt;
                    &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-window/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;del&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;delete-other-windows&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-maximize-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;a1&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The credit for this monster goes to &lt;a href=&quot;https://github.com/bcarrell&quot;&gt;bcarell&lt;/a&gt;, I just refined his approach
with making &lt;code&gt;ace-window&lt;/code&gt; not quit the &lt;code&gt;hydra-window&lt;/code&gt; Hydra.
This setup needs the latest &lt;a href=&quot;https://github.com/abo-abo/ace-window&quot;&gt;ace-window&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the result of &lt;kbd&gt;C-M-o xvxv&lt;/kbd&gt; starting from a single window:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/hydra-window.png&quot; alt=&quot;hydra-window&quot;&gt;&lt;/p&gt;

&lt;p&gt;From here, I can quickly maximize the current window with &lt;kbd&gt;o&lt;/kbd&gt;
while simultaneously quitting the Hydra; &lt;kbd&gt;i&lt;/kbd&gt; will maximize a
window as well, but it will select it with &lt;code&gt;ace-window&lt;/code&gt;, instead of
maximizing the current one.&lt;/p&gt;

&lt;p&gt;Note that, since numerical arguments are working now, &lt;kbd&gt;4a&lt;/kbd&gt; is
the same as &lt;kbd&gt;s&lt;/kbd&gt; (swap) and &lt;kbd&gt;16a&lt;/kbd&gt; or &lt;kbd&gt;C-u C-u
a&lt;/kbd&gt; is the same as &lt;kbd&gt;d&lt;/kbd&gt; (delete).&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Colorful Hydras</title>
   <link href="https://oremacs.com/2015/02/02/colorful-hydrae/"/>
   <updated>2015-02-02T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/02/colorful-hydrae</id>
   <content type="html">&lt;p&gt;This post advertises the release of &lt;a href=&quot;https://github.com/abo-abo/hydra/releases/tag/0.5.0&quot;&gt;hydra.el 0.5.0&lt;/a&gt;.
The package was introduced in &lt;a href=&quot;/2015/01/20/introducing-hydra/&quot;&gt;an earlier post&lt;/a&gt; and received some positive feedback.
Currently, it&amp;#39;s available in both
&lt;a href=&quot;https://elpa.gnu.org/packages/hydra.html&quot;&gt;GNU ELPA&lt;/a&gt; (slightly behind)
and &lt;a href=&quot;http://melpa.org/#/hydra&quot;&gt;MELPA&lt;/a&gt; (always current).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/Hydra-color.png&quot; alt=&quot;colorful-hydra&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-newfound-utility&quot;&gt;The newfound utility&lt;/h2&gt;

&lt;p&gt;As I originally released the Hydra, I was asked if it was similar to
&lt;a href=&quot;http://endlessparentheses.com/the-toggle-map-and-wizardry.html&quot;&gt;this approach&lt;/a&gt;
described on &lt;a href=&quot;http://endlessparentheses.com/&quot;&gt;Endless Parentheses&lt;/a&gt;. I
said that it&amp;#39;s not, since Hydra commands are meant to be repeatable
instead of being called just once.&lt;/p&gt;

&lt;p&gt;Now, after I&amp;#39;ve designated the repeatable heads with red color and the one-off heads with blue color,
Hydra can reproduce the mentioned approach. Here&amp;#39;s how it looks like:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c C-v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-toggle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;toggle&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;abbrev-mode&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;abbrev&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;toggle-debug-on-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;debug&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;auto-fill-mode&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;fill&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;toggle-truncate-lines&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;truncate&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;whitespace-mode&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;whitespace&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And this is what I see in the echo area after pressing &lt;kbd&gt;C-c C-v&lt;/kbd&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/Hydra-toggle.png&quot; alt=&quot;hydra-toggle&quot;&gt;&lt;/p&gt;

&lt;p&gt;At this point:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;q&lt;/kbd&gt; will cancel without doing anything. I think it&amp;#39;s more
convenient than doing the equivalent &lt;kbd&gt;C-g&lt;/kbd&gt; with the
&lt;code&gt;global-set-key&lt;/code&gt; approach.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;a&lt;/kbd&gt;, &lt;kbd&gt;d&lt;/kbd&gt;, &lt;kbd&gt;f&lt;/kbd&gt;, &lt;kbd&gt;t&lt;/kbd&gt;, and &lt;kbd&gt;a&lt;/kbd&gt; will call the appropriate function.
The advantage of blue Hydra heads over &lt;code&gt;global-set-key&lt;/code&gt; is that you immediately get the hint: this can be useful
for rarely used commands.&lt;/li&gt;
&lt;li&gt;as with the old red Hydra heads, pressing anything other than
&lt;kbd&gt;a&lt;/kbd&gt;, &lt;kbd&gt;d&lt;/kbd&gt;, &lt;kbd&gt;f&lt;/kbd&gt;, &lt;kbd&gt;t&lt;/kbd&gt;, &lt;kbd&gt;a&lt;/kbd&gt;,
or &lt;kbd&gt;q&lt;/kbd&gt; will vanquish the Hydra &lt;em&gt;and&lt;/em&gt; call the key binding
that you just pressed. This is different from the &lt;code&gt;global-set-key&lt;/code&gt;
approach, which would e.g. error to your &lt;kbd&gt;C-c C-v C-n&lt;/kbd&gt; with
&lt;code&gt;&amp;quot;C-c C-v C-n is undefined&amp;quot;&lt;/code&gt;, unlike the Hydra, which would call &lt;kbd&gt;C-n&lt;/kbd&gt;
(&lt;code&gt;next-line&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;the-full-defhydra-syntax&quot;&gt;The full &lt;code&gt;defhydra&lt;/code&gt; syntax&lt;/h2&gt;

&lt;p&gt;Note that &lt;code&gt;defhydra&lt;/code&gt; looks intentionally like a &lt;code&gt;defun&lt;/code&gt;, so that it&amp;#39;s
easier to remember how it works.
Here&amp;#39;s a more verbose Hydra that&amp;#39;s largely equivalent to the one above:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-toggle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;toggle&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;abbrev-mode&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;abbrev&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;toggle-debug-on-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;debug&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;auto-fill-mode&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;fill&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;toggle-truncate-lines&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;truncate&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;whitespace-mode&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;whitespace&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;recenter-top-bottom&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;recenter&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c C-v&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-toggle/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;first-argument-hydra-name&quot;&gt;First argument: Hydra name&lt;/h3&gt;

&lt;p&gt;This argument decides the prefix to all the functions that will be generated.
In this case the following functions will be generated:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-toggle/abbrev-mode&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;hydra-toggle/toggle-debug-on-error&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;hydra-toggle/auto-fill-mode&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;hydra-toggle/toggle-truncate-lines&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;hydra-toggle/whitespace-mode&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;hydra-toggle/recenter-top-bottom&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;hydra-toggle/nil&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;hydra-toggle/body&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The final function calls the Hydra&amp;#39;s body, displaying the hint in the echo area and setting
the transient map. It&amp;#39;s the return result of &lt;code&gt;defhydra&lt;/code&gt;, that&amp;#39;s why it was possible to pass it
to &lt;code&gt;global-set-key&lt;/code&gt; in the first example.&lt;/p&gt;

&lt;h3 id=&quot;second-argument-hydra-body&quot;&gt;Second argument: Hydra body&lt;/h3&gt;

&lt;p&gt;The Hydra body consists of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a map used for binding, like &lt;code&gt;global-map&lt;/code&gt; or &lt;code&gt;c++-mode-map&lt;/code&gt; or &lt;code&gt;projectile-mode-map&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;the body prefix: it&amp;#39;s a string passable to &lt;code&gt;kbd&lt;/code&gt; that will be used
in conjunction with heads&amp;#39; prefixes to bind the functions&lt;/li&gt;
&lt;li&gt;an optional plist, which currently recognizes only the &lt;code&gt;:color&lt;/code&gt; key,
which in turn can be either red (the old behavior) or blue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It&amp;#39;s possible to omit the map and the body prefix simultaneously (it
doesn&amp;#39;t make sense to omit one but not the other), or just pass &lt;code&gt;()&lt;/code&gt;
if you want to get a red Hydra body that you can bind yourself.&lt;/p&gt;

&lt;h3 id=&quot;third-argument-hydra-hint&quot;&gt;Third argument: Hydra hint&lt;/h3&gt;

&lt;p&gt;This string will be used in the echo area to distinguish the current
Hydra. This is optional, it case you don&amp;#39;t provide it, it will default
to &lt;code&gt;&amp;quot;hydra&amp;quot;&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;fourth-argument-hydra-heads&quot;&gt;Fourth argument: Hydra heads&lt;/h3&gt;

&lt;p&gt;Each Hydra head is a list of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the key extension&lt;/li&gt;
&lt;li&gt;the function&lt;/li&gt;
&lt;li&gt;optional hint&lt;/li&gt;
&lt;li&gt;optional plist.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Again, the plist recognizes only &lt;code&gt;:color&lt;/code&gt; currently. The color is inherited from the body, if
you don&amp;#39;t specify it. In turn, the body color is red if you don&amp;#39;t specify it.&lt;/p&gt;

&lt;p&gt;The code above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;binds &lt;kbd&gt;C-c a&lt;/kbd&gt;, &lt;kbd&gt;C-c d&lt;/kbd&gt; etc with the usual &lt;code&gt;global-set-key&lt;/code&gt; approach.&lt;/li&gt;
&lt;li&gt;binds &lt;kbd&gt;C-c C-v a&lt;/kbd&gt;, &lt;kbd&gt;C-c C-v d&lt;/kbd&gt; with the new
approach, which shows you the hint right after &lt;kbd&gt;C-c C-v&lt;/kbd&gt; and
allows you to cancel easier.&lt;/li&gt;
&lt;li&gt;binds &lt;kbd&gt;C-c v&lt;/kbd&gt; to be repeatable, i.e. you can press &lt;kbd&gt;C-c v v v&lt;/kbd&gt;. Same with &lt;kbd&gt;C-c C-v v v v&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;some-more-ideas-for-blue-hydras&quot;&gt;Some more ideas for blue Hydras&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s one for some &lt;code&gt;helm&lt;/code&gt;-related functions, don&amp;#39;t ask how
&lt;code&gt;projectile-find-file&lt;/code&gt; ended up here:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt;
 &lt;span class=&quot;s&quot;&gt;&amp;quot;κ&amp;quot;&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-helm&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;s&quot;&gt;&amp;quot;helm&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;projectile-find-file&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;file&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-org-wiki&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;wiki&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-recentf&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;recent&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-swoop&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;swoop&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s one more for &lt;code&gt;gnus&lt;/code&gt;; I&amp;#39;m just getting the hang of it, so some hints are useful:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-gnus-reply&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;reply&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gnus-summary-reply-with-original&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;one&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;O&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gnus-summary-reply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gnus-summary-wide-reply-with-original&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;all&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gnus-summary-wide-reply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gnus-summary-very-wide-reply-with-original&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;universe&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;U&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gnus-summary-very-wide-reply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gnus-summary-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-gnus-reply/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I omit the hint for the commands that do the same as the previous one,
just without citing.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you enjoy the update and let me know when you invent some
efficient blue or red-and-blue Hydras. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Blogging about blogging</title>
   <link href="https://oremacs.com/2015/02/01/blogging-about-blogging/"/>
   <updated>2015-02-01T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/02/01/blogging-about-blogging</id>
   <content type="html">&lt;p&gt;In Emacs, of course. As I mentioned before, this blog is run using
&lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt; and a fork of the
&lt;a href=&quot;https://github.com/poole/lanyon&quot;&gt;lanyon&lt;/a&gt; theme.&lt;/p&gt;

&lt;p&gt;It started out pretty convenient: thanks to &lt;code&gt;jekyll serve&lt;/code&gt; I would see
the live updates at &lt;code&gt;http://localhost:4000/&lt;/code&gt; as I was editing the
markdown. But after a few posts, I&amp;#39;ve experienced a drastic decrease
in refresh time: it went from under a second to 15 seconds. Below, I&amp;#39;ll show how I&amp;#39;ve managed
to speed it back up.&lt;/p&gt;

&lt;h2 id=&quot;no-posts-no-problem&quot;&gt;No posts - no problem&lt;/h2&gt;

&lt;p&gt;Thanks to &lt;code&gt;(require &amp;#39;dired-x)&lt;/code&gt; I can jump from the current post to the
posts directory with &lt;kbd&gt;C-x C-j&lt;/kbd&gt;. It even puts the point on the current file. Now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;m&lt;/kbd&gt; to mark to current file&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;t&lt;/kbd&gt; to invert the mark, making the current file unmarked and all others marked&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;D&lt;/kbd&gt; to delete all marked files. No need to worry, since
they are all version-controlled (except the original one, which isn&amp;#39;t
being deleted), &lt;code&gt;dired&lt;/code&gt; even asks you for confirmation, so I hit
&lt;kbd&gt;y&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, that there is only one post in the whole blog, &lt;code&gt;jekyll serve&lt;/code&gt; is
much faster at refreshing.&lt;/p&gt;

&lt;h2 id=&quot;even-faster-jekyll-serve&quot;&gt;Even faster &lt;code&gt;jekyll serve&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Which brings me to the next point. Since I&amp;#39;m calling it so much, might
as well wrap it in some Elisp. Elisp is like frosting - it makes everything better:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;jekyll-serve&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_posts/$&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;directory-parent&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;buffer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*jekyll*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;switch-to-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*jekyll*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ansi-term&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/bin/bash&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;jekyll&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-buffer-process&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;term-send-string&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;jekyll serve\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sit-for&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;browse-url&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;localhost:4000&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This function, when called from the current post or the current blog, will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open a new &lt;code&gt;ansi-term&lt;/code&gt; called &lt;code&gt;*jekyll*&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;issue a &lt;code&gt;jekyll serve&lt;/code&gt; command to it&lt;/li&gt;
&lt;li&gt;wait for 3 seconds for Jekyll to start&lt;/li&gt;
&lt;li&gt;open &lt;code&gt;localhost:4000&lt;/code&gt; in Firefox&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;one-post-isnt-a-blog&quot;&gt;One post isn&amp;#39;t a blog&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s how to quickly bring back the deleted posts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fire up &lt;a href=&quot;https://github.com/magit/magit&quot;&gt;magit&lt;/a&gt;; I have &lt;code&gt;magit-status&lt;/code&gt; bound to &lt;kbd&gt;μm&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;Stage the current post with &lt;kbd&gt;s&lt;/kbd&gt; (&lt;code&gt;magit-stage-item&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Start the commit with &lt;kbd&gt;C&lt;/kbd&gt; (&lt;code&gt;magit-commit-add-log&lt;/code&gt;). I&amp;#39;m using my own modification of &lt;code&gt;magit-commit-add-log&lt;/code&gt;
that arranges the whitespace in a nice way, when aimed at a file instead of a hunk.&lt;/li&gt;
&lt;li&gt;I get &lt;code&gt;_posts/2015-02-01-blogging-about-blogging.md:&lt;/code&gt; string auto-generated by &lt;kbd&gt;C&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;I just amend it to look like &lt;code&gt;_posts/2015-02-01-blogging-about-blogging.md: add&lt;/code&gt; and finalize the commit with
&lt;kbd&gt;C-c C-c&lt;/kbd&gt; (&lt;code&gt;git-commit-commit&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Now I have around 40 files marked as deleted, but not staged. I create a stash with &lt;kbd&gt;zz&lt;/kbd&gt; and name it &lt;code&gt;foo&lt;/code&gt;
or something. Then delete the stash with &lt;code&gt;magit-discard-item&lt;/code&gt;, which I like to bind to &lt;kbd&gt;d&lt;/kbd&gt; to be similar
to &lt;code&gt;dired&lt;/code&gt;. Now it&amp;#39;s as if these files were never deleted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whoa, now that I look at it, it&amp;#39;s a lot of steps. But somehow &lt;code&gt;dired&lt;/code&gt;
and &lt;code&gt;magit&lt;/code&gt; are very similar to
&lt;a href=&quot;http://en.wikipedia.org/wiki/Super_Mario_Bros.&quot;&gt;Super Mario Bros&lt;/a&gt;: it
takes long to explain what you&amp;#39;re doing, but as you play it, it&amp;#39;s very
simple and natural.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>abel.el - abbrevs for Elisp</title>
   <link href="https://oremacs.com/2015/01/31/abel/"/>
   <updated>2015-01-31T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/31/abel</id>
   <content type="html">&lt;p&gt;This is a follow-up to
&lt;a href=&quot;/2014/12/28/trying-abbrevs/&quot;&gt;an older post about abbrevs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I did try to make Elisp abbrevs work, but after a few times of getting
&lt;code&gt;is&lt;/code&gt; expanded to &lt;code&gt;indent-sexp&lt;/code&gt; in strings or comments, I just could
take it no longer.&lt;/p&gt;

&lt;p&gt;Luckily and timely, Artur Malabarba revealed his
&lt;a href=&quot;https://github.com/Bruce-Connor/speed-of-thought-lisp&quot;&gt;speed-of-thought-lisp&lt;/a&gt;. This
package does many things, but the main idea that I liked was that the
abbrevs should only expand when in the function position, i.e. the
abbrev is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;right after opening parenthesis&lt;/li&gt;
&lt;li&gt;not in a comment&lt;/li&gt;
&lt;li&gt;not in a string&lt;/li&gt;
&lt;li&gt;not in the arguments list&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With that idea, I&amp;#39;ve &amp;quot;refactored&amp;quot; my old abbrevs into
&lt;a href=&quot;https://github.com/abo-abo/abel&quot;&gt;Abel&lt;/a&gt;.  It&amp;#39;s a minor mode add-on for
&lt;code&gt;abbrev-mode&lt;/code&gt;. When you activate it, around a hundred abbrevs are
added to your abbrev list for &lt;code&gt;emacs-lisp-mode&lt;/code&gt;. When you deactivate
it, these abbrevs are disabled, and your original abbrev list is
restored. It even overrides the mode-line description to &lt;code&gt;Abbrev&lt;/code&gt; -&amp;gt;
&lt;code&gt;Abel&lt;/code&gt; while it&amp;#39;s active, thanks to
&lt;a href=&quot;https://github.com/emacsmirror/diminish&quot;&gt;diminish&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So while you should try &lt;code&gt;sotl&lt;/code&gt;, which provides many other things, keep
&lt;code&gt;abel&lt;/code&gt; in mind: it&amp;#39;s a simple upgrade to &lt;code&gt;abbrev-mode&lt;/code&gt; that binds no
bindings and asks no questions.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the current list:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;abel-abbrevs&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; basics&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;and&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bp&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;boundp&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;concat&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fp&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;fboundp&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ii&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;interactive&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;insert&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;lambda&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;message&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;n&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;not&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;format&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;unless&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;up&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;unwind-protect&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;when&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;wl&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;while&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;require&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ci&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;call-interactively&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;cc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;condition-case&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;pg&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;plist-get&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sa&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;save-excursion&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sr&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;save-restriction&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;smd&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;save-match-data&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; defines&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;de&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;declare-function&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;df&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;defface&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;da&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;defmacro&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;du&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;defcustom&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dv&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;defvar&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; everything with char&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;backward-char&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;scb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;skip-chars-backward&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;scf&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;skip-chars-forward&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;gc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;goto-char&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;forward-char&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;delete-char&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ca&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;char-after&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; everything with region&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ra&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;region-active-p&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;region-beginning&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;re&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;region-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ntr&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;narrow-to-region&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dr&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;delete-region&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ir&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;indent-region&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; error related&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ie&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ignore-errors&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;error&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; regex match related&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;la&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;looking-at&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;lb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;looking-back&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;mb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;match-beginning&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;me&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;match-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ms&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;match-string&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;msn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;match-string-no-properties&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rm&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;replace-match&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ro&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;regexp-opt&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rq&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;regexp-quote&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rr&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;replace-regexp-in-string&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rsb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;re-search-backward&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rsf&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;re-search-forward&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sf&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;search-forward&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sm&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;string-match&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; words&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fw&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;forward-word&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bw&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;backward-word&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; lines&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;eol&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;end-of-line&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fl&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;forward-line&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;lbp&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;line-beginning-position&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;lep&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;line-end-position&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;nai&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;newline-and-indent&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; buffer&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bfn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;buffer-file-name&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;buffer-name&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bs&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;buffer-substring&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bsn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;buffer-substring-no-properties&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;cb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;current-buffer&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;wcb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;with-current-buffer&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;wtb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;with-temp-buffer&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;efn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;expand-file-name&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ff&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;find-file&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ffn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;find-file-noselect&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; window&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ow&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;other-window&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sw&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;selected-window&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; string&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ssn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;substring-no-properties&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ss&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;substring&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;si&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;split-string&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;se&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;string=&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sl&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;string&amp;lt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sp&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;stringp&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; point&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;pi&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;point-min&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;pa&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;point-max&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;point&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; key&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;gk&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;global-set-key&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dk&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;define-key&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;;; rest&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ah&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;add-hook&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;atl&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;add-to-list&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bod&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;beginning-of-defun&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bol&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;beginning-of-line&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dm&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;deactivate-mark&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fs&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;forward-sexp&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;jos&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;just-one-space&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;kn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;kill-new&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;lp&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;load-path&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;mm&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;major-mode&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sic&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;self-insert-command&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;symbol-name&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;tap&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;thing-at-point&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;tc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;this-command&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ul&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;up-list&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;List of (ABBREV EXPANSION) used by &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`abel&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:set&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;Update abbrevs accoring to &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`abel-abbrevs&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapc&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;abel-define&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:group&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;abel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Re-introducing auto-yasnippet</title>
   <link href="https://oremacs.com/2015/01/30/auto-yasnippet/"/>
   <updated>2015-01-30T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/30/auto-yasnippet</id>
   <content type="html">&lt;p&gt;I wonder, when the code isn&amp;#39;t touched in a long time, is it good (no
need for changes) or bad (became obsolete)?  Let&amp;#39;s find out. I&amp;#39;ll
explain here
&lt;a href=&quot;https://github.com/abo-abo/auto-yasnippet&quot;&gt;auto-yasnippet&lt;/a&gt;, my
&lt;em&gt;second&lt;/em&gt; package in MELPA out of more than a dozen currently that saw
almost no changes since the initial commit two years ago, and see if
you like it.&lt;/p&gt;

&lt;h2 id=&quot;short-description-of-yasnippet&quot;&gt;Short description of &lt;code&gt;yasnippet&lt;/code&gt;&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/capitaomorte/yasnippet&quot;&gt;YASnippet&lt;/a&gt; is a template
system for Emacs. It allows you to type an abbreviation and
automatically expand it into function templates. Bundled language
templates include: C, C++, C#, Perl, Python, Ruby, SQL, LaTeX, HTML,
CSS and more.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;snippet-step-by-step&quot;&gt;Snippet step-by-step&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s one of the snippets that I use for &lt;code&gt;emacs-lisp-mode&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;# -*- mode: snippet -*-
# name: function
# key: d
# --
(defun $1 ($2)
$0)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;The name of the snippet, &lt;code&gt;function&lt;/code&gt; is more like a comment than
anything else.&lt;/li&gt;
&lt;li&gt;On the other hand, &lt;code&gt;key&lt;/code&gt; is very important: it&amp;#39;s what I have to
insert in the buffer to get the expansion with &lt;kbd&gt;M-x&lt;/kbd&gt;
&lt;code&gt;yas-expand&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Everything after &lt;code&gt;# --&lt;/code&gt; is the snippet body.&lt;/li&gt;
&lt;li&gt;This particular snippet has two fields, in places of &lt;code&gt;$1&lt;/code&gt; and &lt;code&gt;$2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$0&lt;/code&gt; is where the point will be when the snippet expansion is finished&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As I expand, pressing &lt;kbd&gt;TAB&lt;/kbd&gt; will move from field to field
until the expansion is finished.&lt;/p&gt;

&lt;h3 id=&quot;snippets-are-mode-local&quot;&gt;Snippets are mode-local&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s the corresponding snippet for &lt;code&gt;clojure-mode&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;# -*- mode: snippet -*-
# name: defn
# key: d
# --
(defn $1 [$2]
$0)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you see, the &lt;code&gt;key&lt;/code&gt; here is the same; you&amp;#39;re allowed to overload
them based on the current &lt;code&gt;major-mode&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Even after &lt;a href=&quot;/archive/&quot;&gt;quite a few posts&lt;/a&gt;, I still keep forgetting
Jekyll&amp;#39;s syntax for the post header. This is my reminder:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;# -*- mode: snippet -*-
# name: post
# key: post
# --
---
layout: post
title: $0
---
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;mirrors-in-snippets&quot;&gt;Mirrors in snippets&lt;/h3&gt;

&lt;p&gt;This simple snippet introduces a powerful concept, and an important
&lt;code&gt;yasnippet&lt;/code&gt; feature that &lt;code&gt;auto-yasnippet&lt;/code&gt; uses:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;# -*- mode: snippet -*-
#name : class ... { ... }
# --
class $1$2
{
public:
 $1($0)
};
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is a snippet for a class declaration in &lt;code&gt;c++-mode&lt;/code&gt;; &lt;code&gt;$1&lt;/code&gt;, the
name of the class, is mirrored in the name of the constructor. This
way, you don&amp;#39;t have to enter it twice.&lt;/p&gt;

&lt;h2 id=&quot;what-auto-yasnippet-does&quot;&gt;What &lt;code&gt;auto-yasnippet&lt;/code&gt; does&lt;/h2&gt;

&lt;p&gt;All the snippets listed above are pre-configured, persistent and very
rarely changed.  They are like &lt;em&gt;plain functions&lt;/em&gt; in the source
code. Each of them needs their own file and so on.&lt;/p&gt;

&lt;p&gt;What &lt;code&gt;auto-yasnippet&lt;/code&gt; provides are &lt;em&gt;throw-away lambdas&lt;/em&gt;, that don&amp;#39;t
need a file and aren&amp;#39;t persistent.&lt;/p&gt;

&lt;h3 id=&quot;basic-install-of-auto-yasnippet&quot;&gt;Basic install of &lt;code&gt;auto-yasnippet&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;To get a usable install, you just need to bind &lt;code&gt;aya-create&lt;/code&gt;, which is
similar in spirit to &lt;kbd&gt;M-w&lt;/kbd&gt; (&lt;code&gt;kill-ring-save&lt;/code&gt;):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;H-w&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;aya-create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and &lt;code&gt;aya-expand&lt;/code&gt;, which is similar to &lt;kbd&gt;C-y&lt;/kbd&gt; (&lt;code&gt;yank&lt;/code&gt;):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;H-y&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;aya-expand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I also like to bind:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;aya-open-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I&amp;#39;m using &lt;kbd&gt;C-o&lt;/kbd&gt; to do all of these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;expand-abbrev&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;yas-expand&lt;/code&gt; and &lt;code&gt;yas-next-field-or-maybe-expand&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;open-line&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;example-1-javascript&quot;&gt;Example 1: JavaScript&lt;/h3&gt;

&lt;p&gt;Let&amp;#39;s say that you have this code and want to generate more like it:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;field1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;field1&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Let&amp;#39;s even assume that you know how &lt;code&gt;auto-yasnippet&lt;/code&gt; works and wrote down a slightly modified code beforehand:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;field~1&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;~&lt;/code&gt; are meant to represent &lt;code&gt;yasnippet&lt;/code&gt;&amp;#39;s mirrors, they will be
consistent across every expansion. Now you type &lt;kbd&gt;H-w&lt;/kbd&gt; (&lt;code&gt;aya-create&lt;/code&gt;), which works on the current
line when there&amp;#39;s no region. Your code becomes the initial one without &lt;code&gt;~&lt;/code&gt;, and &lt;code&gt;aya-current&lt;/code&gt; variable now holds:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aya-current&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; =&amp;gt; &amp;quot;field$1 = document.getElementById(\&amp;quot;field$1\&amp;quot;);&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By typing e.g. &lt;kbd&gt;H-y 2 C-o RET&lt;/kbd&gt;, &lt;kbd&gt;H-y 3 C-o RET&lt;/kbd&gt;, &lt;kbd&gt;H-y Final C-o RET&lt;/kbd&gt; you get:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;field2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;field2&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;field3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;field3&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;fieldFinal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;fieldFinal&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note again, that there would be little point to saving this snippet in
a file, since the situation where you need to use it may not come up
again.&lt;/p&gt;

&lt;h3 id=&quot;example-2-java&quot;&gt;Example 2: Java&lt;/h3&gt;

&lt;p&gt;Here&amp;#39;s the starting code, with fields and mirrors already in place
(note one mirror named &lt;code&gt;~On&lt;/code&gt;, one field named &lt;code&gt;~on&lt;/code&gt; and one field
named &lt;code&gt;~true&lt;/code&gt;):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Java&quot; data-lang=&quot;Java&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Light&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;On&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Runnable&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Light&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;On&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Turning ~on lights&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;light&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Since the code spans multiple lines, as is often the case with Java, you need to mark it
with a region before &lt;kbd&gt;H-w&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the final result:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Java&quot; data-lang=&quot;Java&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;LightOn&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Runnable&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;LightOn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Turning on lights&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;light&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;LightOff&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Runnable&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;LightOff&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Turning off lights&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;light&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;No need for &lt;code&gt;AbstractLightFactoryAdapterProvider&lt;/code&gt; when we can just
copy-paste stuff with &lt;code&gt;auto-yasnippet&lt;/code&gt;. In fact, I should probably
emphasize that when describing &lt;code&gt;auto-yasnippet&lt;/code&gt;: it&amp;#39;s just an advanced
copy-paste tool.&lt;/p&gt;

&lt;h3 id=&quot;example-3-c&quot;&gt;Example 3: C++&lt;/h3&gt;

&lt;p&gt;Suppose that I want to generate &lt;code&gt;curl&lt;/code&gt; from the &lt;code&gt;grad&lt;/code&gt;. I can start with this template:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c++&quot; data-lang=&quot;c++&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;grad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;grad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, I need less than a line, so region needs to be marked again. The result:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-C++&quot; data-lang=&quot;C++&quot;&gt;&lt;span&gt;&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;grad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;grad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
                        &lt;span class=&quot;n&quot;&gt;grad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;grad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
                        &lt;span class=&quot;n&quot;&gt;grad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;grad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note how annoying it would be to triple check that the indices match.
This time, I just had to check the first line.&lt;/p&gt;

&lt;h3 id=&quot;example-4-taking-out-of-the-equation&quot;&gt;Example 4: taking &lt;code&gt;~&lt;/code&gt; out of the equation&lt;/h3&gt;

&lt;p&gt;This works only for one-line snippets with a single mirror parameter.
In the JavaScript example, you can leave a &lt;code&gt;$&lt;/code&gt; instead of each
occurrence of &lt;code&gt;$1&lt;/code&gt;, and with the point in place of the last occurrence
you call &lt;kbd&gt;H-w&lt;/kbd&gt; (&lt;code&gt;aya-create&lt;/code&gt;).  Here, &lt;code&gt;|&lt;/code&gt; represents the point:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;field$&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;|&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The final result is the same:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;field1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;field1&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;field2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;field2&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;field3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;field3&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;fieldFinal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;fieldFinal&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that this package will lessen your suffering when dealing with
verbose programming languages and repetitive text, and that a day will
come when repetition is no longer needed and &lt;code&gt;auto-yasnippet&lt;/code&gt; will
become obsolete.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Combining ace-window and windmove with hydra</title>
   <link href="https://oremacs.com/2015/01/29/more-hydra-goodness/"/>
   <updated>2015-01-29T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/29/more-hydra-goodness</id>
   <content type="html">&lt;p&gt;I was inspired by Sacha Chua&amp;#39;s &lt;a href=&quot;http://sachachua.com/blog/2015/01/emacs-microhabit-switching-windows-windmove-ace-window-ace-jump/&quot;&gt;recent post&lt;/a&gt;
explaining her window bindings, that combine both &lt;code&gt;ace-window&lt;/code&gt; and &lt;code&gt;windmove&lt;/code&gt;.
So I wrote down an update to Hydra in order to get a similar setup.&lt;/p&gt;

&lt;h2 id=&quot;sachas-code&quot;&gt;Sacha&amp;#39;s code&lt;/h2&gt;

&lt;p&gt;Here it is:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;key-chord-define-global&lt;/span&gt;
 &lt;span class=&quot;s&quot;&gt;&amp;quot;yy&amp;quot;&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sacha/def-rep-command&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;left&amp;gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;right&amp;gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;down&amp;gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;up&amp;gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-up&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;y&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;other-window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;my-code&quot;&gt;My code&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s what I&amp;#39;ve come up with, thanks to the newest code in
&lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-universal-argument&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;P&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;prefix-arg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;consp&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
                     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;-&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                       &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;defhydra&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-window&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;window&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-left&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;left&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-down&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;down&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-up&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;up&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;windmove-right&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;right&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ace&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-universal-argument&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;universal&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;swap&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;delete&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;key-chord-define-global&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;yy&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-window/body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The new code should already be available in
&lt;a href=&quot;http://melpa.org/&quot;&gt;MELPA&lt;/a&gt;.  I&amp;#39;ll update the code in
&lt;a href=&quot;https://elpa.gnu.org/packages/hydra.html&quot;&gt;GNU ELPA&lt;/a&gt; soon, when I make
sure that there were no bugs introduced by the change.&lt;/p&gt;

&lt;p&gt;If anyone wants to see how the &lt;code&gt;defhydra&lt;/code&gt; macro expands, you can check
out
&lt;a href=&quot;https://github.com/abo-abo/hydra/blob/master/hydra-test.el&quot;&gt;hydra-test.el&lt;/a&gt;.
I just added a Travis CI setup, so if you&amp;#39;re interested in starting
to test your Elisp code, you can have a very simple example.&lt;/p&gt;

&lt;h2 id=&quot;how-the-defined-hydra-works&quot;&gt;How the defined Hydra works&lt;/h2&gt;

&lt;p&gt;With this setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;to swap two windows (i.e. call &lt;kbd&gt;C-u&lt;/kbd&gt; &lt;code&gt;ace-window&lt;/code&gt;), I can do any of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-M-o s&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-M-o ua&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;yys&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;yyua&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;to delete one window (i.e. call &lt;kbd&gt;C-u C-u&lt;/kbd&gt; &lt;code&gt;ace-window&lt;/code&gt;), any of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-M-o d&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-M-o uua&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;yyd&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;yyuua&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;to move one window down, two windows right, and one window up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;C-M-o jllk&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;yyjllk&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although every other shortcut except the Hydra heads will vanquish the
Hydra, sometimes I have nothing on my mind that needs doing. For that
case, as you can see above, I enter &lt;kbd&gt;o&lt;/kbd&gt; in its own list
without a function, so that &lt;kbd&gt;o&lt;/kbd&gt; will dismiss the Hydra
without doing anything.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>A few notes on Elisp indentation</title>
   <link href="https://oremacs.com/2015/01/28/notes-on-elisp-indentation/"/>
   <updated>2015-01-28T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/28/notes-on-elisp-indentation</id>
   <content type="html">&lt;p&gt;I sure do like to keep my Elisp code nice and indented.
But sometimes the indentation engine just won&amp;#39;t listen.&lt;/p&gt;

&lt;h2 id=&quot;lisp-indent-function&quot;&gt;lisp-indent-function&lt;/h2&gt;

&lt;p&gt;By default, the indentation is handled as if:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lisp-indent-function&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;lisp-indent-function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;At least in one case, it looks horrible:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cl-labels&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;square&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;square&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; =&amp;gt; (0 1 4 9 16 25)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That&amp;#39;s why I have:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lisp-indent-function&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;common-lisp-indent-function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;which leads to this indentation:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cl-labels&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;square&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;square&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; =&amp;gt; (0 1 4 9 16 25)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Ah, much better. The indentation does change a bit in other places as
a result of this. To my experience, it can be fixed on a case-by-case
basis by declaring the indent level for the offending function or
macro.&lt;/p&gt;

&lt;h2 id=&quot;declaring-indent-level&quot;&gt;Declaring indent level&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s how it looks like&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defmacro&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-save-excursion&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;&amp;amp;rest&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;More intuitive (&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`save-excursion&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; BODY).&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;declare&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;indent&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;out&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;,@&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;bolp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;back-to-indentation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
     &lt;span class=&quot;nv&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By default, functions behave as if their &lt;code&gt;indent&lt;/code&gt; was declared to &lt;code&gt;nil&lt;/code&gt;.
Zero here means that we expect zero arguments on the same line, so that this indentation follows:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-save-excursion&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy--out-forward&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;backward-list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;indent-sexp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The indentation above is just like the one that the original &lt;code&gt;save-excursion&lt;/code&gt; has.
Note that if I hadn&amp;#39;t declared the indent, it would look like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-save-excursion&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy--out-forward&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;backward-list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;indent-sexp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The impact is much larger for statements that require an &lt;code&gt;indent&lt;/code&gt; of 1:&lt;/p&gt;

&lt;p&gt;Compare the proper thing:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-dotimes&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Reached end of buffer&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;forward-list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;to this horror:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-dotimes&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Reached end of buffer&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;forward-list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ve shown two things you can try if you find your Elisp indentation
annoying. If you know of more, let me know.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>My "refactoring" workflow</title>
   <link href="https://oremacs.com/2015/01/27/my-refactoring-workflow/"/>
   <updated>2015-01-27T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/27/my-refactoring-workflow</id>
   <content type="html">&lt;p&gt;Well, &amp;quot;refactoring&amp;quot; is for the Java people, I simply rename things.
Just today, I had to do a big rename operation related to the
&lt;a href=&quot;https://github.com/abo-abo/lispy/releases&quot;&gt;release of lispy 0.22.0&lt;/a&gt;.
Below, I&amp;#39;ll share some functions and packages that I used for that.&lt;/p&gt;

&lt;h2 id=&quot;my-github-setup&quot;&gt;My Github setup&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s it (&lt;code&gt;tree -da -L 1&lt;/code&gt;) is:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;.
├── .cask
├── gh-pages
├── .git
└── images
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I&amp;#39;ve cloned my &lt;code&gt;gh-pages&lt;/code&gt; branch into its own git repository &lt;em&gt;inside&lt;/em&gt;
the original &lt;code&gt;lispy&lt;/code&gt; repository. This way, I can rename functions in
the code and the documentation simultaneously.&lt;/p&gt;

&lt;h2 id=&quot;declaring-functions-obsolete-in-elisp&quot;&gt;Declaring functions obsolete in Elisp&lt;/h2&gt;

&lt;p&gt;It can be done like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;define-obsolete-function-alias&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-out-forward&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-right&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;0.21.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;define-obsolete-function-alias&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-out-backward&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-left&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;0.21.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;define-obsolete-function-alias&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-out-forward-nostring&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-right-nostring&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;0.21.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After version &lt;code&gt;&amp;quot;0.21.0&amp;quot;&lt;/code&gt; hits, any time you call &lt;code&gt;lispy-left&lt;/code&gt; by its
now obsolete alias &lt;code&gt;lispy-out-backward&lt;/code&gt;, you&amp;#39;ll get a message:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;`lispy-out-forward&amp;#39; is an obsolete command (as of 0.21.0); use `lispy-right&amp;#39; instead.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So now, since I&amp;#39;m releasing version &lt;code&gt;&amp;quot;0.22.0&amp;quot;&lt;/code&gt;, I can remove even the
alias declarations. I gave people one week of warnings to adjust (just
rename to the new name) any of their code that&amp;#39;s calling the currently
obsolete functions.&lt;/p&gt;

&lt;h2 id=&quot;renaming-obsolete-functions-in-the-documentation&quot;&gt;Renaming obsolete functions in the documentation&lt;/h2&gt;

&lt;p&gt;Taking advantage of the repository setup, I can:&lt;/p&gt;

&lt;h3 id=&quot;step-1-call-rgrep&quot;&gt;Step 1: call &lt;code&gt;rgrep&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;rgrep&lt;/code&gt; is a fine function, I wonder why it&amp;#39;s not bound by default; I
bind it to &lt;kbd&gt;C-&amp;lt;&lt;/kbd&gt;, taking advantage of my weird key
mappings (I&amp;#39;m actually pressing the &lt;kbd&gt;C-;-l&lt;/kbd&gt; physical keys).&lt;/p&gt;

&lt;p&gt;It requires 3 inputs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Symbol to search for&lt;/strong&gt;: I call it with the point positioned on
the symbol that I want to rename in the code, in the middle of the
&lt;code&gt;define-obsolete-function-alias&lt;/code&gt; tag, so &lt;code&gt;rgrep&lt;/code&gt; picks up the
symbol name as the default and I just type &lt;kbd&gt;RET&lt;/kbd&gt; to select
it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;File pattern&lt;/strong&gt;: &lt;code&gt;*.el&lt;/code&gt;, the current file extension is the
default. I type &lt;code&gt;*&lt;/code&gt; &lt;kbd&gt;RET&lt;/kbd&gt;, since I want to match the &lt;code&gt;org&lt;/code&gt; and &lt;code&gt;html&lt;/code&gt;
files as well.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Base directory&lt;/strong&gt;: this directory will be will be recursively
searched for files that match the file pattern; the default
&lt;code&gt;~/git/lispy/&lt;/code&gt; is fine here, &lt;kbd&gt;RET&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;step-2-call-wgrep&quot;&gt;Step 2: call &lt;code&gt;wgrep&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mhayashi1120/Emacs-wgrep&quot;&gt;wgrep&lt;/a&gt; is a fine
package, I wonder why it&amp;#39;s not more popular. Since it&amp;#39;s so similar to
&lt;code&gt;wdired&lt;/code&gt; (one of the best things since sliced bread, btw), I like to bind
the starter to  &lt;kbd&gt;C-x C-q&lt;/kbd&gt; and the finisher to &lt;kbd&gt;C-c C-c&lt;/kbd&gt;
as well:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;eval-after-load&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;grep&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;grep-mode-map&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-x C-q&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;wgrep-change-to-wgrep-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;eval-after-load&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;wgrep&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;grep-mode-map&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c C-c&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;wgrep-finish-edit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;step-3-call-iedit&quot;&gt;Step 3: call &lt;code&gt;iedit&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/victorhge/iedit&quot;&gt;iedit&lt;/a&gt; is an amazing package, it&amp;#39;s crazy-good.
Here&amp;#39;s how I bind it, since once &lt;code&gt;iedit-mode&lt;/code&gt; is on, you can move to the next occurrence with &lt;kbd&gt;C-i&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-i&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;iedit-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In order to change &lt;em&gt;really&lt;/em&gt; every occurrence in the buffer, I need to
mark the thing that I want to change, before &lt;kbd&gt;C-M-i&lt;/kbd&gt;.
Otherwise, &lt;code&gt;iedit&lt;/code&gt; will automatically add symbol bounds (a nice
feature, actually), so that e.g. &lt;code&gt;=lispy-out-forward=&lt;/code&gt; will not match
&lt;code&gt;lispy-out-forward&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, I interactively, char-by-char, rename e.g. &lt;code&gt;lispy-out-forward&lt;/code&gt; to &lt;code&gt;lispy-right&lt;/code&gt;.
The experience is similar to the popular &lt;a href=&quot;https://github.com/magnars/multiple-cursors.el&quot;&gt;multiple-cursors&lt;/a&gt;,
which I also like to use, just for different purposes.&lt;/p&gt;

&lt;h3 id=&quot;step-4-exiting&quot;&gt;Step 4: exiting&lt;/h3&gt;

&lt;p&gt;When I&amp;#39;m done:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I exit &lt;code&gt;iedit-mode&lt;/code&gt; with &lt;kbd&gt;C-M-i&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;I exit &lt;code&gt;wgrep&lt;/code&gt; with &lt;kbd&gt;C-c C-c&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;I save all affected files if I want, since they aren&amp;#39;t saved yet and
it&amp;#39;s still possible to revert everything.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Woah, that&amp;#39;s a lot of steps!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;True, but do note that all three tools can be used on their own for
various other tasks.  See for instance my other
&lt;a href=&quot;http://youtu.be/DFTXnC1scno?t=3m49s&quot;&gt;&amp;quot;refactoring&amp;quot; demo&lt;/a&gt;, that uses
&lt;code&gt;iedit-mode&lt;/code&gt; to unbind a &lt;code&gt;let&lt;/code&gt;-bound variable in Elisp (should also
work for Common Lisp, since the syntax is the same).&lt;/p&gt;

&lt;p&gt;There&amp;#39;s beauty and utility in having such composable tools. A lot of
the time, it&amp;#39;s better than to just have one &amp;quot;Rename&amp;quot; button. For
instance, when only one buffer is involved, the &lt;code&gt;rgrep&lt;/code&gt;-&lt;code&gt;wgrep&lt;/code&gt; step
can be skipped and I can rename stuff with &lt;code&gt;iedit-mode&lt;/code&gt; only.&lt;/p&gt;

&lt;p&gt;Or, when the playground for renaming is less than a buffer, I can:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;kbd&gt;C-x nd&lt;/kbd&gt; - &lt;code&gt;narrow-to-defun&lt;/code&gt; or &lt;kbd&gt;C-x nn&lt;/kbd&gt; -
&lt;code&gt;narrow-to-region&lt;/code&gt; (both are equivalent to &lt;kbd&gt;N&lt;/kbd&gt; in &lt;code&gt;lispy&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;iedit-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-x nw&lt;/kbd&gt; - &lt;code&gt;widen&lt;/code&gt; (&lt;kbd&gt;W&lt;/kbd&gt; in &lt;code&gt;lispy&lt;/code&gt;)&lt;/li&gt;
&lt;/ol&gt;
</content>
 </entry>
 
 <entry>
   <title>occur-dwim (Do What I Mean)</title>
   <link href="https://oremacs.com/2015/01/26/occur-dwim/"/>
   <updated>2015-01-26T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/26/occur-dwim</id>
   <content type="html">&lt;p&gt;I&amp;#39;d like to share a little snippet that I like to use instead of a
plain &lt;kbd&gt;M-s o&lt;/kbd&gt; (&lt;code&gt;occur&lt;/code&gt;).&lt;/p&gt;

&lt;h2 id=&quot;smarter-than-the-average-occur&quot;&gt;smarter-than-the-average-occur&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;occur-dwim&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Call &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`occur&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; with a sane default.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;region-active-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-substring-no-properties&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;region-beginning&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;region-end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sym&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;thing-at-point&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringp&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;sym&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;regexp-quote&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;sym&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;regexp-history&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;call-interactively&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;occur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It will offer as the default candidate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the current region, if it&amp;#39;s active&lt;/li&gt;
&lt;li&gt;the current symbol, otherwise&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It&amp;#39;s pretty good, since I actually want the default candidate in 95%
of the cases.  Some other functions, such as &lt;code&gt;rgrep&lt;/code&gt; are smart like
this out-of-the-box.&lt;/p&gt;

&lt;h2 id=&quot;a-hydra-that-goes-nicely-with-occur&quot;&gt;A Hydra that goes nicely with &lt;code&gt;occur&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Since &lt;code&gt;occur&lt;/code&gt;, like some other functions (&lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;rgrep&lt;/code&gt;, &lt;code&gt;compile&lt;/code&gt;),
works with &lt;code&gt;next-error&lt;/code&gt;, it&amp;#39;s possible to use this
&lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;Hydra&lt;/a&gt; to navigate the &lt;code&gt;occur&lt;/code&gt;
matches:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-create&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-g&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;first-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;first&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;next&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;previous-error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;prev&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Hydra was introduced in an
&lt;a href=&quot;/2015/01/20/introducing-hydra/&quot;&gt;earlier post&lt;/a&gt;,
and is available in GNU ELPA.&lt;/p&gt;

&lt;h2 id=&quot;what-goes-around-comes-around&quot;&gt;What goes around comes around&lt;/h2&gt;

&lt;p&gt;I usually do a quick internet search to see where I got the code that
I&amp;#39;m posting here, reason being that it&amp;#39;s nice to list the source, as
well as there could be more advanced stuff out there on the same
topic.&lt;/p&gt;

&lt;p&gt;I saw a few results for &lt;code&gt;&amp;quot;occur-dwim&amp;quot;&lt;/code&gt; so I thought that I just
copy-pasted it from somewhere. Slight disappointment turned into a
small sense of pride, when I found that the source of the copy-pastes
was my old Stack Overflow answer:)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Exploring Emacs packages</title>
   <link href="https://oremacs.com/2015/01/25/exploring-emacs-packages/"/>
   <updated>2015-01-25T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/25/exploring-emacs-packages</id>
   <content type="html">&lt;p&gt;Currently, &lt;a href=&quot;http://melpa.org/&quot;&gt;MELPA&lt;/a&gt; hosts over &lt;code&gt;2250&lt;/code&gt; packages. That&amp;#39;s
quite a large number, although it&amp;#39;s still feasible to try most of the
popular ones. In comparison,&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span&gt;&lt;/span&gt;apt-cache pkgnames &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; wc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;gives me the number &lt;code&gt;50250&lt;/code&gt;. I don&amp;#39;t recall calling &lt;code&gt;apt-cache
pkgnames&lt;/code&gt; ever before, while I call &lt;code&gt;package-list-packages&lt;/code&gt; all the
time. I suppose that this will have to change when the number of
packages grows further.&lt;/p&gt;

&lt;p&gt;I usually explore packages just as they show up as new in &lt;code&gt;package-list-packages&lt;/code&gt;.
I&amp;#39;ll share the two tools that I use for exploring them.&lt;/p&gt;

&lt;h2 id=&quot;smex&quot;&gt;Smex&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/nonsequitur/smex&quot;&gt;Smex&lt;/a&gt; is an &lt;kbd&gt;M-x&lt;/kbd&gt; enhancement for Emacs.
In addition to executing commands faster, it gives you an option to jump to the current command&amp;#39;s definition
with &lt;kbd&gt;M-.&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s how I bind &lt;code&gt;smex&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;smex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\C-t&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;smex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;smex-prepare-ido-bindings&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-completion-map&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-,&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;smex-describe-function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-completion-map&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-w&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;smex-where-is&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-completion-map&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;smex-find-function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-completion-map&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-a&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;move-beginning-of-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; (define-key ido-completion-map &amp;quot;\C-i&amp;quot; &amp;#39;smex-helm)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; (define-key ido-completion-map &amp;quot; &amp;quot; &amp;#39;smex-helm)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I don&amp;#39;t feel bad at all for unbinding &lt;code&gt;transpose-chars&lt;/code&gt;,
&lt;kbd&gt;C-t&lt;/kbd&gt; is such a prime binding, that only the best commands
can deserve it. And since I touch-type, it&amp;#39;s easier for me to hit
&lt;kbd&gt;M-DEL&lt;/kbd&gt; and retype the word when I notice a mistake, than to
carefully navigate to the mistake location and call &lt;code&gt;transpose-chars&lt;/code&gt;
with surgical precision. On the other hand, the number of Emacs
packages is only going to grow, so it becomes less and less feasible
to bind everything. Instead, seldom used stuff can be called though
&lt;code&gt;smex&lt;/code&gt;. For instance, I don&amp;#39;t bind
&lt;a href=&quot;https://github.com/ardumont/markdown-toc&quot;&gt;markdown-toc&lt;/a&gt; or
&lt;a href=&quot;https://github.com/hagleitn/speed-type&quot;&gt;speed-type&lt;/a&gt; and call them via
&lt;kbd&gt;C-t&lt;/kbd&gt; instead.&lt;/p&gt;

&lt;p&gt;Back to the point, &lt;kbd&gt;C-t&lt;/kbd&gt; ... &lt;kbd&gt;C-.&lt;/kbd&gt;
(&lt;code&gt;smex-find-function&lt;/code&gt;) allows me to quickly jump to the source of the
package that I want to explore.&lt;/p&gt;

&lt;h2 id=&quot;semantic-tags&quot;&gt;Semantic tags&lt;/h2&gt;

&lt;p&gt;Once I&amp;#39;m in the source code, I can quickly get an overview with
&lt;kbd&gt;g&lt;/kbd&gt; (&lt;code&gt;lispy-goto&lt;/code&gt;) from
&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;. It uses CEDET&amp;#39;s semantic
module to get a list of tags in current directory with
&lt;a href=&quot;https://github.com/emacs-helm/helm&quot;&gt;helm&lt;/a&gt; for completion.  In my
opinion, it&amp;#39;s much prettier than &lt;code&gt;helm&lt;/code&gt;&amp;#39;s own &lt;code&gt;helm-semantic&lt;/code&gt;. It also
explores more tags for Emacs Lisp, for instance it will capture
&lt;code&gt;use-package&lt;/code&gt; and &lt;code&gt;global-set-key&lt;/code&gt; tags.&lt;/p&gt;

&lt;p&gt;A new cute feature that I added recently is a different background for
user-visible functions, i.e.  the ones that are callable by
&lt;kbd&gt;M-x&lt;/kbd&gt; or &lt;code&gt;smex&lt;/code&gt;.  Here&amp;#39;s how it looks like, for the
&lt;code&gt;speed-type&lt;/code&gt; package (interactive functions have a purple background):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lispy-goto.png&quot; alt=&quot;lispy-goto&quot;&gt;&lt;/p&gt;

&lt;p&gt;If the image text looks too small, you can right click / view image in
your browser. Here, I can see at a glance, that there are three
commands that I can call.  I can also see a few variables, two of them
don&amp;#39;t include &lt;code&gt;--&lt;/code&gt;, so they&amp;#39;re probably customizable.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Do things after selecting window</title>
   <link href="https://oremacs.com/2015/01/24/after-select-window/"/>
   <updated>2015-01-24T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/24/after-select-window</id>
   <content type="html">&lt;p&gt;I saw this question today at Stack Overflow -
&lt;a href=&quot;http://stackoverflow.com/q/28124095/1350992&quot;&gt;Emacs: How to enable toolbar mode and menubar mode only under a certain mode?&lt;/a&gt;.
Myself, I never use the menubar or the toolbar. But maybe it&amp;#39;s just
because it&amp;#39;s useless in the modes to which I&amp;#39;m used to. What if there
was an option to have the menu bar &lt;em&gt;on&lt;/em&gt; just for a few select
modes?  For instance, if I decided that I want to learn Haskell
tomorrow, I wouldn&amp;#39;t mind to have the menu bar on for a while,
especially if there was some useful stuff there in the menu.&lt;/p&gt;

&lt;h2 id=&quot;the-code&quot;&gt;The Code&lt;/h2&gt;

&lt;p&gt;I&amp;#39;m not aware of a convenient hook for this job; I tried
&lt;code&gt;after-change-major-mode-hook&lt;/code&gt;, and it doesn&amp;#39;t work when switching
windows. The universal &lt;code&gt;post-command-hook&lt;/code&gt; would be totally lame for this task.&lt;/p&gt;

&lt;p&gt;Then it occurred to me, that &lt;code&gt;select-window&lt;/code&gt; &lt;em&gt;has&lt;/em&gt; to be called
eventually in most circumstances.  Even
&lt;a href=&quot;https://github.com/abo-abo/ace-window&quot;&gt;ace-window&lt;/a&gt; calls
&lt;code&gt;select-window&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is what I came up with so far:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;menubar-last&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;make-ring&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;menubar-last&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;dummy&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defadvice&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;select-window&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;after&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;select-window-menubar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;activate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;equal&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-ref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;menubar-last&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;menubar-last&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;yes-or-no&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;memq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;major-mode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;r-mode&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lisp-interaction-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
               &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;menu-bar-mode&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;yes-or-no&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tool-bar-mode&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;yes-or-no&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;the-ring-trickery&quot;&gt;The Ring trickery&lt;/h2&gt;

&lt;p&gt;It&amp;#39;s necessary at least for &lt;code&gt;magit&lt;/code&gt;. Doing, for instance,
&lt;kbd&gt;ll&lt;/kbd&gt; operation switches windows many times.
So I added a check that the current buffer isn&amp;#39;t selected twice.&lt;/p&gt;

&lt;p&gt;In Emacs, a ring is like a stack with a limited length: you push onto
the head, and if the stack becomes too large, the stuff gets removed
from the tail. Perfect for debugging this code, since I don&amp;#39;t care
what happened 20 window switches ago, I&amp;#39;m only interested in the most
recent state. One small annoyance is that the following code will
throw, if the ring is empty:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ring-ref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;menubar-last&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I would prefer if it just returned &lt;code&gt;nil&lt;/code&gt; instead. Hence the trick of
initializing &lt;code&gt;menubar-last&lt;/code&gt; with a dummy item.  Note that this
annoyance propagates to other areas: &lt;code&gt;(current-kill 0)&lt;/code&gt; will throw if
you haven&amp;#39;t yet copied text since Emacs started.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I&amp;#39;m not sure if this code is more annoying than useful, but, at least,
I learned something new while writing it, and I hope you did too.  If
you know of a better way to accomplish the original task, please do
share.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ElTeX - generate full LaTeX documents from Emacs Lisp</title>
   <link href="https://oremacs.com/2015/01/23/eltex/"/>
   <updated>2015-01-23T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/23/eltex</id>
   <content type="html">&lt;p&gt;OK. Please stop laughing. It&amp;#39;s a
&lt;a href=&quot;https://github.com/abo-abo/eltex&quot;&gt;thing&lt;/a&gt; now.&lt;/p&gt;

&lt;p&gt;Seriously though, it&amp;#39;s my little project of writing a major mode for
Emacs.  I&amp;#39;ve written many minor modes, but this is my first major
one. Granted, it&amp;#39;s only a small derivation of &lt;code&gt;emacs-lisp-mode&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;how-the-eltex-looks-like&quot;&gt;How the ElTeX looks like&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s how a sample document outline looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/eltex-fontified.png&quot; alt=&quot;eltex-fontified&quot;&gt;&lt;/p&gt;

&lt;p&gt;Here, &lt;code&gt;homogenization&lt;/code&gt;, &lt;code&gt;smoluchowski-equation&lt;/code&gt;, and
&lt;code&gt;model-description-geometry&lt;/code&gt; are simply Elisp functions that should
produce a string on call. They are defined &lt;a href=&quot;https://github.com/abo-abo/eltex/blob/master/demos/demo-math.elt&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;On calling &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;eltex-compile&lt;/code&gt;, the corresponding LaTeX
document will be written to the file to which &lt;code&gt;eltex-filename&lt;/code&gt; points
to.&lt;/p&gt;

&lt;h2 id=&quot;how-the-corresponding-latex-looks-like&quot;&gt;How the corresponding LaTeX looks like&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s an excerpt of what will be generated:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-latex&quot; data-lang=&quot;latex&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;\documentclass&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;article&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\usepackage&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;[fleqn]&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;amsmath&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\usepackage&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;amsthm&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\usepackage&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;enumerate&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\usepackage&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;amsfonts&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\usepackage&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;xcolor&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\usepackage&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;[style=numeric,natbib=true,backend=bibtex]&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;biblatex&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\addbibresource&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;analysis.bib&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\begin&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;document&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;\section&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;Introduction&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;\subsection&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;Homogenization&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;how-the-original-eltex-looks-like-in-emacs-lisp-mode&quot;&gt;How the original ElTeX looks like in &lt;code&gt;emacs-lisp-mode&lt;/code&gt;&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eltex-filename&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/tpaper/tpaper.tex&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;eltex-macros&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;;* Document&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;documentclass&lt;/span&gt;
 &lt;span class=&quot;s&quot;&gt;&amp;quot;article&amp;quot;&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;usepackage&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;amsmath&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;fleqn&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;amsthm&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;enumerate&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;amsfonts&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;xcolor&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;biblatex&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;style=numeric,natbib=true,backend=bibtex&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bibliography&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;analysis&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;document&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;section&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Introduction&amp;quot;&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;homogenization&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;smoluchowski-equation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;section&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Notations and Assumptions&amp;quot;&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;model-description-geometry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;\\printbibliography&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;why-this&quot;&gt;Why this?&lt;/h2&gt;

&lt;p&gt;Well, why not? At one point I was frustrated with LaTeX not allowing
me to define mathematically rich entities. I did hack up a few TeX
macros for this eventually, but it was very awkward.&lt;/p&gt;

&lt;p&gt;So I thought that I could make Emacs Lisp generate simple LaTeX in a
similar way that C generates machine code. No more intricate LaTeX
macros, only plain LaTeX, generated from (intricate) Elisp.&lt;/p&gt;

&lt;p&gt;This is still very much in a toy stage, I don&amp;#39;t currently use it for
anything serious.  Still, in case you&amp;#39;re interested in defining
derived major modes, you can look at my
&lt;a href=&quot;https://github.com/abo-abo/eltex/blob/master/eltex.el&quot;&gt;implementation&lt;/a&gt;,
it&amp;#39;s only 25 lines. The interesting thing about it, if you noticed, is
that it replaces all double quoted strings visually with single quoted
strings, so that they don&amp;#39;t jump out as much.&lt;/p&gt;

&lt;h2 id=&quot;more-examples&quot;&gt;More examples&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s how the typesetting of some mathematical logic looks like:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/eltex-math.png&quot; alt=&quot;eltex-math&quot;&gt;&lt;/p&gt;

&lt;p&gt;And here&amp;#39;s the corresponding LaTeX:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/eltex-math-latex.png&quot; alt=&quot;eltex-math-latex&quot;&gt;&lt;/p&gt;

&lt;p&gt;Note how simple the resulting LaTeX is, considering how many variables
were used to generate it. Now, I can update anything in the &lt;code&gt;with&lt;/code&gt;
Elisp binding, and the corresponding LaTeX will be appropriately
regenerated, error-free.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Adding a bit of Clojure's sugar to Elisp</title>
   <link href="https://oremacs.com/2015/01/22/clojure-sugar-for-elisp/"/>
   <updated>2015-01-22T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/22/clojure-sugar-for-elisp</id>
   <content type="html">&lt;p&gt;I just wanted to highlight my latest
&lt;a href=&quot;http://comments.gmane.org/gmane.emacs.devel/181534&quot;&gt;submission to emacs-devel&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-patch&quot;&gt;The patch&lt;/h2&gt;

&lt;p&gt;The attached
&lt;a href=&quot;http://lists.gnu.org/archive/html/emacs-devel/2015-01/txtqCl_ExSFYV.txt&quot;&gt;patch&lt;/a&gt;,
together with the macro
&lt;a href=&quot;https://github.com/abo-abo/short-lambda&quot;&gt;short-lambda&lt;/a&gt; will add a
shorthand for defining &lt;code&gt;lambda&lt;/code&gt;s in Emacs Lisp.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s an excerpt from &lt;a href=&quot;http://clojure.org/reader&quot;&gt;the Clojure reader docs&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Anonymous function literal (&lt;code&gt;#()&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#(...)&lt;/code&gt; =&amp;gt; &lt;code&gt;(fn [args] (...))&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;where args are determined by the presence of argument literals
taking the form &lt;code&gt;%&lt;/code&gt;, &lt;code&gt;%n&lt;/code&gt; or &lt;code&gt;%&amp;amp;&lt;/code&gt;. &lt;code&gt;%&lt;/code&gt; is a synonym for &lt;code&gt;%1&lt;/code&gt;, &lt;code&gt;%n&lt;/code&gt; designates
the nth arg (1-based), and &lt;code&gt;%&amp;amp;&lt;/code&gt; designates a rest arg. This is not a
replacement for &lt;code&gt;fn&lt;/code&gt; - idiomatic used would be for very short one-off
mapping/filter fns and the like.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#()&lt;/code&gt; forms cannot be nested.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;what-the-patch-does&quot;&gt;What the patch does&lt;/h2&gt;

&lt;p&gt;It makes it possible to write this in Elisp:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;put&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;disabled&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;upcase-region&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;downcase-region&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;narrow-to-region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can also do this and other things that you would expect, if you&amp;#39;re
familiar with Clojure:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cl-mapcar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; are &amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;roses&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;violets&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;red&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;blue&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; =&amp;gt; (&amp;quot;roses are red&amp;quot; &amp;quot;violets are blue&amp;quot;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Or you could replace this snippet from &lt;code&gt;org-mode&lt;/code&gt;&amp;#39;s code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;member&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;matchers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nth&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;org-latex-regexps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;with this sugar-coated code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;member&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;matchers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;nth&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;org-latex-regexps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that this gets accepted, although there are some conservative
people that protest against this change.  Let me know if you would
like to have this option for your Elisp setups.  And remember that you
can try out the patch if you&amp;#39;re familiar with
&lt;a href=&quot;http://www.emacswiki.org/emacs/BuildingEmacs&quot;&gt;building Emacs from source&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Even more dired key bindings</title>
   <link href="https://oremacs.com/2015/01/21/dired-shortcuts/"/>
   <updated>2015-01-21T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/21/dired-shortcuts</id>
   <content type="html">&lt;p&gt;I&amp;#39;ve posted about &lt;code&gt;dired&lt;/code&gt; quite a few times now.  Below, I&amp;#39;ll do a
short review of the old bindings and add a few remaining recipes from
my &lt;code&gt;dired.el&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;old-stuff&quot;&gt;Old stuff&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Binding &lt;kbd&gt;r&lt;/kbd&gt; to &lt;code&gt;dired-start-process&lt;/code&gt; is covered &lt;a href=&quot;/2015/01/04/dired-nohup/&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Binding &lt;kbd&gt;e&lt;/kbd&gt; to &lt;code&gt;ediff-files&lt;/code&gt; is mentioned &lt;a href=&quot;/2015/01/17/setting-up-ediff/&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Binding &lt;kbd&gt;z&lt;/kbd&gt; to &lt;code&gt;dired-get-size&lt;/code&gt; is covered &lt;a href=&quot;/2015/01/12/dired-file-size/&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Binding &lt;kbd&gt;&amp;#96;&lt;/kbd&gt; to &lt;code&gt;dired-open-term&lt;/code&gt; is covered &lt;a href=&quot;/2015/01/10/dired-ansi-term/&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;jump-to-a-file-with-ido&quot;&gt;Jump to a file with &lt;code&gt;ido&lt;/code&gt;&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ido-find-file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I use this one quite frequently: &lt;kbd&gt;i&lt;/kbd&gt; is somehow mnemonic to
&lt;kbd&gt;C-i&lt;/kbd&gt;, which means completion.  Remember that you can select
the current candidate with &lt;kbd&gt;C-m&lt;/kbd&gt; and the current text
(usually to create a new file) with &lt;kbd&gt;C-j&lt;/kbd&gt;.&lt;/p&gt;

&lt;h2 id=&quot;move-up-and-down&quot;&gt;Move up and down&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-next-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-previous-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As I&amp;#39;ve mentioned before, this is my standard recipe for all modes
that don&amp;#39;t self-insert.&lt;/p&gt;

&lt;h2 id=&quot;flag-garbage-files&quot;&gt;Flag garbage files&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;%^&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-flag-garbage-files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Huh, I always thought this was the default binding. I have no idea
where this came from, but I use this plus &lt;kbd&gt;x&lt;/kbd&gt; to get rid of
the garbage produced by a LaTeX run:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-garbage-files-regexp&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;&amp;quot;\\.idx\\|\\.run\\.xml$\\|\\.bbl$\\|\\.bcf$\\|.blg$\\|-blx.bib$\\|.nav$\\|.snm$\\|.out$\\|.synctex.gz$\\|\\(?:\\.\\(?:aux\\|bak\\|dvi\\|log\\|orig\\|rej\\|toc\\|pyg\\)\\)\\&amp;#39;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;emacs-adaptation-of-find&quot;&gt;Emacs&amp;#39; adaptation of &lt;code&gt;find&lt;/code&gt;&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;F&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;find-name-dired&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This little function is essential if you want to do perform some
operation on all files in the current directory and its sub
directories that match a pattern. Basically the same thing that you
would do with the UNIX &lt;code&gt;find&lt;/code&gt;, just better.&lt;/p&gt;

&lt;h2 id=&quot;ignore-unimportant-files&quot;&gt;Ignore unimportant files&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-omit-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will toggle the display of unimportant files, like:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-omit-files&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\(?:.*\\.\\(?:aux\\|log\\|synctex\\.gz\\|run\\.xml\\|bcf\\|am\\|in\\)\\&amp;#39;\\)\\|^\\.\\|-blx\\.bib&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;move-to-the-parent-directory&quot;&gt;Move to the parent directory&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-alternate-file&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;..&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There probably is a default function that does this. I&amp;#39;ve been using
this one for years, probably because it reuses the current &lt;code&gt;dired&lt;/code&gt;
buffer of opening the parent directory.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;Phew, that&amp;#39;s a lot of bindings. I don&amp;#39;t necessarily encourage you to
use the same bindings as me; I just want to bring your attention to
some of these functions, so that you can work them into your workflow.
If you notice that I&amp;#39;m using some obsolete stuff, do let me know, I&amp;#39;m
always looking to improve.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Behold The Mighty Hydra!</title>
   <link href="https://oremacs.com/2015/01/20/introducing-hydra/"/>
   <updated>2015-01-20T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/20/introducing-hydra</id>
   <content type="html">&lt;p&gt;I managed to spike a lot of interest for sticky key bindings in my earlier post,
&lt;a href=&quot;/2015/01/14/repeatable-commands/&quot;&gt;Zoom in/out with style&lt;/a&gt;.
So now, I&amp;#39;ve refactored this method into a convenient library
&lt;a href=&quot;https://github.com/abo-abo/hydra&quot;&gt;hydra.el&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/Hydra.png&quot; alt=&quot;hydra&quot;&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-concept&quot;&gt;The Concept&lt;/h2&gt;

&lt;p&gt;This package can be used to tie related functions into a family of
short bindings with a common prefix - a Hydra.&lt;/p&gt;

&lt;p&gt;Once you summon the Hydra through the prefixed binding (the body + any
one head), all heads can be called in succession with only a short
extension.&lt;/p&gt;

&lt;p&gt;The Hydra is vanquished once Hercules, any binding that isn&amp;#39;t the
Hydra&amp;#39;s head, arrives.  Note that Hercules, besides vanquishing the
Hydra, will still serve his orignal purpose, calling his proper
command.  This makes the Hydra very seamless, it&amp;#39;s like a minor mode
that disables itself auto-magically.&lt;/p&gt;

&lt;h2 id=&quot;an-example&quot;&gt;An Example&lt;/h2&gt;

&lt;p&gt;This code will accomplish the task of the previous post:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-create&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f2&amp;gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-increase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-decrease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now, &lt;kbd&gt;&amp;lt;f2&amp;gt;&lt;/kbd&gt; is the Hydra&amp;#39;s body: you need to press it
only once, together with one of the heads (&lt;kbd&gt;g&lt;/kbd&gt; or
&lt;kbd&gt;l&lt;/kbd&gt;), to summon the Hydra.&lt;/p&gt;

&lt;p&gt;Afterwards, you can call the heads in succession without the body
prefix, i.e. &lt;kbd&gt;&amp;lt;f2&amp;gt; g g g l&lt;/kbd&gt; will work.  To vanquish the
Hydra, just call up Hercules: &lt;strong&gt;any&lt;/strong&gt; key binding that&amp;#39;s not
&lt;kbd&gt;g&lt;/kbd&gt; or &lt;kbd&gt;l&lt;/kbd&gt;, e.g. &lt;kbd&gt;C-f&lt;/kbd&gt; or whatever you
wanted to do.&lt;/p&gt;

&lt;p&gt;Note that you can still assign an unrelated binding to
e.g. &lt;kbd&gt;&amp;lt;f2&amp;gt; f&lt;/kbd&gt;: the Hydra &lt;em&gt;does not&lt;/em&gt; take over
&lt;kbd&gt;&amp;lt;f2&amp;gt;&lt;/kbd&gt;, only over &lt;kbd&gt;&amp;lt;f2&amp;gt; l&lt;/kbd&gt; and
&lt;kbd&gt;&amp;lt;f2&amp;gt; g&lt;/kbd&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-infrastructure&quot;&gt;The Infrastructure&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;hydra-create&lt;/code&gt; will create new interactive functions for you with the proper docstrings:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;hydra-&amp;lt;f2&amp;gt;-text-scale-increase is an interactive Lisp function.&lt;/p&gt;

&lt;p&gt;It is bound to &amp;lt;f2&amp;gt; g.&lt;/p&gt;

&lt;p&gt;(hydra-&amp;lt;f2&amp;gt;-text-scale-increase)&lt;/p&gt;

&lt;p&gt;Create a hydra with a &amp;quot;&amp;lt;f2&amp;gt;&amp;quot; body and the heads:&lt;/p&gt;

&lt;p&gt;&amp;quot;g&amp;quot;:    &lt;code&gt;text-scale-increase&lt;/code&gt;,&lt;/p&gt;
&amp;quot;l&amp;quot;:    &lt;code&gt;text-scale-decrease&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Call the head: &lt;code&gt;text-scale-increase&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;an-exciting-new-hydra-move-window-splitter&quot;&gt;An exciting new Hydra: move window splitter&lt;/h2&gt;

&lt;p&gt;Zooming is old news, Hydra bundles a new application:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;hydra-examples&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-create&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-o&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-example-move-window-splitter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or in the expanded form (equivalent):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hydra-create&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-o&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-up&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;hydra-move-splitter-right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will allow you to move the window splitter, after you issue
&lt;kbd&gt;C-x 2&lt;/kbd&gt; or &lt;kbd&gt;C-x 3&lt;/kbd&gt; one or more times, with
e.g. &lt;kbd&gt;C-M-o&lt;/kbd&gt; &lt;kbd&gt;h h j k j l k l h&lt;/kbd&gt;.  You can, of
course, customize both the body and the heads of this Hydra to your
preferences.&lt;/p&gt;

&lt;p&gt;The docstrings for this Hydra look more impressive, too:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;hydra-C-M-o-move-splitter-up is an interactive Lisp function.&lt;/p&gt;

&lt;p&gt;It is bound to C-M-o k.&lt;/p&gt;

&lt;p&gt;(hydra-C-M-o-move-splitter-up)&lt;/p&gt;

&lt;p&gt;Create a hydra with a &amp;quot;C-M-o&amp;quot; body and the heads:&lt;/p&gt;

&lt;p&gt;&amp;quot;h&amp;quot;:    &lt;code&gt;hydra-move-splitter-left&lt;/code&gt;,&lt;/p&gt;
&amp;quot;j&amp;quot;:    &lt;code&gt;hydra-move-splitter-down&lt;/code&gt;,&lt;/p&gt;
&amp;quot;k&amp;quot;:    &lt;code&gt;hydra-move-splitter-up&lt;/code&gt;,&lt;/p&gt;
&amp;quot;l&amp;quot;:    &lt;code&gt;hydra-move-splitter-right&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Call the head: &lt;code&gt;hydra-move-splitter-up&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;I hope that you enjoy the new library and let me know when you invent
some novel and efficient Hydras. Happy hacking!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>lispy 0.21.0 is out</title>
   <link href="https://oremacs.com/2015/01/19/lispy.0.21.0-is-out/"/>
   <updated>2015-01-19T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/19/lispy.0.21.0-is-out</id>
   <content type="html">&lt;p&gt;The last release was more than a month ago, and there have been more
than 130 commits to master since then. Somehow, I&amp;#39;ve been dragging my
feet with this release: the (3 pages of)
&lt;a href=&quot;https://github.com/abo-abo/lispy/releases/tag/0.21.0&quot;&gt;release notes&lt;/a&gt;
were in the draft stage for 10 days now, while I kept committing on
top of them.&lt;/p&gt;

&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;

&lt;p&gt;This project is my vision of efficient LISP editing. According to
Github, I started it more than a year ago, although the initial commit
already contained around 1000 lines of code. After a year, it&amp;#39;s more
than 100 interactive commands in 5000 lines of code and 1000 lines of
tests.&lt;/p&gt;

&lt;p&gt;Initially, I started the project because, while I wanted to learn
Paredit to get more efficient, I did not want to learn Paredit&amp;#39;s
cumbersome bindings. Having established a skeleton that allows to call
Paredit-like commands with plain letters, over time, I&amp;#39;ve tacked on
anything LISP-related here. In this way, it&amp;#39;s very similar to
&lt;code&gt;org-mode&lt;/code&gt;, which starts with an outline and TODO skeleton, and then
adds everything else in the world on top of that. Heck, I actually
tacked on &lt;code&gt;org-mode&lt;/code&gt;&amp;#39;s outline features on top of &lt;code&gt;lispy&lt;/code&gt;: when at an
outline, &lt;kbd&gt;i&lt;/kbd&gt; is equivalent to &lt;code&gt;org-mode&lt;/code&gt;&amp;#39;s &lt;kbd&gt;TAB&lt;/kbd&gt;, and
&lt;kbd&gt;I&lt;/kbd&gt; is equivalent to &lt;kbd&gt;S-tab&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Among the other packages with which &lt;code&gt;lispy&lt;/code&gt;
integrates/cooperates/coexists are: &lt;code&gt;edebug&lt;/code&gt;, &lt;code&gt;ediff&lt;/code&gt;, &lt;code&gt;eldoc&lt;/code&gt;, &lt;code&gt;ert&lt;/code&gt;,
&lt;code&gt;outline&lt;/code&gt;, &lt;code&gt;semantic&lt;/code&gt;, &lt;code&gt;semantic/db&lt;/code&gt;, &lt;code&gt;ace-jump-mode&lt;/code&gt;, &lt;code&gt;iedit&lt;/code&gt;,
&lt;code&gt;delsel&lt;/code&gt;, &lt;code&gt;helm&lt;/code&gt;, &lt;code&gt;multiple-cursors&lt;/code&gt;, &lt;code&gt;fancy-narrow&lt;/code&gt;, &lt;code&gt;projectile&lt;/code&gt;,
&lt;code&gt;god-mode&lt;/code&gt;, &lt;code&gt;auto-complete&lt;/code&gt;, &lt;code&gt;company&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;main-idea-behind-lispy&quot;&gt;Main idea behind &lt;code&gt;lispy&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;The idea is to have plain letters, like &lt;kbd&gt;h&lt;/kbd&gt; or &lt;kbd&gt;r&lt;/kbd&gt;,
call commands instead of self-inserting, but &lt;strong&gt;only if the point
position is such that you wouldn&amp;#39;t want to self-insert anyway&lt;/strong&gt;.  When
this situation occurs, I like to say &lt;a href=&quot;#evolution-of-special&quot;&gt;&amp;quot;the point is special&amp;quot;&lt;/a&gt;; this
shortcut is all over the code and the docs.&lt;/p&gt;

&lt;p&gt;This is a bit similar to &lt;code&gt;vi&lt;/code&gt;&amp;#39;s normal/insert states, but instead of
&amp;quot;holding&amp;quot; the current state in your head, it&amp;#39;s visible through &lt;em&gt;just
the point position&lt;/em&gt;.  And instead of having just the
&lt;kbd&gt;Esc&lt;/kbd&gt;/&lt;kbd&gt;i&lt;/kbd&gt; combination to toggle normal/insert state,
you can do it with &lt;strong&gt;any&lt;/strong&gt; command that moves point,
e.g. &lt;kbd&gt;C-f&lt;/kbd&gt;, or &lt;kbd&gt;C-a&lt;/kbd&gt;, or even any custom command
that you write. &lt;code&gt;lispy&lt;/code&gt; does provide &lt;kbd&gt;[&lt;/kbd&gt;, &lt;kbd&gt;]&lt;/kbd&gt;, and
&lt;kbd&gt;C-3&lt;/kbd&gt; key bindings for getting into special, but you are free
to use any other binding or command that you want.&lt;/p&gt;

&lt;p&gt;For instance, starting from this code and point position (which is already special):&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;cursor&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;/cursor&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;you can move to the &lt;code&gt;when&lt;/code&gt; statement with &lt;kbd&gt;h&lt;/kbd&gt; (&lt;code&gt;lispy-right&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;cursor&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;/cursor&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;or you can remove the &lt;code&gt;when&lt;/code&gt; statement altogether with &lt;kbd&gt;r&lt;/kbd&gt; (&lt;code&gt;lispy-raise&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;cursor&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;/cursor&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;or you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;evaluate &lt;code&gt;(setq arg 2000)&lt;/code&gt; statement with &lt;kbd&gt;e&lt;/kbd&gt; (&lt;code&gt;lispy-eval&lt;/code&gt;); the result will be displayed in the echo area; works for multiple LISP dialects&lt;/li&gt;
&lt;li&gt;evaluate and insert with &lt;kbd&gt;E&lt;/kbd&gt; (&lt;code&gt;lispy-eval-and-insert&lt;/code&gt;); the actual value &lt;code&gt;2000&lt;/code&gt; will be inserted below the expression&lt;/li&gt;
&lt;li&gt;evaluate and replace with &lt;kbd&gt;xr&lt;/kbd&gt; (&lt;code&gt;lispy-eval-and-replace&lt;/code&gt;); the expression will be replaced with &lt;code&gt;2000&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;copy the statement to the kill ring with &lt;kbd&gt;n&lt;/kbd&gt; (&lt;code&gt;lispy-new-copy&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;delete the statement with &lt;kbd&gt;C-d&lt;/kbd&gt; (&lt;code&gt;lispy-delete&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;insert a copy of the statement below with &lt;kbd&gt;c&lt;/kbd&gt; (&lt;code&gt;lispy-clone&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;insert 3 copies of the statement below with &lt;kbd&gt;3c&lt;/kbd&gt; (&lt;code&gt;digit-argument&lt;/code&gt;, &lt;code&gt;lispy-clone&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;move the statement on the previous line with &lt;kbd&gt;DEL&lt;/kbd&gt; (&lt;code&gt;lispy-delete-backward&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;mark the statement with &lt;kbd&gt;m&lt;/kbd&gt; (&lt;code&gt;lispy-mark-list&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;mark only &lt;code&gt;arg&lt;/code&gt; with &lt;kbd&gt;2m&lt;/kbd&gt; (&lt;code&gt;digit-argument&lt;/code&gt;, &lt;code&gt;lispy-mark-list&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;get help for &lt;code&gt;setq&lt;/code&gt; with &lt;kbd&gt;xh&lt;/kbd&gt; (&lt;code&gt;lispy-describe&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;get help for &lt;code&gt;arg&lt;/code&gt; with &lt;kbd&gt;2mxh&lt;/kbd&gt; (&lt;code&gt;digit-argument&lt;/code&gt;, &lt;code&gt;lispy-mark-list&lt;/code&gt;, &lt;code&gt;lispy-describe&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;copy &lt;code&gt;2000&lt;/code&gt; to kill ring with &lt;kbd&gt;3mn&lt;/kbd&gt; (&lt;code&gt;digit-argument&lt;/code&gt;, &lt;code&gt;lispy-mark-list&lt;/code&gt;, &lt;code&gt;lispy-new-copy&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;move the statement outside of &lt;code&gt;when&lt;/code&gt; with &lt;kbd&gt;oh&lt;/kbd&gt; (&lt;code&gt;lispy-other&lt;/code&gt;, &lt;code&gt;lispy-left&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;swap &lt;code&gt;(= arg 0)&lt;/code&gt; with &lt;code&gt;(setq arg 2000)&lt;/code&gt; with &lt;kbd&gt;w&lt;/kbd&gt; (&lt;code&gt;lispy-move-up&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;move it back with &lt;kbd&gt;s&lt;/kbd&gt; (&lt;code&gt;lispy-move-down&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;put the whole &lt;code&gt;when&lt;/code&gt; expression on one line with &lt;kbd&gt;hO&lt;/kbd&gt; (&lt;code&gt;lispy-left&lt;/code&gt;, &lt;code&gt;lispy-oneline&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;narrow the buffer to current sexp with &lt;kbd&gt;N&lt;/kbd&gt; (&lt;code&gt;lispy-narrow&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;widen the buffer with &lt;kbd&gt;W&lt;/kbd&gt; (&lt;code&gt;lispy-widen&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;a lot of other things, there are 52 plain letters, after all&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note that in the following code, the point is not special:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;wh&lt;cursor&gt;e&lt;/cursor&gt;n&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;so if you would type &lt;kbd&gt;h&lt;/kbd&gt;, it would not call &lt;code&gt;lispy-left&lt;/code&gt;, but would insert &amp;quot;h&amp;quot; instead, yielding &lt;code&gt;whhen&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;to get the point into special before &lt;code&gt;(when&lt;/code&gt;, you can use either &lt;kbd&gt;C-a&lt;/kbd&gt; or &lt;kbd&gt;&amp;#91;&lt;/kbd&gt; or &lt;kbd&gt;C-M-a&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;to get the point into special after &lt;code&gt;arg 0)&lt;/code&gt;, you can use either &lt;kbd&gt;C-e&lt;/kbd&gt; or &lt;kbd&gt;&amp;#93;&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;to get the point into special after &lt;code&gt;2000))&lt;/code&gt;, you can use &lt;kbd&gt;C-3&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;evolution-of-special&quot;&gt;Evolution of special&lt;/h2&gt;

&lt;p&gt;Initially, the special state was only for the point before an open
paren or after a close paren, since you almost never-ever want to
insert characters at those positions. Over time, other point states
were added to special:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;region is active (supersedes
&lt;a href=&quot;https://github.com/magnars/expand-region.el&quot;&gt;expand-region&lt;/a&gt; for LISP
dialects)&lt;/li&gt;
&lt;li&gt;the point is at the start of a comment&lt;/li&gt;
&lt;li&gt;the point is at the start of an outline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Region selection is especially important, since it is super-useful for
manipulating (move, copy, eval, get-help, goto-definition) symbols
inside lists. Since these symbols aren&amp;#39;t delimited with parens, the
only way to get to them with special is though region selection.&lt;/p&gt;

&lt;p&gt;Happily, region selection will fix the largest source of Paredit
unbalanced paren errors: while using &lt;code&gt;lispy&lt;/code&gt; region-manipulating
commands, you can&amp;#39;t copy an unbalanced expression, and thus you can&amp;#39;t
yank an unbalanced expression. You just have to use &lt;kbd&gt;m&lt;/kbd&gt; and
&lt;kbd&gt;M-m&lt;/kbd&gt; instead of &lt;kbd&gt;C-SPC&lt;/kbd&gt;; and &lt;kbd&gt;h&lt;/kbd&gt;,
&lt;kbd&gt;j&lt;/kbd&gt;, &lt;kbd&gt;k&lt;/kbd&gt;, &lt;kbd&gt;l&lt;/kbd&gt;, &lt;kbd&gt;i&lt;/kbd&gt;,
&lt;kbd&gt;&amp;gt;&lt;/kbd&gt;, and &lt;kbd&gt;&amp;lt;&lt;/kbd&gt; instead of e.g. &lt;kbd&gt;C-f&lt;/kbd&gt; and
&lt;kbd&gt;M-f&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Since there are only 26 lower-case letters and 26 upper-case letters,
the state of the command bindings in &lt;code&gt;lispy&lt;/code&gt; quickly turned into
&lt;em&gt;survival of the fittest&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the commands that were used the most got the priority bindings of
lower case letters on the home row&lt;/li&gt;
&lt;li&gt;the second tier got the other lower-case bindings&lt;/li&gt;
&lt;li&gt;the third tier of commands were put on upper-case letters and on
&lt;kbd&gt;x&lt;/kbd&gt; + lower-case letters&lt;/li&gt;
&lt;li&gt;the fourth tier of commands are not bound at all, and I&amp;#39;m
considering to obsolete some of them, just to keep things simpler.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;add-the-annoyance-driven-development&quot;&gt;ADD: the Annoyance-Driven Development&lt;/h2&gt;

&lt;p&gt;The other part of evolving and refining the commands, consisted of
noticing small annoyances for when some generic command wasn&amp;#39;t working
as intended, or it was working in a sub-optimal way in a certain
situation. After this, I would fix the command and put a test on it,
to make sure that the annoyance does not surface in the future.&lt;/p&gt;

&lt;h2 id=&quot;notes-on-lisp-dialects&quot;&gt;Notes on LISP dialects&lt;/h2&gt;

&lt;p&gt;My priority is Elisp, since that&amp;#39;s what I&amp;#39;m using to implement
&lt;code&gt;lispy&lt;/code&gt;, but the following dialects are also supported:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clojure, via &lt;a href=&quot;https://github.com/clojure-emacs/cider&quot;&gt;CIDER&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Common Lisp, via &lt;a href=&quot;https://github.com/slime/slime&quot;&gt;SLIME&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Scheme, via &lt;a href=&quot;https://github.com/jaor/geiser&quot;&gt;Geiser&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To be supported, all a LISP dialect needs is just to use &lt;code&gt;(&lt;/code&gt; or &lt;code&gt;{&lt;/code&gt; or
&lt;code&gt;[&lt;/code&gt; as the opening delimiter; and &lt;code&gt;)&lt;/code&gt; or &lt;code&gt;}&lt;/code&gt; or &lt;code&gt;]&lt;/code&gt; as the closing
delimiter, no actual adaptations in the &lt;code&gt;lispy&lt;/code&gt; code are necessary.&lt;/p&gt;

&lt;p&gt;The only thing that needs to be implemented on a per-dialect basis is
the language-specific eval:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;e&lt;/kbd&gt; (&lt;code&gt;lispy-eval&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;E&lt;/kbd&gt; (&lt;code&gt;lispy-eval-and-insert&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;xr&lt;/kbd&gt; (&lt;code&gt;lispy-eval-and-replace&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;xj&lt;/kbd&gt; (&lt;code&gt;lispy-debug-step-in&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also, though the jump-to-definition functionality could be implemented
via CEDET, environments like SLIME can do it much better, so
&lt;kbd&gt;F&lt;/kbd&gt; (&lt;code&gt;lispy-follow&lt;/code&gt;) and &lt;kbd&gt;M-.&lt;/kbd&gt; (&lt;code&gt;lispy-goto-symbol&lt;/code&gt;) use the
appropriate environment&amp;#39;s facilities. Somehow, I still haven&amp;#39;t managed
to implement this for Geiser.&lt;/p&gt;

&lt;h2 id=&quot;drinking-from-the-lispy-fire-hose&quot;&gt;Drinking from the &lt;code&gt;lispy&lt;/code&gt; fire hose&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ll get you started with the most basic and composable commands
below.  You can find the rest in the
&lt;a href=&quot;http://oremacs.com/lispy/&quot;&gt;function reference&lt;/a&gt; or by just calling
&lt;kbd&gt;xv&lt;/kbd&gt; (&lt;code&gt;lispy-view-test&lt;/code&gt;) on &lt;code&gt;should&lt;/code&gt; statements of
&lt;a href=&quot;https://github.com/abo-abo/lispy/blob/master/lispy-test.el&quot;&gt;lispy-test.el&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/lispy-view-test.png&quot; alt=&quot;sample-test&quot;&gt;&lt;/p&gt;

&lt;p&gt;In the screenshot above, I start with the code and point position on
the top. Then, after typing &lt;kbd&gt;miji&lt;/kbd&gt;, I should end up with the
state below: the point and mark position have moved. In this
particular situation, I could follow-up with &lt;kbd&gt;e&lt;/kbd&gt; to see the
value of &lt;code&gt;auto-mode-alist&lt;/code&gt;. Here&amp;#39;s how to decipher &lt;kbd&gt;miji&lt;/kbd&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;m&lt;/kbd&gt; - &lt;code&gt;lispy-mark-list&lt;/code&gt;: marks current expression&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;i&lt;/kbd&gt; - &lt;code&gt;lispy-tab&lt;/code&gt; (mnemonic for &lt;em&gt;indent&lt;/em&gt; or &lt;em&gt;inner&lt;/em&gt;): marks the &lt;code&gt;car&lt;/code&gt; of current expression&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;j&lt;/kbd&gt; - &lt;code&gt;lispy-down&lt;/code&gt; (vi shortcut to move down): moves the point and mark down by one sexp, selecting the quoted expression&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;i&lt;/kbd&gt; - &lt;code&gt;lispy-tab&lt;/code&gt;: selects the &lt;code&gt;car&lt;/code&gt; of the quoted expression, i.e. &lt;code&gt;auto-mode-alist&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you see from the screenshot, I have &lt;code&gt;show-paren-mode&lt;/code&gt; always
on. It&amp;#39;s even on in the tests visualization!&lt;/p&gt;

&lt;h2 id=&quot;the-most-basic-lispy-commands-the-arrows&quot;&gt;The most basic &lt;code&gt;lispy&lt;/code&gt; commands: the arrows&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;h&lt;/kbd&gt; is left&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;j&lt;/kbd&gt; is down&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;k&lt;/kbd&gt; is up&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;l&lt;/kbd&gt; is right&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The directions are literal only if you have your code properly
indented, with newlines after each sexp. Otherwise, it may be the case
that &lt;kbd&gt;j&lt;/kbd&gt; moves literally right, instead of down; still, it&amp;#39;s
down figuratively.&lt;/p&gt;

&lt;h3 id=&quot;arrows-like-digits&quot;&gt;arrows like digits&lt;/h3&gt;

&lt;p&gt;All of them take digit arguments, so that e.g. &lt;kbd&gt;5j&lt;/kbd&gt; is equivalent to &lt;kbd&gt;jjjjj&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;&lt;kbd&gt;h&lt;/kbd&gt; and &lt;kbd&gt;j&lt;/kbd&gt; maintain the guarantee of not exiting the
current list, so you can use e.g. &lt;kbd&gt;99j&lt;/kbd&gt; to move to the last
element, if your list length is smaller than 99.&lt;/p&gt;

&lt;h3 id=&quot;arrows-like-regions&quot;&gt;arrows like regions&lt;/h3&gt;

&lt;p&gt;When the region is active, the arrows move the mark appropriately with
the point. You can activate and deactivate the region by repeatedly
pressing &lt;kbd&gt;m&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;You can also mark a symbol with &lt;kbd&gt;M-m&lt;/kbd&gt;
(&lt;code&gt;lispy-mark-symbol&lt;/code&gt;). There&amp;#39;s no need to be in special for this
command to work. I call these type of bindings &lt;em&gt;global&lt;/em&gt;, while the
bindings that only work in special I call &lt;em&gt;local&lt;/em&gt;.&lt;/p&gt;

&lt;h3 id=&quot;arrows-like-outlines&quot;&gt;arrows like outlines&lt;/h3&gt;

&lt;p&gt;When located at the outline, &lt;kbd&gt;j&lt;/kbd&gt; will call
&lt;code&gt;outline-next-visible-heading&lt;/code&gt;, and &lt;kbd&gt;k&lt;/kbd&gt; will call
&lt;code&gt;outline-previous-visible-heading&lt;/code&gt;. &lt;kbd&gt;l&lt;/kbd&gt; will move to the
first list of the outline, while &lt;kbd&gt;h&lt;/kbd&gt; will jump between the
top-level sexp and the containing outline.&lt;/p&gt;

&lt;h3 id=&quot;switching-to-a-different-side-of-the-expression&quot;&gt;switching to a different side of the expression&lt;/h3&gt;

&lt;p&gt;Arrows can&amp;#39;t do this easily; this can instead be done with
&lt;kbd&gt;d&lt;/kbd&gt; (&lt;code&gt;lispy-different&lt;/code&gt;). Works for lists and regions.&lt;/p&gt;

&lt;h2 id=&quot;moving-the-code-instead-of-moving-around-the-code&quot;&gt;Moving the code instead of moving around the code&lt;/h2&gt;

&lt;p&gt;The most basic commands are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;w&lt;/kbd&gt; is &lt;code&gt;lispy-move-up&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;s&lt;/kbd&gt; is &lt;code&gt;lispy-move-down&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These will &amp;quot;hold on&amp;quot; to the current expression while moving it in the
appropriate direction. There&amp;#39;s no need to worry to mess up with them,
since they cancel each other out perfectly.&lt;/p&gt;

&lt;p&gt;Note that, just like with the arrows, if you don&amp;#39;t have an opening or
closing delimiter to &amp;quot;grab&amp;quot;, you can mark a symbol &lt;kbd&gt;M-m&lt;/kbd&gt; to
be in special and use &lt;kbd&gt;w&lt;/kbd&gt; / &lt;kbd&gt;s&lt;/kbd&gt;.&lt;/p&gt;

&lt;h2 id=&quot;modified-arrows-can-move-too&quot;&gt;Modified arrows can move too&lt;/h2&gt;

&lt;p&gt;&lt;kbd&gt;o&lt;/kbd&gt; will modify the arrow keys temporarily, just for one
command, with a minor mode. You can think of it as making the arrows
move the point &lt;strong&gt;and&lt;/strong&gt; the sexp in the usual direction, instead of
moving just the point.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;ol&lt;/kbd&gt;: move current sexp outside of the parent list, forwards&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;oh&lt;/kbd&gt;: move current sexp outside of the parent list, backwards&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;oj&lt;/kbd&gt;: move current sexp inside the next list, making it the first element&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;ok&lt;/kbd&gt;: move current sexp inside the preceding list, making it the last element&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;extending-or-shrinking-the-current-list-or-region&quot;&gt;Extending or shrinking the current list or region&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;&amp;gt;&lt;/kbd&gt; (&lt;code&gt;lispy-slurp&lt;/code&gt;) grows the current list or region in the current direction by one sexp&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;&amp;lt;&lt;/kbd&gt; (&lt;code&gt;lispy-barf&lt;/code&gt;) shrinks the current list or region in the current direction by one sexp&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Similarly to &lt;kbd&gt;j&lt;/kbd&gt; and &lt;kbd&gt;k&lt;/kbd&gt;, these commands maintain
the guarantee of not exiting the parent list, so you can slurp until
the end of the list with e.g. &lt;kbd&gt;99&amp;gt;&lt;/kbd&gt;.&lt;/p&gt;

&lt;h2 id=&quot;outro&quot;&gt;Outro&lt;/h2&gt;

&lt;p&gt;This project is very far from being final, I&amp;#39;m expecting to reach
&lt;code&gt;0.99.0&lt;/code&gt; before getting to &lt;code&gt;1.0.0&lt;/code&gt;. The reason is that the package
aims to build intuition to the point of automation. For each small
step in that direction, every small bug is two steps back, since it
breaks the process of building intuition. So every possible situation
needs to be tested and bugs fixed until the package is finally ironed
out.&lt;/p&gt;

&lt;p&gt;While I do appreciate the
&lt;a href=&quot;https://github.com/abo-abo/lispy/stargazers&quot;&gt;stars&lt;/a&gt;, actually trying
to do things with &lt;code&gt;lispy&lt;/code&gt; and raising
&lt;a href=&quot;https://github.com/abo-abo/lispy/issues&quot;&gt;issues&lt;/a&gt; would help me a
great deal more. For instance, if you raise an issue like&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How can I generate a function call right after the function definition?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I would say to just use &lt;kbd&gt;2mcol(&lt;/kbd&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mark the function name with &lt;kbd&gt;2m&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;clone region with &lt;kbd&gt;c&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;move region outside the function body with &lt;kbd&gt;ol&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;wrap the region with parens while deactivating it with &lt;kbd&gt;(&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And this would be a sort of FAQ question / recipe already done there.&lt;/p&gt;

&lt;p&gt;Or you could raise an issue like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why doesn&amp;#39;t &lt;kbd&gt;F&lt;/kbd&gt; work for Racket?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I would say it&amp;#39;s because I haven&amp;#39;t implemented it yet, since it was
tricky.  But I&amp;#39;ll get to it, now that I see that there&amp;#39;s some interest
in &lt;code&gt;lispy&lt;/code&gt; from Racket users.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Sprucing up org-download</title>
   <link href="https://oremacs.com/2015/01/18/sprucing-up-org-download/"/>
   <updated>2015-01-18T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/18/sprucing-up-org-download</id>
   <content type="html">&lt;p&gt;My interest in &lt;a href=&quot;https://github.com/abo-abo/org-download&quot;&gt;org-download&lt;/a&gt;
was renewed today with
&lt;a href=&quot;http://thread.gmane.org/gmane.emacs.orgmode/93964&quot;&gt;this thread&lt;/a&gt; on
&lt;code&gt;org-mode&lt;/code&gt;&amp;#39;s mailing list.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;org-download&lt;/code&gt; allows you to drag-and-drop an image from e.g. Firefox
or your own file system to an &lt;code&gt;org-mode&lt;/code&gt; buffer. When I originally
wrote it, I was taking a Chemistry course on
&lt;a href=&quot;https://www.edx.org/&quot;&gt;edX&lt;/a&gt;, which included homework and exams with a
lot of images. Doing the homework in a literate style with &lt;code&gt;org-mode&lt;/code&gt;,
I wanted the problems to be completely self-contained, and for that I
needed to save all the images from the website, preferably quickly, to
an &lt;code&gt;org-mode&lt;/code&gt; buffer. With a few hacks and some advice and
contributions from more experienced hackers, &lt;code&gt;org-download&lt;/code&gt; came to
be.&lt;/p&gt;

&lt;h2 id=&quot;todays-commits&quot;&gt;Today&amp;#39;s commits&lt;/h2&gt;

&lt;p&gt;The main contribution from today&amp;#39;s commits was adding the code that
un-aliases images that point to HTML. I see a lot of these from the
people that I&amp;#39;m following on my Twitter,
&lt;a href=&quot;https://twitter.com/_abo_abo&quot;&gt;@&amp;#95;abo&amp;#95;abo&lt;/a&gt;. Here&amp;#39;s the code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-download-img-regex-list&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;img +src=\&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;img +\\(class=\&amp;quot;[^\&amp;quot;]+\&amp;quot;\\)? *src=\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;This regex is used to unalias links that look like images.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;The html to which the links points will be searched for these&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;regexes, one by one, until one succeeds.  The found image address&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;will be used.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:group&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;org-download&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and in &lt;code&gt;(org-download-image link)&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;image-type-from-file-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;with-current-buffer&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;url-retrieve-synchronously&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;regexes&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-download-img-regex-list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;lnk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lnk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;regexes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pop&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;regexes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lnk&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;current-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lnk&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lnk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;link %s does not point to an image&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;image-type-from-file-name&lt;/code&gt; is a built-in from &lt;code&gt;image.el&lt;/code&gt; that
decides if &lt;code&gt;link&lt;/code&gt; looks like an image file or not.&lt;/p&gt;

&lt;p&gt;As you can see, since I intend to use &lt;code&gt;link&lt;/code&gt; right after to be
transformed right now, I&amp;#39;m using &lt;code&gt;url-retrieve-synchronously&lt;/code&gt;, instead
of the asynchronous &lt;code&gt;url-retrieve&lt;/code&gt;. The other one is used by default
to download the actual image.&lt;/p&gt;

&lt;p&gt;Note the use of the &lt;code&gt;while&lt;/code&gt; / &lt;code&gt;pop&lt;/code&gt; combination for traversing a list.
I&amp;#39;ve seen it used in some places in the Emacs core, and I think it&amp;#39;s
pretty neat.&lt;/p&gt;

&lt;p&gt;Arranging the regular expressions into a list is necessary to give
priority to some regexes. For instance, the first element of
&lt;code&gt;org-download-img-regex-list&lt;/code&gt; should match e.g. an actual referred
image on Twitter, while the second element will match at least a
profile picture in the case when there is no referred image.&lt;/p&gt;

&lt;h2 id=&quot;visual-demo&quot;&gt;Visual demo&lt;/h2&gt;

&lt;p&gt;I think that I might have over-engineered the custom options of
&lt;code&gt;org-download&lt;/code&gt; a bit. Just to keep you motivated enough to figure them
out, here&amp;#39;s a link to
&lt;a href=&quot;https://www.youtube.com/watch?v=dAojpHR-6Uo&quot;&gt;a Youtube demo&lt;/a&gt; of the
fast clickety-clicking (the mouse usage), that comes after some
clackety-clacking (the customization).&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Setting up Ediff</title>
   <link href="https://oremacs.com/2015/01/17/setting-up-ediff/"/>
   <updated>2015-01-17T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/17/setting-up-ediff</id>
   <content type="html">&lt;p&gt;Once you make Ediff bearable, it becomes wonderful.  At least this was
my experience. It&amp;#39;s a very good tool, but some of the defaults look
very poor to me.&lt;/p&gt;

&lt;h2 id=&quot;customizing-the-customize&quot;&gt;Customizing the &lt;code&gt;customize&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;First of all, I&amp;#39;ll list a macro that I&amp;#39;ve started to use for setting
custom variables:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defmacro&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;csetq&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;variable&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;funcall&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;,variable&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;custom-set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;ss&quot;&gt;&amp;#39;set-default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;ss&quot;&gt;&amp;#39;,variable&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This macro I&amp;#39;ve put together myself after searching though the code
base and not finding something similar; &lt;code&gt;custom-set-variables&lt;/code&gt; comes
close to what I want, or maybe &lt;code&gt;custom-initialize-changed&lt;/code&gt;.  Basically
all I want is a &lt;code&gt;setq&lt;/code&gt; that is aware of the &lt;code&gt;custom-set&lt;/code&gt; property of a
variable. If you know such a macro, please let me know.&lt;/p&gt;

&lt;h2 id=&quot;changing-some-ediff-options&quot;&gt;Changing some Ediff options&lt;/h2&gt;

&lt;p&gt;Now, that I&amp;#39;ve explained the custom setter (by the way, using
&lt;code&gt;custom-set-variables&lt;/code&gt; is absolutely equivalent to &lt;code&gt;csetq&lt;/code&gt;), here are
my changes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Don&amp;#39;t use the weird setup with the control panel in a separate
frame.  I can manage windows in Emacs much better than my desktop
(Unity or Gnome Shell) can manage the Emacs frames.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;(csetq ediff-window-setup-function &amp;#39;ediff-setup-windows-plain)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Split the windows horizontally instead of vertically. This way, it&amp;#39;s
much easier to follow the changes.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;(csetq ediff-split-window-function &amp;#39;split-window-horizontally)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ignore white space. I don&amp;#39;t write a lot of Python, so I don&amp;#39;t care
about the white space in the diffs. At the same time, I re-format any
LISP code that I edit to my liking, and I want to see only the
important changes in the diff, and not the whitespace nonsense.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;(csetq ediff-diff-options &amp;quot;-w&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;changing-some-ediff-key-bindings&quot;&gt;Changing some Ediff key bindings&lt;/h2&gt;

&lt;p&gt;This is just the standard stuff that I like to do for each mode that
does not self-insert: assign &lt;kbd&gt;j&lt;/kbd&gt; to move down, and
&lt;kbd&gt;k&lt;/kbd&gt; to move up.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ora-ediff-hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ediff-setup-keymap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ediff-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ediff-next-difference&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ediff-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ediff-previous-difference&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ediff-mode-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ora-ediff-hook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;restoring-the-windows-after-ediff-quits&quot;&gt;Restoring the windows after Ediff quits&lt;/h2&gt;

&lt;p&gt;When you quit an Ediff session with &lt;kbd&gt;q&lt;/kbd&gt;, it just leaves the
two diff windows around, instead of restoring the window configuration
from when Ediff was started. Here&amp;#39;s the (slightly hacky) code to
restore the old window configuration:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;winner-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ediff-after-quit-hook-internal&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;winner-undo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;list-of-ways-that-i-use-to-invoke-ediff&quot;&gt;List of ways that I use to invoke Ediff&lt;/h2&gt;

&lt;h3 id=&quot;from-magit&quot;&gt;from &lt;code&gt;magit&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;In 80% of the cases, I call Ediff with &lt;kbd&gt;e&lt;/kbd&gt; (&lt;code&gt;magit-ediff&lt;/code&gt;) from
&lt;code&gt;magit-status-mode&lt;/code&gt;. This gives me a better overview of the changes,
especially when I want to revert stuff with either &lt;kbd&gt;a&lt;/kbd&gt;
(&lt;code&gt;ediff-copy-A-to-B&lt;/code&gt;) or &lt;kbd&gt;b&lt;/kbd&gt; (&lt;code&gt;ediff-copy-B-to-A&lt;/code&gt;). Probably
with &lt;kbd&gt;a&lt;/kbd&gt;, since &lt;a href=&quot;https://github.com/magit/magit&quot;&gt;magit&lt;/a&gt; seems
to consistently put the &lt;code&gt;@{index}&lt;/code&gt; file into the &lt;code&gt;A&lt;/code&gt; diff window, and
the current file into the &lt;code&gt;B&lt;/code&gt; window.&lt;/p&gt;

&lt;p&gt;So if I&amp;#39;m looking at a diff (to which I navigated with
&lt;kbd&gt;j&lt;/kbd&gt;/&lt;kbd&gt;k&lt;/kbd&gt;), I can revert it with &lt;kbd&gt;a&lt;/kbd&gt;. At this
point, the diff region in the current file will become equal to that
of the index file. But it will not be saved yet. If I want to save the
current file in the &lt;code&gt;B&lt;/code&gt; window, I can do it with &lt;kbd&gt;wb&lt;/kbd&gt;
(&lt;code&gt;ediff-save-buffer&lt;/code&gt;). After a revert, it&amp;#39;s also useful to call
&lt;kbd&gt;!&lt;/kbd&gt;(&lt;code&gt;ediff-update-diffs&lt;/code&gt;), which will remove the zero-length
diffs and update the diff-count in the mode-line.&lt;/p&gt;

&lt;h3 id=&quot;other-methods&quot;&gt;other methods&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ediff-buffers&lt;/code&gt; will diff two (different) buffers. If you happen to
have only two windows open with the appropriate buffers, you get them
as defaults and can choose them quickly with &lt;kbd&gt;RET&lt;/kbd&gt; &lt;kbd&gt;RET&lt;/kbd&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ediff-files&lt;/code&gt; is similar, but works on files instead. I like to just mark the appropriate files
in &lt;code&gt;dired&lt;/code&gt; with &lt;kbd&gt;m&lt;/kbd&gt;, then they also get auto-selected by &lt;code&gt;ediff-files&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ediff-current-file&lt;/code&gt; is useful to see the unsaved changes to the current file.
I rarely use it, since I have a compulsion to save every file every chance I get. There is little hope
to recover from this addiction, unless someone implements an analogue of &lt;a href=&quot;https://github.com/bbatsov/guru-mode&quot;&gt;guru-mode&lt;/a&gt;
that annoys you when you try to save a file. Actually, it&amp;#39;s not a bad idea - &lt;kbd&gt;C-x C-s&lt;/kbd&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Oleh, you have saved this file &lt;code&gt;40 times&lt;/code&gt; in the last hour; the last
save was &lt;code&gt;0 minutes 34 seconds ago&lt;/code&gt;; since then, you&amp;#39;ve changed &lt;code&gt;27
bytes&lt;/code&gt; of information. Are you &lt;strong&gt;sure&lt;/strong&gt; you want to save &lt;code&gt;[y/N]&lt;/code&gt;?&lt;/p&gt;
&lt;/blockquote&gt;
</content>
 </entry>
 
 <entry>
   <title>Save before compile</title>
   <link href="https://oremacs.com/2015/01/16/compile-savely/"/>
   <updated>2015-01-16T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/16/compile-savely</id>
   <content type="html">&lt;p&gt;Here&amp;#39;s a very simplistic function that I was using for a while:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;save-and-compile&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;save-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;compile&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;make -j4&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;pop-to-buffer&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;next-error-last-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It will save the current buffer, run &lt;code&gt;compile&lt;/code&gt; and switch to
compilation buffer.&lt;/p&gt;

&lt;h2 id=&quot;compilation-customization&quot;&gt;Compilation customization&lt;/h2&gt;

&lt;p&gt;Turns out that there&amp;#39;s no need to save, since I get away with this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;(setq compilation-ask-about-save nil)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The documentation says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Non-nil means M-x &lt;code&gt;compile&lt;/code&gt; asks which buffers to save before
compiling.  Otherwise, it saves all modified buffers without asking.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;select-compilation-target&quot;&gt;Select compilation target&lt;/h2&gt;

&lt;p&gt;A year ago, I wrote a package that looks for a &lt;code&gt;Makefile&lt;/code&gt; in the
current directory, parses the available targets and allows you to
choose one with &lt;a href=&quot;https://github.com/emacs-helm/helm&quot;&gt;helm&lt;/a&gt;.  It&amp;#39;s
called &lt;a href=&quot;https://github.com/abo-abo/helm-make&quot;&gt;helm-make&lt;/a&gt;.  It&amp;#39;s almost
the same as &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;compile&lt;/code&gt; (which also has completion for
targets), and it wraps around &lt;code&gt;compile&lt;/code&gt;, but I just find it to be more
convenient.&lt;/p&gt;

&lt;p&gt;This package is as simple as it sounds, the only customization that
you can do is to set &lt;code&gt;helm-make-do-save&lt;/code&gt; to save all open buffers
visiting the &lt;code&gt;Makefile&lt;/code&gt;&amp;#39;s directory. It also provides, in addition to
the plain &lt;code&gt;helm-make&lt;/code&gt; command, a &lt;code&gt;helm-make-projectile&lt;/code&gt; command, which
is almost the same, except the &lt;code&gt;Makefile&lt;/code&gt; should come not from the
current directory but from &lt;code&gt;projectile-project-root&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;some-error-navigation-to-go-with-your-compilation&quot;&gt;Some error navigation to go with your compilation&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ve had these bindings for a very long time, just making sure
that you&amp;#39;re aware of these commands:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;next-error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;C-f6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;previous-error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;These bindings work for &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;occur&lt;/code&gt; and &lt;code&gt;rgrep&lt;/code&gt; as well.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>C++ - a dot inserts last var plus dot</title>
   <link href="https://oremacs.com/2015/01/15/c++-smart-dot/"/>
   <updated>2015-01-15T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/15/c++-smart-dot</id>
   <content type="html">&lt;p&gt;It is very much in the spirit of C++ to pull an object into existence
with e.g. a constructor definition and then poke and prod it with
various method calls. Most of the time, the dot will have the object
name on the left. So why not automatically insert the object name each
time I press the dot? Below, I&amp;#39;ll show a code that does exactly that.&lt;/p&gt;

&lt;h2 id=&quot;the-dot-command&quot;&gt;The dot command&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c++-smart-dot&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Insert a dot or an object name plus dot when appropriate.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;var-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;looking-back&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^[ \t]*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;var-name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;c++-get-recent-var&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;var-name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This one is pretty simple: if we are at the beginning of the line,
optionally with some spaces or (ugh) tabs before the point, then try
to insert the object name along with a dot.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s how to bind it:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;eval-after-load&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cc-mode&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c++-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;c++-smart-dot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;how-to-get-the-recent-variable&quot;&gt;How to get the recent variable&lt;/h2&gt;

&lt;p&gt;This code doesn&amp;#39;t aim to be thorough, it&amp;#39;s just a hack that
works reasonably well.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defconst&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c++-var-regex&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[A-Za-z][A-Za-z0-9_]*&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;The regex for C++ variable name.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c++-get-recent-var&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Return the closest thing that looks like an object.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;The search is performed backwards through code.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt;
           &lt;span class=&quot;c1&quot;&gt;;; variable dot chain&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;looking-back&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; \\(%s\\)\\.%s.*\n[\t ]*&amp;quot;&lt;/span&gt;
                    &lt;span class=&quot;nv&quot;&gt;c++-var-regex&lt;/span&gt;
                    &lt;span class=&quot;nv&quot;&gt;c++-var-regex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;c1&quot;&gt;;; variable constructor init&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;looking-back&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[\t ]+\\(%s\\)\\(?:([^)]*)\\)?;[\t\n ]*&amp;quot;&lt;/span&gt;
                    &lt;span class=&quot;nv&quot;&gt;c++-var-regex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;c1&quot;&gt;;; variable dot, first on line&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-backward&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^[ \t]*\\(%s\\)\\.&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c++-var-regex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string-no-properties&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you&amp;#39;re a stickler for performance and you don&amp;#39;t want to call format a bunch of times,
you can amend the code like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defalias&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;c++-get-recent-var&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;byte-compile&lt;/span&gt;
     &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt;
               &lt;span class=&quot;c1&quot;&gt;;; variable dot chain&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;looking-back&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;
                  &lt;span class=&quot;s&quot;&gt;&amp;quot; \\(%s\\)\\.%s.*\n[\t ]*&amp;quot;&lt;/span&gt;
                  &lt;span class=&quot;nv&quot;&gt;c++-var-regex&lt;/span&gt;
                  &lt;span class=&quot;nv&quot;&gt;c++-var-regex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
               &lt;span class=&quot;c1&quot;&gt;;; variable constructor init&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;looking-back&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;
                  &lt;span class=&quot;s&quot;&gt;&amp;quot;[\t ]+\\(%s\\)\\(?:([^)]*)\\)?;[\t\n ]*&amp;quot;&lt;/span&gt;
                  &lt;span class=&quot;nv&quot;&gt;c++-var-regex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
               &lt;span class=&quot;c1&quot;&gt;;; variable dot, first on line&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-backward&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^[ \t]*\\(%s\\)\\.&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c++-var-regex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string-no-properties&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Return the closest thing that looks like an object.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;The search is performed backwards through code.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The thing above looks slightly ugly. I&amp;#39;m open to suggestions to make
it look nicer.&lt;/p&gt;

&lt;h2 id=&quot;the-sample-application&quot;&gt;The sample application&lt;/h2&gt;

&lt;p&gt;For the happy people that have never seen C++:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-C++&quot; data-lang=&quot;C++&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DataOut&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dim&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data_out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;data_out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;attach_dof_handler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dof_handler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;data_out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add_data_vector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;solution&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;data_out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;build_patches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, after defining an object &lt;code&gt;data_out&lt;/code&gt;, I insert it subsequently
with just &lt;kbd&gt;.&lt;/kbd&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Zoom in / out with style</title>
   <link href="https://oremacs.com/2015/01/14/repeatable-commands/"/>
   <updated>2015-01-14T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/14/repeatable-commands</id>
   <content type="html">&lt;p&gt;I don&amp;#39;t usually zoom a lot, typically I do it to size up other
people&amp;#39;s functions. Then, I zoom-out a couple times in a row until the
function fits on the screen. Sometimes, I overshoot the zoom-out, and
I have to zoom-in instead. I have &lt;code&gt;text-scale-increase&lt;/code&gt; bound to
&lt;kbd&gt;&amp;lt;f2&amp;gt; g&lt;/kbd&gt; and &lt;code&gt;text-scale-decrease&lt;/code&gt; bound to
&lt;kbd&gt;&amp;lt;f2&amp;gt; l&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Below, I&amp;#39;ll demonstrate how to call those two commands interchangeably
with e.g. &lt;kbd&gt;&amp;lt;f2&amp;gt; g g g l g g l&lt;/kbd&gt;, i.e. omitting the
&lt;kbd&gt;&amp;lt;f2&amp;gt;&lt;/kbd&gt; prefix.&lt;/p&gt;

&lt;h2 id=&quot;define-repeatable-command&quot;&gt;Define repeatable command&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;def-rep-command&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;alist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Return a lambda that calls the first function of ALIST.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;It sets the transient map to all functions of ALIST.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lexical-let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;keymap&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make-sparse-keymap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cdar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;alist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keymap&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
          &lt;span class=&quot;nv&quot;&gt;alist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;funcall&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;set-transient-map&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;keymap&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is a pretty simple function that takes an alist of keys and
commands, and returns a lambda that calls the first command and sets
the transient map to call the first and other commands.  The way the
transient map works, it takes priority over almost all maps, but
disappears as soon as you press something that doesn&amp;#39;t belong to it.&lt;/p&gt;

&lt;h2 id=&quot;the-zoom-in-zoom-out-use-case&quot;&gt;The zoom-in / zoom-out use case&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f2&amp;gt; g&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;def-rep-command&lt;/span&gt;
                    &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-increase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-decrease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;lt;f2&amp;gt; l&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;def-rep-command&lt;/span&gt;
                    &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-decrease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text-scale-increase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And this is it. A nice thing about this setup is that I don&amp;#39;t have to
think about the zoom state and quitting it: I&amp;#39;ll quit it automatically
as soon as I press anything other than &lt;kbd&gt;l&lt;/kbd&gt; or &lt;kbd&gt;g&lt;/kbd&gt;.
Moreover, the command that exited the zoom state will be executed as
usual.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Even more dired options</title>
   <link href="https://oremacs.com/2015/01/13/dired-options/"/>
   <updated>2015-01-13T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/13/dired-options</id>
   <content type="html">&lt;p&gt;I&amp;#39;ve been posting a lot about &lt;code&gt;dired&lt;/code&gt; lately, and with good cause.  A
lot of people say that &lt;code&gt;org-mode&lt;/code&gt; is the killer app of Emacs, but
&lt;code&gt;dired&lt;/code&gt; should be in that group as well, especially if you count
&lt;code&gt;tramp&lt;/code&gt; as part of &lt;code&gt;dired&lt;/code&gt;. Below, I&amp;#39;ll list a few dired options in my
config that deviate from the defaults.&lt;/p&gt;

&lt;h2 id=&quot;dired-listing-switches&quot;&gt;&lt;code&gt;dired-listing-switches&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;This is the essence of what &lt;code&gt;dired&lt;/code&gt; presents and how it presents it.
A great thing about it is that these are just the &lt;code&gt;ls&lt;/code&gt; switches, so
you can look them up with &lt;code&gt;info ls&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-listing-switches&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;-laGh1v --group-directories-first&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;l&lt;/code&gt;: Is the only mandatory one.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;a&lt;/code&gt;: Means to list invisible files.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;G&lt;/code&gt;: Don&amp;#39;t show group information. These days, when there are more
laptops than people, the group info is rarely useful.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;h&lt;/code&gt;: Human readable sizes, such as &lt;strong&gt;M&lt;/strong&gt; for mebibytes.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;1v&lt;/code&gt;: Affects the sorting of digits, hopefully in a positive way.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--group-directories-first&lt;/code&gt;: self-explanatory, I like to have the directories on the top,
separate from the files.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;on-recursion&quot;&gt;On recursion&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-recursive-copies&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;always&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-recursive-deletes&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;always&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;These settings make dired skip the confirmation when you copy or
delete a directory that contains other directories.  What&amp;#39;s the worse
that could happen, right?&lt;/p&gt;

&lt;pre&gt;
&lt;span class=&quot;diff-indicator-removed&quot;&gt;-  rm -rf /usr /lib/nvidia-current/xorg/xorg&lt;/span&gt;
&lt;span class=&quot;diff-indicator-added&quot;&gt;+  rm -rf /usr/lib/nvidia-current/xorg/xorg&lt;/span&gt;
&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>File sizes in dired</title>
   <link href="https://oremacs.com/2015/01/12/dired-file-size/"/>
   <updated>2015-01-12T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/12/dired-file-size</id>
   <content type="html">&lt;p&gt;Today, I&amp;#39;ll continue with the trend of posting a small piece of my
config when I don&amp;#39;t have the time to post something more substantial.&lt;/p&gt;

&lt;h2 id=&quot;some-code&quot;&gt;Some code&lt;/h2&gt;

&lt;p&gt;This one looks nice, although it only works on systems with &lt;code&gt;/usr/bin/du&lt;/code&gt;,
which actually comprise 100% of the systems that I use:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-get-size&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-get-marked-files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;with-temp-buffer&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;call-process&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/usr/bin/du&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;-sch&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;message&lt;/span&gt;
       &lt;span class=&quot;s&quot;&gt;&amp;quot;Size of all marked files: %s&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-backward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\(^[ 0-9.,]+[A-Za-z]+\\).*total$&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;match-string&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On doing a search, turns out that I got this code from
&lt;a href=&quot;http://www.emacswiki.org/emacs/DiredGetFileSize&quot;&gt;the wiki&lt;/a&gt; at some
point.  I can confirm that, unlike some of the other code on the wiki,
this one still works as advertised: you can use it on a directory or
on a series of marked files and directories.&lt;/p&gt;

&lt;h2 id=&quot;standard-dired-marking&quot;&gt;Standard &lt;code&gt;dired&lt;/code&gt; marking&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;dired&lt;/code&gt;, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mark an item with &lt;kbd&gt;m&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;unmark an item with &lt;kbd&gt;DEL&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;inverse selection with &lt;kbd&gt;t&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;unmark everything with &lt;kbd&gt;U&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Compared to this, the selection with the mouse and the control and
shift keys that many file browsers use looks like kindergarten.&lt;/p&gt;

&lt;p&gt;This new action, getting the size of marked things, I&amp;#39;ve bound to &lt;kbd&gt;z&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-get-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Making Elisp regex look nicer</title>
   <link href="https://oremacs.com/2015/01/11/pretty-elisp-regex/"/>
   <updated>2015-01-11T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/11/pretty-elisp-regex</id>
   <content type="html">&lt;p&gt;This is just a small improvement to make e.g.  &lt;code&gt;\\(&lt;/code&gt; show up in
regular expressions without the escape chars, but instead fontified
with &lt;code&gt;font-lock-keyword-face&lt;/code&gt;. It doesn&amp;#39;t affect the underlying code
at all, just makes it look nicer. For the &lt;code&gt;\\|&lt;/code&gt; I chose &lt;code&gt;∨&lt;/code&gt; - the
&lt;em&gt;logical or&lt;/em&gt; character.&lt;/p&gt;

&lt;h2 id=&quot;the-code&quot;&gt;The code&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;fontify-glyph&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;glyph&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;item&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;font-lock-keyword-face&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;prog1&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;compose-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-beginning&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;match-end&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                            &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;glyph&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;font-lock-add-keywords&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;emacs-lisp-mode&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fontify-glyph&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\\\\\\\|&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;∨&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;font-lock-add-keywords&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;emacs-lisp-mode&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fontify-glyph&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\\\\\\\(&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;font-lock-add-keywords&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;emacs-lisp-mode&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;fontify-glyph&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\\\\\\\)&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;)&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;how-it-looks-like&quot;&gt;How it looks like&lt;/h2&gt;

&lt;p&gt;At first, I wanted to just inline &lt;a href=&quot;/download/elisp-regex.png&quot;&gt;a picture&lt;/a&gt;,
but then I thought that &lt;code&gt;htmlize-buffer&lt;/code&gt; would be able to handle it.
It didn&amp;#39;t, so I just edited a small snippet by hand:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^&lt;span class=&quot;nb&quot;&gt;(&lt;/span&gt;[^\n%|]*?&lt;span class=&quot;nb&quot;&gt;)&lt;/span&gt;|&lt;span class=&quot;nb&quot;&gt;(&lt;/span&gt;([^\n]*&lt;span class=&quot;nb&quot;&gt;)&lt;/span&gt;?$&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^&lt;span class=&quot;nb&quot;&gt;(&lt;/span&gt;[^\n%|]*?&lt;span class=&quot;nb&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;(&lt;/span&gt;%[^\n]*&lt;span class=&quot;nb&quot;&gt;)&lt;/span&gt;?$&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It&amp;#39;s really satisfying to see those escape chars vanish as I type in
a capture group in the regex, especially with the help of
&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy-mode&lt;/a&gt;.
Here are some relevant tests for the regex support:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-with&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;a regex \\\\|\&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;a regex \\\\(|\\\\)\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-with&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;\\\\(|foo\\\\)\&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\C-?&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;|foo\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-with&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;\\\\(foo\\\\)|\&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\C-?&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;foo|\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-with&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;|\\\\(foo\\\\)\&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\C-d&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;|foo\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-with&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;\\\\(foo|\\\\)\&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\C-d&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;foo|\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>dired and ansi-term&#58; BFF</title>
   <link href="https://oremacs.com/2015/01/10/dired-ansi-term/"/>
   <updated>2015-01-10T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/10/dired-ansi-term</id>
   <content type="html">&lt;p&gt;In the comments to
&lt;a href=&quot;/2015/01/01/three-ansi-term-tips/&quot;&gt;my previous post on ansi-term&lt;/a&gt;, I discovered
&lt;a href=&quot;https://github.com/adamrt/sane-term&quot;&gt;sane-term&lt;/a&gt; - a package that
cycles though your terminals in Emacs, as well as implements some of
the tips that I gave. While it&amp;#39;s nice and all, and you should check it
out if you&amp;#39;re looking for something like that, it&amp;#39;s not really for
me. I will describe the system that I&amp;#39;m currently using below.&lt;/p&gt;

&lt;h2 id=&quot;what-is-the-best-list-length-for-cycling&quot;&gt;What is the best list length for cycling?&lt;/h2&gt;

&lt;p&gt;In my opinion, it&amp;#39;s one or two. If it&amp;#39;s one, you&amp;#39;re not really
cycling, if it&amp;#39;s two, it&amp;#39;s fine. Anything more than that causes
stress, since you have to check each time if the outcome of the cycle
ended up being the one that you wanted.&lt;/p&gt;

&lt;p&gt;That&amp;#39;s why I usually have only one &lt;code&gt;*ansi-term*&lt;/code&gt; active in my Emacs
session at all times.  Here&amp;#39;s how it looks like:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;terminal&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Switch to terminal. Launch if nonexistent.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*ansi-term*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;switch-to-buffer&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*ansi-term*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ansi-term&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/bin/bash&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-buffer-process&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*ansi-term*&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defalias&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;tt&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;terminal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;At one point, I had &lt;code&gt;terminal&lt;/code&gt; bound to &lt;kbd&gt;C-t&lt;/kbd&gt;, until I found
a command even better suited for that binding, which was
&lt;a href=&quot;https://github.com/nonsequitur/smex/&quot;&gt;smex&lt;/a&gt;. The actual &lt;code&gt;terminal&lt;/code&gt;
command isn&amp;#39;t bound right now, I just launch it from &lt;code&gt;smex&lt;/code&gt; on very
rare occasions.&lt;/p&gt;

&lt;h2 id=&quot;how-i-launch-terminal-95-of-the-time&quot;&gt;How I launch terminal 95% of the time&lt;/h2&gt;

&lt;p&gt;From &lt;code&gt;dired&lt;/code&gt; of course. The shell&amp;#39;s natural way of switching the
directory with &lt;code&gt;cd&lt;/code&gt; is extremely inefficient compared to &lt;code&gt;dired&lt;/code&gt;.  So
any time I want to have a shell in a specific directory, I first
navigate there with &lt;code&gt;dired&lt;/code&gt;, sometimes combined with
&lt;code&gt;ido-find-file&lt;/code&gt;. Then I get my current &lt;code&gt;*ansi-term*&lt;/code&gt; and tell it to
switch to the current &lt;code&gt;dired&lt;/code&gt; buffer&amp;#39;s directory with &lt;kbd&gt;`&lt;/kbd&gt;
binding:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;`&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-open-term&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-open-term&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Open an &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ansi-term&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; that corresponds to current directory.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current-dir&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-current-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;term-send-string&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;terminal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file-remote-p&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;current-dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tramp-dissect-file-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;current-dir&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ssh %s@%s\n&amp;quot;&lt;/span&gt;
                   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;aref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;aref&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cd &amp;#39;%s&amp;#39;\n&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;current-dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I also have a similar &lt;code&gt;eshell&lt;/code&gt; setup, although I have yet to
comprehend why &lt;code&gt;eshell&lt;/code&gt; is great and am using &lt;code&gt;*ansi-term*&lt;/code&gt; most of the
time instead.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;#39;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;eshell-cmd&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cd %s&amp;quot;&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;expand-file-name&lt;/span&gt;
              &lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;how-i-launch-dired-100-of-the-time&quot;&gt;How I launch &lt;code&gt;dired&lt;/code&gt; 100% of the time&lt;/h2&gt;

&lt;p&gt;With &lt;code&gt;dired-jump&lt;/code&gt;, of course. This command will examine your current
buffer&amp;#39;s &lt;code&gt;default-directory&lt;/code&gt; and open a &lt;code&gt;dired&lt;/code&gt; buffer there. All you
need is:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;dired-jump&lt;/code&gt; command will be bound automatically to &lt;kbd&gt;C-x
C-j&lt;/kbd&gt;.  I have it also bound to &lt;kbd&gt;C-:&lt;/kbd&gt;, since that&amp;#39;s more
convenient to press with my keyboard layout.&lt;/p&gt;

&lt;p&gt;It&amp;#39;s also better in the common situation when I want to jump to a
&lt;code&gt;dired&lt;/code&gt; buffer from &lt;code&gt;*ansi-term*&lt;/code&gt;. In that situation, &lt;kbd&gt;C-x
C-j&lt;/kbd&gt; will not work by default, and will call &lt;code&gt;term-line-mode&lt;/code&gt;
instead. But it will work once you are in &lt;code&gt;term-line-mode&lt;/code&gt;.  You can
go back to the default &lt;code&gt;term-char-mode&lt;/code&gt; with &lt;kbd&gt;C-x C-k&lt;/kbd&gt;.  To
avoid this nonsense, just bind &lt;code&gt;dired-jump&lt;/code&gt; to some binding that&amp;#39;s
convenient for you and works from &lt;code&gt;*ansi-term*&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;what-i-do-when-i-need-more-than-one-terminal&quot;&gt;What I do when I need more than one terminal&lt;/h2&gt;

&lt;p&gt;Then I just name one: since the default one is supposed to be named
&lt;code&gt;*ansi-term*&lt;/code&gt;, if I create one named e.g. &lt;code&gt;*jekyll*&lt;/code&gt;, it will be
ignored by &lt;code&gt;dired-open-term&lt;/code&gt;. This is exactly what I want, since I just
create named terminals for long running processes like &lt;code&gt;jekyll serve&lt;/code&gt;.
And I can switch to the named terminals with just &lt;code&gt;ido-switch-buffer&lt;/code&gt;.
Here is the very simple code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;named-term&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;sName: &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ansi-term&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/bin/bash&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>tilde in ido-find-file</title>
   <link href="https://oremacs.com/2015/01/09/ido-find-file-tilde/"/>
   <updated>2015-01-09T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/09/ido-find-file-tilde</id>
   <content type="html">&lt;p&gt;On seeing
&lt;a href=&quot;http://emacs.stackexchange.com/questions/7193/how-to-replicate-the-to-home-to-root-behaviour-in-ido-find-file-but&quot;&gt;this Emacs Stack Exchange question&lt;/a&gt;,
it occurred to me that if some config code is old for me, it&amp;#39;s not old
for the new Emacs users. So I&amp;#39;ll share one of the old &lt;code&gt;ido-find-file&lt;/code&gt;
hacks that I&amp;#39;ve been using for ages.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This song is an oldie ...but, uh ... &lt;em&gt;pause&lt;/em&gt;
Well, it&amp;#39;s an oldie where I come from.&lt;/p&gt;

&lt;p&gt;-- &lt;cite&gt;Marty&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;the-code&quot;&gt;The code&lt;/h2&gt;

&lt;p&gt;This is the original code that I was using:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-ido-setup-hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-file-dir-completion-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-set-current-directory&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-exit&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;exit-minibuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ido-setup-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;oleh-ido-setup-hook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;the-generalization&quot;&gt;The generalization&lt;/h2&gt;

&lt;p&gt;It wouldn&amp;#39;t be a LISP if I couldn&amp;#39;t generalize the code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-find-file-jump&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Return a command that sends DIR to &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ido-find-file&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-set-current-directory&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-exit&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;exit-minibuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here&amp;#39;s how to leverage this generalization:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-ido-setup-hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-file-dir-completion-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-find-file-jump&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-file-dir-completion-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;!&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-find-file-jump&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/Dropbox/source/site-lisp/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-file-dir-completion-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;@&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-find-file-jump&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/git/lispy/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that this is pretty ugly, implementation-wise, since
&lt;code&gt;ido-find-file-jump&lt;/code&gt; would be called three times each time you do an
&lt;code&gt;ido&lt;/code&gt; related command, like &lt;code&gt;ido-switch-buffer&lt;/code&gt; etc.
I would have preferred to do it like this instead:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;eval-after-load&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ido&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-file-dir-completion-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-find-file-jump&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-file-dir-completion-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;!&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-find-file-jump&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/Dropbox/source/site-lisp/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-file-dir-completion-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;@&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-find-file-jump&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/git/lispy/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But, for some strange reason, &lt;code&gt;ido&lt;/code&gt; keeps overriding
&lt;code&gt;ido-file-dir-completion-map&lt;/code&gt; and I actually have to re-set my
bindings in &lt;code&gt;ido-setup-hook&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-further-generalization&quot;&gt;The further generalization&lt;/h2&gt;

&lt;p&gt;Here is the final iteration of the code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-ido-shortcuts&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;~/&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;~/Dropbox/source/site-lisp/&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;!&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;~/git/lispy/&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;@&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setcar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-find-file-jump&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;oleh-ido-shortcuts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-ido-setup-hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapc&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-file-dir-completion-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cadr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
   &lt;span class=&quot;nv&quot;&gt;oleh-ido-shortcuts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ido-setup-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;oleh-ido-setup-hook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;the-customize-tricks&quot;&gt;The customize tricks&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;quot;Custom setters?&lt;br&gt;
In &lt;em&gt;my&lt;/em&gt; Elisp?&amp;quot;&lt;/p&gt;

&lt;p&gt;It&amp;#39;s more likely than you think.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Note that the &lt;code&gt;mapc&lt;/code&gt; statement needs to be evaluated if I dynamically
modify &lt;code&gt;oleh-ido-shortcuts&lt;/code&gt;. This isn&amp;#39;t a problem for me, but if I
wanted to package a code like this, I would define
&lt;code&gt;oleh-ido-shortcuts&lt;/code&gt; like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defcustom&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-ido-shortcuts&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;~/&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;~/Dropbox/source/site-lisp/&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;!&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;~/git/lispy/&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;@&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;A list of directory-shortcut pairs for &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`ido-find-file&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;:set&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set-default&lt;/span&gt;
          &lt;span class=&quot;nv&quot;&gt;symbol&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringp&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-find-file-jump&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
               &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now, this should work:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;csetq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-ido-shortcuts&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setcar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;rassoc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;@&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-ido-shortcuts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot;~/git/worf&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;nv&quot;&gt;oleh-ido-shortcuts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;csetq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-ido-shortcuts&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;~/git/&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;nv&quot;&gt;oleh-ido-shortcuts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, the appropriate lambda is auto-generated by using the &lt;code&gt;:set&lt;/code&gt;
property of &lt;code&gt;oleh-ido-shortcuts&lt;/code&gt;.
And &lt;code&gt;csetq&lt;/code&gt; is just a &lt;code&gt;customize&lt;/code&gt;-aware version of &lt;code&gt;setq&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defmacro&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;csetq&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;variable&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;funcall&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;,variable&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;custom-set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;set-default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;ss&quot;&gt;&amp;#39;,variable&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>My org-protocol setup, part 2.</title>
   <link href="https://oremacs.com/2015/01/08/org-protocol-2/"/>
   <updated>2015-01-08T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/08/org-protocol-2</id>
   <content type="html">&lt;p&gt;This continues the code from &lt;a href=&quot;/2015/01/07/org-protocol-1/&quot;&gt;the part 1&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;org-handle-link-youtube&quot;&gt;&lt;code&gt;org-handle-link-youtube&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;I tried to make the first call to &lt;code&gt;youtube-dl&lt;/code&gt; asynchronous, but it
wasn&amp;#39;t working out.  So for the current code, there&amp;#39;s still about a 2
second delay before the capture buffer appears.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;async&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-handle-link-youtube&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lexical-let*&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file-name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-trim&lt;/span&gt;
                   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;shell-command-to-string&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot;youtube-dl \&amp;quot;&amp;quot;&lt;/span&gt;
                     &lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;&amp;quot;&lt;/span&gt;
                     &lt;span class=&quot;s&quot;&gt;&amp;quot; -o \&amp;quot;%(title)s.%(ext)s\&amp;quot; --get-filename&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/Downloads/Videos&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;full-name&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;expand-file-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;org-link-hook&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-make-link-string&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;
                 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-make-link-string&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;full-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;async-shell-command&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;youtube-dl \&amp;quot;%s\&amp;quot; -o \&amp;quot;%s\&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;full-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ent.org&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^\\*+ +Videos&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Some notes for people who want to learn more Elisp:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lexical-let*&lt;/code&gt; is needed to have &lt;code&gt;dir&lt;/code&gt; and &lt;code&gt;full-name&lt;/code&gt; visible in the &lt;code&gt;lambda&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;org-make-link-string&lt;/code&gt; is a nice utility command that escapes all sorts of
characters that &lt;code&gt;org-mode&lt;/code&gt; doesn&amp;#39;t like, e.g. brackets etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can see my full &lt;code&gt;org-capture&lt;/code&gt; and &lt;code&gt;org-protocol&lt;/code&gt; setup
&lt;a href=&quot;https://github.com/abo-abo/org-fu&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>My org-protocol setup, part 1.</title>
   <link href="https://oremacs.com/2015/01/07/org-protocol-1/"/>
   <updated>2015-01-07T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/07/org-protocol-1</id>
   <content type="html">&lt;p&gt;I&amp;#39;m quite busy with a project today, so I can&amp;#39;t compose many words.
However, pasting and explaining some code is fine.  The basic idea is
creating TODO tasks in certain &lt;code&gt;org-mode&lt;/code&gt; files by clicking a link in
Firefox, thanks to
&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/org-mode-capture/&quot;&gt;org-mode capture&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;org-protocol-starter&quot;&gt;&lt;code&gt;org-protocol&lt;/code&gt; starter&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-emacs&quot; data-lang=&quot;emacs&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;org-capture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;org-protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-protocol-default-template-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Link&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;entry&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-handle-link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;* TODO %(org-wash-link)\nAdded: %U\n%(org-link-hooks)\n%?&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;org-capture-templates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;org-wash-link&lt;/code&gt; should clear up some redundancies in the TODO&lt;/li&gt;
&lt;li&gt;&lt;code&gt;org-handle-link&lt;/code&gt; should open the appropriate file and heading.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;org-link-hooks&lt;/code&gt; should insert some extra information&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;org-wash-link&quot;&gt;&lt;code&gt;org-wash-link&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Basically, when I capture a question on
&lt;a href=&quot;http://stackoverflow.com/questions/tagged/emacs&quot;&gt;Stack Overflow&lt;/a&gt;, I
don&amp;#39;t want to see &lt;code&gt;- Stack Overflow -&lt;/code&gt; as part of the TODO string,
since the TODO itself is stored in &lt;code&gt;wiki/stack.org/* Questions&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-emacs&quot; data-lang=&quot;emacs&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-wash-link&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;caar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-stored-links&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cadar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-stored-links&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;replace-regexp-in-string&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot; - Stack Overflow&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-make-link-string&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;org-link-hooks&quot;&gt;&lt;code&gt;org-link-hooks&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;This is just a hack for passing information around that
functions from &lt;code&gt;org-handle-link&lt;/code&gt; can use.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-emacs&quot; data-lang=&quot;emacs&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-link-hook&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-link-hooks&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;prog1&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapconcat&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;funcall&lt;/span&gt;
                 &lt;span class=&quot;nv&quot;&gt;org-link-hook&lt;/span&gt;
                 &lt;span class=&quot;s&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-link-hook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;org-handle-link&quot;&gt;&lt;code&gt;org-handle-link&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;This is the heart of the setup.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-emacs&quot; data-lang=&quot;emacs&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-handle-link&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;caar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-stored-links&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^https://www.youtube.com/&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-handle-link-youtube&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;string-match&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;regexp-quote&lt;/span&gt;
                          &lt;span class=&quot;s&quot;&gt;&amp;quot;http://stackoverflow.com/&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;wiki/stack.org&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^\\*+ +Questions&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-expand&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ent.org&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^\\*+ +Articles&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Youtube links will be handled with &lt;code&gt;org-handle-link-youtube&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Stack Overflow links will be stored in &lt;code&gt;wiki/stack.org/* Questions&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;all other links will be stored in &lt;code&gt;ent.org/* Articles&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I&amp;#39;ll write down &lt;code&gt;org-handle-link-youtube&lt;/code&gt; in a later post, since I
would still like to sort out a few kinks with it. The main issue is
that I&amp;#39;m sending two requests to Youtube: one to download the video,
which is fine, since &lt;code&gt;async&lt;/code&gt; handles it; and other to get the title of
the video and put it in the heading. And this other request causes a
perceptible delay when capturing.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Rushing headlong</title>
   <link href="https://oremacs.com/2015/01/06/rushing-headlong/"/>
   <updated>2015-01-06T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/06/rushing-headlong</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;And you&amp;#39;re rushing headlong out of control...&lt;/p&gt;

&lt;p&gt;-- &lt;cite&gt;Brian May&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I&amp;#39;ve finally wrapped a piece of config that I was using for a while in
a package called &lt;a href=&quot;https://github.com/abo-abo/headlong&quot;&gt;headlong&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;what-does-it-do&quot;&gt;What does it do?&lt;/h2&gt;

&lt;p&gt;It provides a macro called &lt;code&gt;headlong-with&lt;/code&gt; that modifies minibuffer
completion for the forms within it, making it faster in some
situations.  For instance:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;headlong-with&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;completing-read&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Jump to bookmark: &amp;quot;&lt;/span&gt;
                  &lt;span class=&quot;nv&quot;&gt;bookmark-alist&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;headlong-with&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;read-extended-command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But more importantly, it provides two commands that can use it
efficiently: &lt;code&gt;headlong-bookmark-jump&lt;/code&gt; and
&lt;code&gt;headlong-bookmark-jump-other&lt;/code&gt;. The second one is basically the same
as the first one, except it opens the bookmark with &lt;code&gt;pop-to-buffer&lt;/code&gt;,
i.e. in other window.&lt;/p&gt;

&lt;h2 id=&quot;how-does-this-completion-work&quot;&gt;How does this completion work?&lt;/h2&gt;

&lt;p&gt;It&amp;#39;s nothing fancy, you will just exit the minibuffer automatically as
soon as there is only one completion candidate left.
So it saves you &lt;strong&gt;one&lt;/strong&gt; keystroke, namely &lt;kbd&gt;RET&lt;/kbd&gt;.
How much is &lt;em&gt;one&lt;/em&gt; keystroke worth? It depends.&lt;/p&gt;

&lt;p&gt;If you arrange your bookmarks in a way that I do, with each one
starting with a different letter, it saves you 33% of the total
keystrokes.  For example, suppose I have:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-p&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;bookmark-jump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;M-o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;headlong-bookmark-jump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then I can jump to my bookmarked directory named &lt;code&gt;&amp;quot;s: sources&amp;quot;&lt;/code&gt; with
two methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-p&lt;/kbd&gt;&lt;kbd&gt;s&lt;/kbd&gt;&lt;kbd&gt;RET&lt;/kbd&gt; &lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-o&lt;/kbd&gt;&lt;kbd&gt;s&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The second method looks like it&amp;#39;s 33% shorter, but it feels like it&amp;#39;s
even more, since pressing &lt;kbd&gt;RET&lt;/kbd&gt; is harder than it should be
on most keyboards.&lt;/p&gt;

&lt;h2 id=&quot;why-is-this-cool&quot;&gt;Why is this cool?&lt;/h2&gt;

&lt;p&gt;This is cool because you can implement your bookmarks as efficiently
as you would with just wrapping stuff with a &lt;code&gt;lambda&lt;/code&gt; and using
&lt;code&gt;global-set-key&lt;/code&gt;, except that you can view and edit the bindings with
&lt;code&gt;bookmark-bmenu-list&lt;/code&gt;, and quickly the update bookmark positions with
&lt;code&gt;bookmark-set&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s what I get when I call &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;bookmark-bmenu-list&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/bookmarks.png&quot; alt=&quot;bookmarks&quot;&gt;&lt;/p&gt;

&lt;p&gt;In the list above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;black bookmarks are files&lt;/li&gt;
&lt;li&gt;blue bookmarks are directories&lt;/li&gt;
&lt;li&gt;pink bookmarks are functions (you need &lt;code&gt;bookmark+&lt;/code&gt; for them)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The package should be available in MELPA soon.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Yet another youtube-dl interface for Emacs</title>
   <link href="https://oremacs.com/2015/01/05/youtube-dl/"/>
   <updated>2015-01-05T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/05/youtube-dl</id>
   <content type="html">&lt;p&gt;If you haven&amp;#39;t been living under a rock, you already know what
&lt;a href=&quot;https://www.youtube.com/&quot;&gt;Youtube&lt;/a&gt; is.  It&amp;#39;s a repository with videos of
varying degree of usefulness with a terrible media player tacked on.
Instead, I like to watch my videos in
&lt;a href=&quot;http://www.videolan.org/vlc/index.html&quot;&gt;VLC&lt;/a&gt;, which comes closest to
providing an Emacs-like experience among video players.&lt;/p&gt;

&lt;h2 id=&quot;useful-vlc-shortcuts&quot;&gt;Useful VLC shortcuts&lt;/h2&gt;

&lt;p&gt;Here is a list of shortcuts that really make me stick with VLC:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;f&lt;/kbd&gt; - toggle full-screen&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;b&lt;/kbd&gt; - toggle audio track&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;n&lt;/kbd&gt; - toggle subtitle track&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;&amp;#93;&lt;/kbd&gt; - speed up play by &lt;code&gt;0.1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;&amp;#91;&lt;/kbd&gt; - slow down play by &lt;code&gt;0.1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-right&lt;/kbd&gt; - forward by 15 seconds&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-left&lt;/kbd&gt; - backward by 15 seconds&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-right&lt;/kbd&gt; - forward by 60 seconds&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-left&lt;/kbd&gt; - backward by 60 seconds&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-1&lt;/kbd&gt; - quarter of video size&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-2&lt;/kbd&gt; - half of video size&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-3&lt;/kbd&gt; - full video size&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-4&lt;/kbd&gt; - double video size&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-h&lt;/kbd&gt; - toggle mouse buttons&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if you&amp;#39;re not watching instructional videos at &lt;code&gt;1.6&lt;/code&gt; speed,
or skipping the Simpsons intro sequence with &lt;kbd&gt;M-right&lt;/kbd&gt;, you&amp;#39;re missing out.&lt;/p&gt;

&lt;h2 id=&quot;from-youtube-to-vlc&quot;&gt;From Youtube to VLC&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/rg3/youtube-dl/&quot;&gt;youtube-dl&lt;/a&gt; is an excellent command-line tool
for saving the videos from Youtube. It downloads the highest resolution at a usually
higher speed than Youtube&amp;#39;s player buffers. I&amp;#39;ve discovered it when I had to download
a bunch of lecture videos from &lt;a href=&quot;https://www.edx.org/&quot;&gt;edX&lt;/a&gt;.
You can install it with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span&gt;&lt;/span&gt;sudo pip install youtube-dl
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;one-emacs-script-to-rule-them-all&quot;&gt;One Emacs script to rule them all&lt;/h2&gt;

&lt;p&gt;I quickly tired of opening a shell, setting the directory, entering
the command, and pasting the link. So I wrote some Elisp code that does it for me.
It&amp;#39;s nothing too sophisticated, but I&amp;#39;ve been using this version for a couple months:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;youtube-dl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current-kill&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;default-directory&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/Downloads&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-buffer-process&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ansi-term&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/bin/bash&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;term-send-string&lt;/span&gt;
     &lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;cd ~/Downloads &amp;amp;&amp;amp; youtube-dl &amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;How it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the link in Firefox&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;youtube-dl&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That&amp;#39;s it. A new &lt;code&gt;*ansi-term*&lt;/code&gt; will open with the task of downloading the video from the link
in the clipboard to &lt;code&gt;~/Downloads&lt;/code&gt;.
I don&amp;#39;t have to wait for the download to finish and can immediately open the video from &lt;code&gt;dired&lt;/code&gt;.
See &lt;a href=&quot;/2015/01/04/dired-nohup/&quot;&gt;the previous post&lt;/a&gt; for the description of
&lt;code&gt;dired&lt;/code&gt; process-starting setup. I can stack up multiple downloads at once if I wish in different
&lt;code&gt;*ansi-term*&lt;/code&gt;s.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is my script. There are many like it, but this one is mine.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I did an internet search before writing this post. Apparently many
others had the same idea of integrating &lt;code&gt;youtube-dl&lt;/code&gt; into Emacs.  You
can use mine or any other code to generate a setup that works for you.
For instance, for a while, instead of copy-pasting the URL and calling
&lt;code&gt;youtube-dl&lt;/code&gt; I used to just click the
&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/org-mode-capture/&quot;&gt;org-mode capture&lt;/a&gt;
button in Firefox, and it would automatically create a &lt;code&gt;TODO&lt;/code&gt; item,
download the video, and put the link to the downloaded video in the
&lt;code&gt;TODO&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I&amp;#39;ve dropped this workflow when
&lt;a href=&quot;http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16737&quot;&gt;the yank bug&lt;/a&gt;
surfaced. I don&amp;#39;t yet have enough experience of working with Emacs&amp;#39;s C
code to fix it.  Although, according to this
&lt;a href=&quot;https://plus.google.com/u/0/+JorgenSch%C3%A4fer/posts/ZaZcunihGqc&quot;&gt;excellent rant&lt;/a&gt;,
fixing the bug is only half of the problem: getting it merged is hard.
I&amp;#39;ll see how it goes with &lt;a href=&quot;http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19493&quot;&gt;my latest tiny patch&lt;/a&gt;.
So far it has been ignored, but it is only two days old as of now.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Start a process from dired</title>
   <link href="https://oremacs.com/2015/01/04/dired-nohup/"/>
   <updated>2015-01-04T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/04/dired-nohup</id>
   <content type="html">&lt;p&gt;Here are the standard &lt;code&gt;dired&lt;/code&gt; functions for starting processes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;!&lt;/kbd&gt; calls &lt;code&gt;dired-do-shell-command&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;&amp;amp;&lt;/kbd&gt; calls &lt;code&gt;dired-do-async-shell-command&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While the second one is usually better than the first one, having the
benefit of not locking up Emacs, it&amp;#39;s still not convenient enough for
me. The reason is pretty simple: I want to keep the processes that I
started even when I close Emacs (like opened PDFs or videos).  This is
a non-issue for people with months-long &lt;code&gt;emacs-uptime&lt;/code&gt;, but for me an
Emacs session lasts on the order of hours, since I mess about with
Elisp a lot. Below, I&amp;#39;ll share some of my &lt;code&gt;dired&lt;/code&gt; process-related
customizations.&lt;/p&gt;

&lt;h2 id=&quot;ignore-running-processes-when-closing-emacs&quot;&gt;Ignore running processes when closing Emacs&lt;/h2&gt;

&lt;p&gt;Usually there&amp;#39;s nothing wrong with just killing a spawned process,
like an &lt;code&gt;ipython&lt;/code&gt; shell or something.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;; add `flet&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;cl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defadvice&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;save-buffers-kill-emacs&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;around&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;no-query-kill-emacs&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;activate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Prevent \&amp;quot;Active processes exist\&amp;quot; query on exit.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;flet&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;process-list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()))&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ad-do-it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;guess-programs-by-file-extension&quot;&gt;Guess programs by file extension&lt;/h2&gt;

&lt;p&gt;With this setup, usually there&amp;#39;s no need to manually type in the
command name.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-guess-shell-alist-user&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.pdf\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;evince&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;okular&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.\\(?:djvu\\|eps\\)\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;evince&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.\\(?:jpg\\|jpeg\\|png\\|gif\\|xpm\\)\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;eog&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.\\(?:xcf\\)\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;gimp&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.csv\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;libreoffice&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.tex\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pdflatex&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;latex&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.\\(?:mp4\\|mkv\\|avi\\|flv\\|ogv\\)\\(?:\\.part\\)?\\&amp;#39;&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&amp;quot;vlc&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.\\(?:mp3\\|flac\\)\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;rhythmbox&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.html?\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;firefox&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;\\.cue?\\&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;audacious&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;add-nohup&quot;&gt;Add nohup&lt;/h2&gt;

&lt;p&gt;According to &lt;code&gt;info nohup&lt;/code&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;`nohup&amp;#39; runs the given COMMAND with hangup signals ignored, so that
the command can continue running in the background after you log
out.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In my case, it means that the processes started by Emacs can
continue running even when Emacs is closed.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-aux&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-filelist-cmd&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;vlc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;-L&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-start-process&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cmd&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;&amp;amp;optional&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file-list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-get-marked-files&lt;/span&gt;
                 &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;current-prefix-arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;list&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-read-shell-command&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;amp; on %s: &amp;quot;&lt;/span&gt;
                                &lt;span class=&quot;nv&quot;&gt;current-prefix-arg&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;list-switch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;start-process&lt;/span&gt;
     &lt;span class=&quot;nv&quot;&gt;cmd&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;shell-file-name&lt;/span&gt;
     &lt;span class=&quot;nv&quot;&gt;shell-command-switch&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;&amp;quot;nohup 1&amp;gt;/dev/null 2&amp;gt;/dev/null %s \&amp;quot;%s\&amp;quot;&amp;quot;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file-list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;list-switch&lt;/span&gt;
                     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;cadr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;assoc&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cmd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-filelist-cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;%s %s&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cmd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;list-switch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapconcat&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;expand-file-name&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file-list&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot; \&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;dired-filelist-cmd&lt;/code&gt; is necessary because &lt;code&gt;vlc&lt;/code&gt; weirdly
doesn&amp;#39;t make a playlist when given a list of files.&lt;/p&gt;

&lt;p&gt;Then I bind it to &lt;kbd&gt;r&lt;/kbd&gt; - a nice shortcut not bound
by default in &lt;code&gt;dired&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;dired-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;dired-start-process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Time flies</title>
   <link href="https://oremacs.com/2015/01/03/time-flies/"/>
   <updated>2015-01-03T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/03/time-flies</id>
   <content type="html">&lt;p&gt;This is the 15th post on this blog. Thankfully, no heart attacks after
the 13th one or anything.  So I&amp;#39;ll commemorate it with a post on
dealing with dates in &lt;code&gt;calc&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;how-much-time-has-passed-since-i-started-this-blog&quot;&gt;How much time has passed since I started this blog?&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open &lt;code&gt;calc&lt;/code&gt; with &lt;kbd&gt;C-x **&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;--- Emacs Calculator Mode ---
    .
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter &lt;code&gt;20 Dec 2014&lt;/code&gt; with &lt;kbd&gt;&amp;#39;&amp;lt;12 20 14&lt;/kbd&gt;&lt;kbd&gt;RET&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;--- Emacs Calculator Mode ---
1:  &amp;lt;Sat Dec 20, 2014&amp;gt;
    .
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter current time with &lt;kbd&gt;tN&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;--- Emacs Calculator Mode ---
2:  &amp;lt;Sat Dec 20, 2014&amp;gt;
1:  &amp;lt;11:56:27am Sat Jan 3, 2015&amp;gt;
    .
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Subtract with &lt;kbd&gt;-&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;--- Emacs Calculator Mode ---
1:  -14.498044
    .
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This means that, if I want to maintain my one-post-per-day streak, I
still have half of a day to post this. Unfortunately, I have only an
old version of the blog repository on this machine, and the current
one is on a laptop at home. So I&amp;#39;ll post this in the evening.&lt;/p&gt;

&lt;h2 id=&quot;did-you-know-what-2015-looks-like-in-binary&quot;&gt;Did you know what 2015 looks like in binary?&lt;/h2&gt;

&lt;p&gt;In your current &lt;code&gt;calc&lt;/code&gt; session,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Enter &lt;kbd&gt;2015&lt;/kbd&gt; &lt;kbd&gt;SPC&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;--- Emacs Calculator Mode ---
2:  -14.498044
1:  2015
    .
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Switch to binary with &lt;kbd&gt;d2&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;--- Emacs Calculator Mode ---
2:  -2#1110.011111110111111111001111110001
1:  2#11111011111
.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wow, a palindrome. It&amp;#39;s too spooky, switch back to decimal with &lt;kbd&gt;d0&lt;/kbd&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;--- Emacs Calculator Mode ---
2:  -14.498044
1:  2015
    .
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you&amp;#39;re new to &lt;code&gt;calc&lt;/code&gt;, you&amp;#39;ll probably wonder why you can&amp;#39;t enter
negative numbers with &lt;kbd&gt;-&lt;/kbd&gt;. It can be done with &lt;kbd&gt;_&lt;/kbd&gt;,
just like in
&lt;a href=&quot;http://www.jsoftware.com/help/primer/negative_number.htm&quot;&gt;J&lt;/a&gt;. Find
out more in the
&lt;a href=&quot;http://www.gnu.org/software/emacs/manual/html_mono/calc.html&quot;&gt;info&lt;/a&gt;;
the
&lt;a href=&quot;http://www.gnu.org/software/emacs/manual/html_mono/calc.html#Tutorial&quot;&gt;interactive tutorial&lt;/a&gt;
is absolutely excellent.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Wrap a region with a LaTeX environment</title>
   <link href="https://oremacs.com/2015/01/02/wrap-with-latex/"/>
   <updated>2015-01-02T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/02/wrap-with-latex</id>
   <content type="html">&lt;p&gt;Prompted by &lt;a href=&quot;http://stackoverflow.com/questions/27736102/wrap-text-around-a-selection-in-emacs&quot;&gt;this StackOverflow question&lt;/a&gt;,
I wrote down a new package called &lt;a href=&quot;https://github.com/abo-abo/latex-wrap&quot;&gt;latex-wrap&lt;/a&gt;.
It&amp;#39;s only a few hours old, but I like it a lot.
I&amp;#39;ve grepped the sources of AUCTeX, and it doesn&amp;#39;t seem to have this functionality.&lt;/p&gt;

&lt;h2 id=&quot;heres-how-it-works&quot;&gt;Here&amp;#39;s how it works&lt;/h2&gt;

&lt;p&gt;You start with an active region:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&lt;region&gt;Homer
Marge
Bart
Lisa
Maggie&lt;cursor&gt; &lt;/cursor&gt;
&lt;/region&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After calling &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;latex-wrap-region&lt;/code&gt; and selecting
&lt;em&gt;enumerate&lt;/em&gt; from the list of environments (others being &lt;em&gt;itemize&lt;/em&gt;,
&lt;em&gt;center&lt;/em&gt; etc.), you get this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-latex&quot; data-lang=&quot;latex&quot;&gt;&lt;span class=&quot;k&quot;&gt;\begin&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;enumerate&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;\item&lt;/span&gt; Homer
&lt;span class=&quot;k&quot;&gt;\item&lt;/span&gt; Marge
&lt;span class=&quot;k&quot;&gt;\item&lt;/span&gt; Bart
&lt;span class=&quot;k&quot;&gt;\item&lt;/span&gt; Lisa
&lt;span class=&quot;k&quot;&gt;\item&lt;/span&gt; Maggie&lt;cursor&gt; &lt;/cursor&gt;
&lt;span class=&quot;k&quot;&gt;\end&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;enumerate&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Let&amp;#39;s mark everything, &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;latex-wrap-region&lt;/code&gt;, and select
&lt;em&gt;center&lt;/em&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-latex&quot; data-lang=&quot;latex&quot;&gt;&lt;span class=&quot;k&quot;&gt;\begin&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;center&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;\begin&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;enumerate&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;\item&lt;/span&gt; Homer
  &lt;span class=&quot;k&quot;&gt;\item&lt;/span&gt; Marge
  &lt;span class=&quot;k&quot;&gt;\item&lt;/span&gt; Bart
  &lt;span class=&quot;k&quot;&gt;\item&lt;/span&gt; Lisa
  &lt;span class=&quot;k&quot;&gt;\item&lt;/span&gt; Maggie
  &lt;span class=&quot;k&quot;&gt;\end&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;enumerate&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;&lt;cursor&gt; &lt;/cursor&gt;
&lt;span class=&quot;k&quot;&gt;\end&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;{&lt;/span&gt;center&lt;span class=&quot;nb&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As you can see, I want to make sure that it&amp;#39;s possible to conveniently
continue by always placing the point on the end of the last line of
the inserted environment.&lt;/p&gt;

&lt;h2 id=&quot;how-it-works-with-no-active-region&quot;&gt;How it works with no active region&lt;/h2&gt;

&lt;p&gt;If &lt;code&gt;(looking-back &amp;quot;^ *&amp;quot;)&lt;/code&gt; is true, the current line is used as if it was
the region.  Otherwise, an empty environment is inserted after the
current line.&lt;/p&gt;

&lt;h2 id=&quot;using-the-code&quot;&gt;Using the code&lt;/h2&gt;

&lt;p&gt;If you like the idea, you can check out the code at
&lt;a href=&quot;https://github.com/abo-abo/latex-wrap&quot;&gt;github&lt;/a&gt; and test it out.  If
you know of another package that already does this, do let me know,
otherwise I&amp;#39;ll post the package on MELPA soon.  And if you have some
ideas, or want to add a few environments that I forgot to mention to
the list, just post
&lt;a href=&quot;https://github.com/abo-abo/latex-wrap/issues&quot;&gt;an issue&lt;/a&gt;, I don&amp;#39;t
bite.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Three ansi-term tips</title>
   <link href="https://oremacs.com/2015/01/01/three-ansi-term-tips/"/>
   <updated>2015-01-01T00:00:00+01:00</updated>
   <id>https://oremacs.com/2015/01/01/three-ansi-term-tips</id>
   <content type="html">&lt;h2 id=&quot;tip-1&quot;&gt;Tip #1&lt;/h2&gt;

&lt;p&gt;There&amp;#39;s no reason not to have &lt;code&gt;/bin/bash&lt;/code&gt; instead of &lt;code&gt;/bin/sh&lt;/code&gt; as the
default choice when you &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;term&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;explicit-shell-file-name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/bin/bash&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;tip-2&quot;&gt;Tip #2&lt;/h2&gt;

&lt;p&gt;After you close the terminal, you get a useless buffer with no
process. It&amp;#39;s probably left there for you to have a history of what
you did. I find it not useful, so here&amp;#39;s a way to kill that buffer
automatically:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-term-exec-hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;buff&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;current-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get-buffer-process&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;buff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set-process-sentinel&lt;/span&gt;
     &lt;span class=&quot;nv&quot;&gt;proc&lt;/span&gt;
     &lt;span class=&quot;o&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;process&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;event&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;finished\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;kill-buffer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;buff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;term-exec-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;oleh-term-exec-hook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;tip-3&quot;&gt;Tip #3&lt;/h2&gt;

&lt;p&gt;By default, &lt;kbd&gt;C-y&lt;/kbd&gt; calls term&amp;#39;s own &lt;code&gt;yank&lt;/code&gt;, which is different
from Emacs&amp;#39;s &lt;code&gt;yank&lt;/code&gt;.  So, until recently, I was using
&lt;kbd&gt;S-&amp;lt;insert&amp;gt;&lt;/kbd&gt; to paste stuff into &lt;code&gt;*term*&lt;/code&gt;. Here&amp;#39;s a
more ergonomic way:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;eval-after-load&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;term&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;term-raw-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-c C-y&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;term-paste&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>The keymap arms race</title>
   <link href="https://oremacs.com/2014/12/31/keymap-arms-race/"/>
   <updated>2014-12-31T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/31/keymap-arms-race</id>
   <content type="html">&lt;p&gt;Sometimes new Emacs packages have to fight for their place in the sun,
as all the good bindings and huge keymap areas are already taken by
the older packages. This post will cover some practical problems that
you may encounter when your package needs to be aware of another
active package.&lt;/p&gt;

&lt;h2 id=&quot;ace-window-vs-helm&quot;&gt;&lt;code&gt;ace-window&lt;/code&gt; vs. &lt;code&gt;helm&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/emacs-helm/helm&quot;&gt;helm&lt;/a&gt; is a wonderful package,
it&amp;#39;s my goto-package when I need completion. All of the following
packages use it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/function-args&quot;&gt;function-args&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/helm-make&quot;&gt;helm-make&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/worf&quot;&gt;worf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/abo-abo/helm-j-cheatsheet&quot;&gt;helm-j-cheatsheet&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But &lt;code&gt;helm&lt;/code&gt; is super-greedy: once you&amp;#39;re in the &lt;code&gt;helm&lt;/code&gt;-minibuffer,
there&amp;#39;s no way out except either a successful completion or a cancel.
But exiting the minibuffer for a short while may be useful. For
instance, you could copy some text and yank it in the
&lt;code&gt;helm&lt;/code&gt;-minibuffer.  The default minibuffer functions, as well as &lt;code&gt;ido&lt;/code&gt;
easily allow it.&lt;/p&gt;

&lt;p&gt;I started to investigate into this when I got
&lt;a href=&quot;https://github.com/abo-abo/ace-window/issues/15&quot;&gt;issue #15: Does not work with helm in minibuffer&lt;/a&gt;
for &lt;code&gt;ace-window&lt;/code&gt;. I checked it, and indeed you could not &lt;code&gt;ace-window&lt;/code&gt;
out of a &lt;code&gt;helm&lt;/code&gt;-minibuffer. In fact, it was not possible to exit with
&lt;code&gt;other-window&lt;/code&gt; either. This looked like good news, since I had an
inkling that it used to work at some point. So I checked out a
year-old version of &lt;code&gt;helm&lt;/code&gt; and it did work.&lt;/p&gt;

&lt;h3 id=&quot;magit-bisect-to-the-rescue&quot;&gt;&lt;code&gt;magit-bisect&lt;/code&gt; to the rescue!&lt;/h3&gt;

&lt;p&gt;It&amp;#39;s very simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check out the master of &lt;code&gt;helm&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;magit-bisect-start&lt;/code&gt; and mark &lt;code&gt;HEAD&lt;/code&gt; as &lt;em&gt;bad&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;magit&lt;/code&gt; will automatically check out a revision that is halfway
between a &lt;em&gt;bad&lt;/em&gt; state and the initial commit. Now I exit Emacs and try
&lt;code&gt;helm&lt;/code&gt; again to see if I can exit from the minibuffer.
It&amp;#39;s kind of lame to have to exit Emacs, but somehow I don&amp;#39;t trust
&lt;code&gt;unload-feature&lt;/code&gt; to do the right thing. Anyway, if the thing works,
move to &lt;code&gt;helm&lt;/code&gt;&amp;#39;s repository and call &lt;code&gt;magit-bisect-good&lt;/code&gt;, otherwise
call &lt;code&gt;magit-bisect-bad&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Continue this process until termination. I needed 10 iterations
in this case.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The culprit commit was &lt;a href=&quot;https://github.com/emacs-helm/helm/commit/61e85df&quot;&gt;this one&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;
&lt;span class=&quot;diff-context&quot;&gt;&lt;span class=&quot;region&quot;&gt;     (let* ((source (helm-get-current-source))
            (kmap (and (listp source) ; Check if source is empty.
                       (assoc-default 'keymap source))))
&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;diff-indicator-removed&quot;&gt;&lt;span class=&quot;region&quot;&gt;-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;diff-removed&quot;&gt;&lt;span class=&quot;region&quot;&gt;      (when kmap (setq overriding-local-map kmap)))))
&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;diff-indicator-added&quot;&gt;&lt;span class=&quot;region&quot;&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;diff-added&quot;&gt;&lt;span class=&quot;region&quot;&gt;      (when kmap (set-transient-map kmap)))))&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;h3 id=&quot;the-priority-of-maps&quot;&gt;the priority of maps&lt;/h3&gt;

&lt;p&gt;In Emacs, &lt;code&gt;set-transient-map&lt;/code&gt; has priority over
&lt;code&gt;overriding-local-map&lt;/code&gt;, which was exactly what &lt;code&gt;ace-window&lt;/code&gt; was using.
It&amp;#39;s also funny that &lt;code&gt;ace-window&lt;/code&gt; used to work with &lt;code&gt;helm&lt;/code&gt; for a week,
since it was published on &lt;code&gt;Mar 26&lt;/code&gt; and &lt;code&gt;helm&lt;/code&gt; switched to
&lt;code&gt;set-transient-map&lt;/code&gt; on &lt;code&gt;Apr 2&lt;/code&gt;. And I found out that it&amp;#39;s not working only
now.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s what &lt;code&gt;helm&lt;/code&gt; is using currently:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fboundp&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;set-transient-map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;set-transient-map&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;set-temporary-overlay-map&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So I&amp;#39;ve amended &lt;code&gt;ace-window&lt;/code&gt; with similar code. The way
&lt;code&gt;set-transient-map&lt;/code&gt; works, the last call to it overrides the previous
one, so I thought that it would work out since &lt;code&gt;ace-window&lt;/code&gt; is always
called after &lt;code&gt;helm&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It didn&amp;#39;t work out, because &lt;code&gt;helm&lt;/code&gt; adds the code that calls
&lt;code&gt;set-transient-map&lt;/code&gt; to &lt;code&gt;post-command-hook&lt;/code&gt;.
In the end, this finally worked:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;remove-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;post-command-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;helm--maybe-update-keymap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;lispy-vs-slime-and-cider&quot;&gt;&lt;code&gt;lispy&lt;/code&gt; vs. &lt;code&gt;SLIME&lt;/code&gt; and &lt;code&gt;CIDER&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;I thought that enabling &lt;code&gt;lispy-mode&lt;/code&gt; for &lt;code&gt;slime-repl-mode&lt;/code&gt; and
&lt;code&gt;cider-repl-mode&lt;/code&gt; might be a good idea.
Extra navigation options are always good, and the ability to
call &lt;code&gt;raise&lt;/code&gt; is just so useful.&lt;/p&gt;

&lt;p&gt;For instance, you start with:&lt;/p&gt;

&lt;pre&gt;
; SLIME 2014-11-28
&lt;span class=&quot;slime-repl-prompt&quot;&gt;CL-USER&amp;gt; &lt;/span&gt;&lt;span class=&quot;slime-repl-old&quot;&gt;(expt (expt 2 10) 3)&lt;/span&gt;
&lt;span class=&quot;slime-repl-result&quot;&gt;&lt;span class=&quot;slime-repl-inputed-output&quot;&gt;1073741824&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;slime-repl-result&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;slime-repl-prompt&quot;&gt;CL-USER&amp;gt; &lt;cursor&gt; &lt;/cursor&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;With &lt;code&gt;lispy-mode&lt;/code&gt; on you can: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;kbd&gt;M-p&lt;/kbd&gt; to get the previous input&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;f&lt;/kbd&gt; to move the cursor after &lt;code&gt;(expt 2 10)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;r&lt;/kbd&gt; to raise &lt;code&gt;(expt 2 10)&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here&amp;#39;s the final state:&lt;/p&gt;

&lt;pre&gt;
; SLIME 2014-11-28
&lt;span class=&quot;slime-repl-prompt&quot;&gt;CL-USER&amp;gt; &lt;/span&gt;&lt;span class=&quot;slime-repl-old&quot;&gt;(expt (expt 2 10) 3)&lt;/span&gt;
&lt;span class=&quot;slime-repl-result&quot;&gt;&lt;span class=&quot;slime-repl-inputed-output&quot;&gt;1073741824&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;slime-repl-result&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;slime-repl-prompt&quot;&gt;CL-USER&amp;gt;&lt;/span&gt; (expt 2 10)&lt;cursor&gt; &lt;/cursor&gt;&lt;/pre&gt;

&lt;p&gt;But the problem was that SLIME has &lt;code&gt;slime-repl-map-mode&lt;/code&gt; minor mode on
that competes for &lt;code&gt;lispy&lt;/code&gt;&amp;#39;s shortcuts, and CIDER has something similar
as well.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When two minor modes bind the same keys, which one wins?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer is the first one on &lt;code&gt;minor-mode-map-alist&lt;/code&gt;.
This function I&amp;#39;ve found on the &lt;a href=&quot;http://www.emacswiki.org/emacs/minor-mode-hack.el&quot;&gt;wiki&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-raise-minor-mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Make MODE the first on &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`minor-mode-map-alist&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;assq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mode&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;minor-mode-map-alist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;minor-mode-map-alist&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mode&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;minor-mode-map-alist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I didn&amp;#39;t want &lt;code&gt;lispy-mode&lt;/code&gt; to mess with &lt;code&gt;minor-mode-map-alist&lt;/code&gt; too
actively, so I went with this approach: if &lt;code&gt;lispy-mode&lt;/code&gt; is called
interactively, i.e. via a key binding or &lt;kbd&gt;M-x&lt;/kbd&gt;, put it ahead:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;called-interactively-p&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;any&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapc&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;#&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-raise-minor-mode&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;lispy-mode&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;lispy-known-verbs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It&amp;#39;s still a work in progress, currently only &lt;code&gt;lispy&lt;/code&gt;&amp;#39;s &lt;kbd&gt;RET&lt;/kbd&gt;
properly yields to call &lt;code&gt;cider-repl-return&lt;/code&gt; and &lt;code&gt;slime-repl-return&lt;/code&gt;
respectively. I&amp;#39;ll see if there are more key bindings that need to
yield. Happy coding in the New Year!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Emacs Web Wowser (EWW) got ace-link</title>
   <link href="https://oremacs.com/2014/12/30/ace-link-eww/"/>
   <updated>2014-12-30T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/30/ace-link-eww</id>
   <content type="html">&lt;h2 id=&quot;emacs-goodness-incoming&quot;&gt;Emacs goodness incoming&lt;/h2&gt;

&lt;p&gt;I&amp;#39;ve discovered a nice Emacs-related blog -
&lt;a href=&quot;http://mbork.pl/Content_AND_Presentation&quot;&gt;Content AND Presentation&lt;/a&gt;.
Unlike &lt;a href=&quot;http://axisofeval.blogspot.nl&quot;&gt;The Axis of Eval&lt;/a&gt;, the blog
that I mentioned yesterday, this one is pretty self-contained, i.e. it
doesn&amp;#39;t link to many external information sources.  So I thought that
it&amp;#39;s perfect for trying EWW to read it.&lt;/p&gt;

&lt;h2 id=&quot;not-so-fast-configure-first&quot;&gt;Not so fast! Configure first.&lt;/h2&gt;

&lt;p&gt;For modes that don&amp;#39;t require to self-insert (and even for some that
do), I like to navigate with
&lt;kbd&gt;h&lt;/kbd&gt;/&lt;kbd&gt;j&lt;/kbd&gt;/&lt;kbd&gt;k&lt;/kbd&gt;/&lt;kbd&gt;l&lt;/kbd&gt; as arrows.  These
arrows are on the home row, so navigation becomes a pleasant and
relaxed experience.  But for EWW I decided to add a little twist: if
the point is in the first column, &lt;kbd&gt;j&lt;/kbd&gt;/&lt;kbd&gt;k&lt;/kbd&gt; will move
down/up not by one line, but by one paragraph.  This is great for
concentration: I navigate to a paragraph, read it, navigate to the
next one. The point shows me the paragraph that I&amp;#39;m reading,
everything before the point I&amp;#39;ve already read.  So every time I press
&lt;kbd&gt;j&lt;/kbd&gt;, I get a tiny warm feeling of accomplishment.
I can also pair this with &lt;kbd&gt;v&lt;/kbd&gt;, which I bind to recenter the
current line to the top.&lt;/p&gt;

&lt;p&gt;So here&amp;#39;s what my key setup currently looks like:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-eww-hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;oww-down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;oww-up&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;forward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;L&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;eww-back-url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;backward-char&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;recenter-top-bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;V&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;eww-view-source&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;eww-follow-link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;move-beginning-of-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;move-end-of-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-link-eww&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;y&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;eww&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;eww-mode-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;oleh-eww-hook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you see, I was careful to re-assign &lt;code&gt;eww-back-url&lt;/code&gt; and
&lt;code&gt;eww-view-source&lt;/code&gt; - the commands that I&amp;#39;ve displaced from &lt;kbd&gt;l&lt;/kbd&gt;
and &lt;kbd&gt;v&lt;/kbd&gt;.  And here&amp;#39;s the implementation of the arrows:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oww-down&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;bolp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;forward-paragraph&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forward-line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;line-move&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oww-up&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;bolp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forward-line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;backward-paragraph&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forward-line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;line-move&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;cherry-on-the-top&quot;&gt;Cherry on the top&lt;/h2&gt;

&lt;p&gt;And while I was at it, I&amp;#39;ve added &lt;a href=&quot;https://github.com/abo-abo/ace-link&quot;&gt;ace-link&lt;/a&gt; support for EWW.  It was
pretty easy, basically the same routine as for &lt;code&gt;help-mode&lt;/code&gt; and
&lt;code&gt;info-mode&lt;/code&gt;. The only hard part was to figure out what part of the
code keeps binding &lt;code&gt;shr-save-contents&lt;/code&gt; to &lt;kbd&gt;o&lt;/kbd&gt;, my preferred
binding for &lt;code&gt;ace-link&lt;/code&gt;. Turns out it was &lt;code&gt;eww-link-keymap&lt;/code&gt;, and not
&lt;code&gt;shr-map&lt;/code&gt;. So here&amp;#39;s the new key binding code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-link-setup-default&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Setup the defualt shortcuts.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;eval-after-load&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;info&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Info-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-link-info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;eval-after-load&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;help-mode&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;help-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-link-help&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;eval-after-load&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;eww&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-link-keymap&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-link-eww&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;eww-mode-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-link-eww&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you haven&amp;#39;t tried &lt;a href=&quot;https://github.com/abo-abo/ace-link&quot;&gt;ace-link&lt;/a&gt;
before, you can get it from MELPA.  The minimal configuration that you
need is this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-link-setup-default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here&amp;#39;s the setup that I&amp;#39;m actually using:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;use-package&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-link&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;:load-path&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;~/git/ace-link&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;:init&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ace-link-setup-default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I&amp;#39;m using it from my git folder since when I want to edit a project, I
like to use &lt;a href=&quot;https://github.com/nonsequitur/smex&quot;&gt;smex&lt;/a&gt;&amp;#39;s
jump-to-definition.&lt;/p&gt;

&lt;p&gt;And &lt;a href=&quot;https://github.com/jwiegley/use-package&quot;&gt;use-package&lt;/a&gt; is useful
for the cases when my &lt;code&gt;~/git/&lt;/code&gt; happens not to contain &lt;code&gt;ace-link&lt;/code&gt;.  In
that case, instead of getting a debugger error on starting Emacs, I
get only a polite &amp;quot;Could not load package ace-link&amp;quot; in my &lt;code&gt;*Messages*&lt;/code&gt;
buffer.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Monkeying around with JavaScript</title>
   <link href="https://oremacs.com/2014/12/29/monkeying-around-with-javascript/"/>
   <updated>2014-12-29T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/29/monkeying-around-with-javascript</id>
   <content type="html">&lt;h2 id=&quot;exciting-encounter&quot;&gt;Exciting encounter&lt;/h2&gt;

&lt;p&gt;Recently, I happened upon a wonderful blog called
&lt;a href=&quot;http://axisofeval.blogspot.nl&quot;&gt;The Axis of Eval&lt;/a&gt;.  I knew that I&amp;#39;d
love it just when I read the name. &lt;a href=&quot;/&quot;&gt;(or emacs&lt;/a&gt; pales in comparison,
but I couldn&amp;#39;t just sit on my hands for months or years while thinking
up a perfect blog name. If you think of a blog name as awesome as &amp;quot;The
Axis of Eval&amp;quot; and are willing to let me use it, I&amp;#39;ll probably make the
switch.&lt;/p&gt;

&lt;p&gt;The blog did not disappoint, featuring gems like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In the Lisp world, new languages are built by combining large,
battle-tested building blocks, and polishing or updating them when
needed, instead of starting over from toothpicks and double-sided
duct tape. A large Lisp like Common Lisp is like a toolchain of
decades-old tools that have proven their worth, and have been
codified in standards, folklore, and implementations.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The only thing in the way of extracting information and enjoyment from
this blog was the horrendous theme of black background, white
foreground and magenta links. Plus the RSS was kind of quirky, and I
couldn&amp;#39;t just feed all of it into
&lt;a href=&quot;https://github.com/skeeto/elfeed&quot;&gt;Elfeed&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;greasemonkey-to-the-rescue&quot;&gt;Greasemonkey to the rescue!&lt;/h2&gt;

&lt;p&gt;In the previous post I&amp;#39;ve mentioned that, in addition to using
&lt;a href=&quot;http://www.gnu.org/software/emacs/&quot;&gt;the best editor&lt;/a&gt;, I&amp;#39;m using
&lt;a href=&quot;https://www.mozilla.org/en-US/firefox/new/&quot;&gt;the best browser&lt;/a&gt;.  Well,
this particular best browser has an extension called
&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/&quot;&gt;Greasemonkey&lt;/a&gt;
that allows you to automatically run your own JavaScript on certain
websites.&lt;/p&gt;

&lt;p&gt;I&amp;#39;m not very proficient in JavaScript, the following code I just found
by searching around. The part to note is the &lt;code&gt;@include&lt;/code&gt; - the pattern
of website names for which this script should be run automatically.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// ==UserScript==&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// @name        background&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// @namespace   abo-abo&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// @include     http://axisofeval.blogspot.nl/*&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// @version     1&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// @grant       none&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// ==/UserScript==&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;body&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;style&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                      &lt;span class=&quot;s2&quot;&gt;&amp;quot;background-color: #ffffff; color:#000&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;nodesArray&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementsByTagName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;nodesArray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;nodesArray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;red&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I can barely stand to look at it. How could you take Scheme and turn
it into this monstrosity? Such a shame. But it works, so I guess
everyone should learn JavaScript. All hail the mighty
&lt;s&gt;HypnoToad&lt;/s&gt; JavaScript!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Throwing abbrevs into the mix</title>
   <link href="https://oremacs.com/2014/12/28/trying-abbrevs/"/>
   <updated>2014-12-28T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/28/trying-abbrevs</id>
   <content type="html">&lt;p&gt;Currently, I&amp;#39;m using two methods for completing Elisp: &lt;code&gt;company-mode&lt;/code&gt;
and &lt;code&gt;helm-lisp-completion-at-point&lt;/code&gt;. The latter is the cannon, the big
gun: it always gets the job done, but I don&amp;#39;t want to shoot at
sparrows with it. So I only bring it out for hairy cases, like for
stuff that starts with &lt;code&gt;LaTeX-&lt;/code&gt;. Hence, the &lt;code&gt;company-mode&lt;/code&gt;.  But too
often have I typed &lt;code&gt;region-&lt;/code&gt; only to find 7 candidates staring at me,
4 of them useless. Which prompted me to look for an additional
completion method.&lt;/p&gt;

&lt;h2 id=&quot;enter-abbrevs&quot;&gt;Enter abbrevs&lt;/h2&gt;

&lt;p&gt;According to the &lt;a href=&quot;http://www.gnu.org/software/emacs/manual/html_node/emacs/Abbrevs.html&quot;&gt;manual&lt;/a&gt;,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A defined &amp;quot;abbrev&amp;quot; is a word which &amp;quot;expands&amp;quot;, if you insert it, into
some different text&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Also,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Abbrevs can have &amp;quot;mode-specific&amp;quot; definitions, active only in one
major mode&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sounds like something that could solve my problem with &lt;code&gt;region-&lt;/code&gt; commands:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;rb -&amp;gt; region-beginning
re -&amp;gt; region-end
ra -&amp;gt; region-active-p
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Also, obviously,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Abbrevs expand only when Abbrev mode, a buffer-local minor mode, is
enabled&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Add it to the mix:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-emacs-lisp-hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;outline-regexp&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;;; ———&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;company-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;abbrev-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make-local-variable&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;company-backends&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;company-elisp&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;:with&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;company-dabbrev-code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;yas-minor-mode-on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;auto-compile-mode&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;some-data-acquisition&quot;&gt;Some data acquisition&lt;/h2&gt;

&lt;p&gt;I had the whole abbrev thing in the back of my mind until I saw a link
to the post
&lt;a href=&quot;https://groups.google.com/forum/#!topic/gnu.emacs.help/kHvUcFdiXFM&quot;&gt;Abbrevs for the most frequent elisp symbols&lt;/a&gt;.
That&amp;#39;s when I decided to act.
That post eventually links to a pastebin, where 1600 abbrevs are defined.
With my handy &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/its-all-text/&quot;&gt;best extension&lt;/a&gt;
for &lt;a href=&quot;https://www.mozilla.org/en-US/firefox/new/&quot;&gt;best browser&lt;/a&gt; I&amp;#39;ve opened
the paste in &lt;s&gt;Emacs&lt;/s&gt; &lt;a href=&quot;http://www.gnu.org/software/emacs/&quot;&gt;best editor&lt;/a&gt; by just clicking the &lt;strong&gt;edit&lt;/strong&gt; button
in the &lt;em&gt;RAW Paste Data&lt;/em&gt; section.&lt;/p&gt;

&lt;p&gt;I had to &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;emacs-lisp-mode&lt;/code&gt;, since the file opened in
&lt;code&gt;text-mode&lt;/code&gt;. And boy, it&amp;#39;s big. In &lt;code&gt;lispy-mode&lt;/code&gt;, I usually use
&lt;kbd&gt;99j&lt;/kbd&gt; to navigate 99 sexps down and therefore to the end of
the list. Well, for this file even &lt;kbd&gt;999j&lt;/kbd&gt; wasn&amp;#39;t enough.
I quickly tired of deleting one-by-one the each individual useless abbrev.
I mean:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;ek -&amp;gt; echo-keystrokes,
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;when is that ever going to be useful? So I wrote this throw-away code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;foobar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-mark-list&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy--string-dwim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;other-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;count-matches&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;other-window&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-out-backward&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;deactivate-mark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-delete&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;%d&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;local-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;foobar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After switching to a two-pane window layout, with point in the
pastebin buffer, calling &lt;code&gt;foobar&lt;/code&gt; would count the amount of the abbrev
matches in
&lt;a href=&quot;https://github.com/abo-abo/lispy/commits/master&quot;&gt;my most frequent elisp buffer&lt;/a&gt;.
If it was less than 5, the abbrev was auto-deleted, otherwise the
decision was up to me, as holding &lt;kbd&gt;C-.&lt;/kbd&gt; would no longer
delete. In the end, there were only 56 abbrevs left out of 1600.&lt;/p&gt;

&lt;h2 id=&quot;the-final-result&quot;&gt;The final result&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s what I have put into my &lt;code&gt;abbrev_defs&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;define-abbrev-table&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;emacs-lisp-mode-abbrev-table&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sm&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;string-match&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;mm&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;major-mode&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;region-beginning&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ca&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;char-after&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;smd&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;save-match-data&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;mb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;match-beginning&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;pm&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;point-min&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ir&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;indent-region&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sf&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;search-forward&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ci&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;call-interactively&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;symbol-name&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;se&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;save-excursion&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;scb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;skip-chars-backward&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;forward-char&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ff&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;find-file&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fs&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;forward-sexp&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;pa&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;prefix-arg&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;re&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;region-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;delete-char&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ms&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;match-string&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;tc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;this-command&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dd&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;default-directory&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;backward-char&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rsf&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;re-search-forward&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;snp&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;substring-no-properties&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bsnp&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;buffer-substring-no-properties&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;lep&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;line-end-position&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bs&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;buffer-substring&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;cc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;condition-case&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ul&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;up-list&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bfn&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;buffer-file-name&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;lb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;looking-back&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;tap&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;thing-at-point&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rm&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;replace-match&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fl&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;forward-line&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;df&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;declare-function&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ntr&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;narrow-to-region&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dr&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;delete-region&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rsb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;re-search-backward&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;scf&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;skip-chars-forward&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;wcb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;with-current-buffer&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ie&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;ignore-errors&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;gc&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;goto-char&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;jos&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;just-one-space&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;la&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;looking-at&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;ow&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;other-window&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dk&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;define-key&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dm&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;deactivate-mark&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;bod&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;beginning-of-defun&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sic&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;self-insert-command&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;eol&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;end-of-line&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;me&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;match-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;nai&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;newline-and-indent&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;cb&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;current-buffer&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;atl&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;add-to-list&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;rris&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;replace-regexp-in-string&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Mmm... minty</title>
   <link href="https://oremacs.com/2014/12/27/mmm-minty/"/>
   <updated>2014-12-27T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/27/mmm-minty</id>
   <content type="html">&lt;h2 id=&quot;the-backstory&quot;&gt;The backstory&lt;/h2&gt;

&lt;p&gt;In &lt;a href=&quot;/2014/12/24/light-it-up/&quot;&gt;one of the earlier posts&lt;/a&gt;,
I was discussing the implementation of an Emacs Lisp lexer for
&lt;a href=&quot;http://pygments.org/&quot;&gt;Pygments&lt;/a&gt;. Here, I&amp;#39;ll show how to install the
update and get nicely highlighted code in a pdf via the
&lt;a href=&quot;http://code.google.com/p/minted&quot;&gt;minted&lt;/a&gt; LaTeX package.&lt;/p&gt;

&lt;h2 id=&quot;the-install&quot;&gt;The install&lt;/h2&gt;

&lt;p&gt;Assuming that you are on a Debian-related system:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;sudo apt-get install mercurial
mkdir ~/git &amp;amp;&amp;amp; cd ~/git
hg clone https://bitbucket.org/abo-abo/pygments-main
cd pygments-main
make mapfiles
sudo python setup.py install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And, of course, I&amp;#39;m assuming that you already have TeX Live installed.
I&amp;#39;m not too sophisticated about it, so I just install everything:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;sudo apt-get install texlive-full
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;the-result&quot;&gt;The result&lt;/h2&gt;

&lt;p&gt;So here I took some code from
&lt;a href=&quot;/2014/12/25/ode-to-toggle/&quot;&gt;a previous post&lt;/a&gt; and
copy-pasted it into &lt;a href=&quot;/download/minty.org&quot;&gt;minty.org&lt;/a&gt; file.
And here&amp;#39;s the result of the PDF export (&lt;kbd&gt;C-c C-e lo&lt;/kbd&gt;):
&lt;a href=&quot;/download/minty.pdf&quot;&gt;minty.pdf&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-red-tape&quot;&gt;The red tape&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;org-mode&lt;/code&gt; had trouble exporting on my laptop until I did this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;cd /usr/bin/
sudo ln -s /usr/local/texlive/2013/bin/x86_64-linux/pdflatex
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Also be mindful of the &lt;code&gt;-shell-escape&lt;/code&gt; flag to &lt;code&gt;pdflatex&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-latex-pdf-process&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;&amp;quot;pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>tiny.el - the little package that could</title>
   <link href="https://oremacs.com/2014/12/26/the-little-package-that-could/"/>
   <updated>2014-12-26T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/26/the-little-package-that-could</id>
   <content type="html">&lt;h2 id=&quot;the-challenge&quot;&gt;The Challenge&lt;/h2&gt;

&lt;p&gt;It all started with a heated discussion with the author of
&lt;a href=&quot;https://github.com/capitaomorte/yasnippet&quot;&gt;yasnippet&lt;/a&gt; over some minor
nonsense. In the end, we agreed to disagree, but not before he suggested:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;So I hereby challenge you to create this stripped down, no-crap,
version of yasnippet. Dub it &amp;quot; tiny is not yasnippet &amp;quot; after your
grandiose views and in the glorious unix tradition of recursive
acronyms&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;the-thought-process&quot;&gt;The Thought Process&lt;/h2&gt;

&lt;p&gt;Well, doing exactly that would probably be lame, but I really loved
the acronym. Somewhere around that time I saw some post about using
eval-and-replace, i.e. inserting some Elisp in your non-Elisp buffer
and then replacing that code in-place with the result of the eval.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the type of code that I was playing around with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapcar&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;number-sequence&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then I realized that the code should probably produce a string.
Here&amp;#39;s a more refined version:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mapconcat&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;hex: 0x%x&amp;quot;&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;number-sequence&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;s&quot;&gt;&amp;quot;;\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Loops are a useful thing to have, they are a blind spot of
&lt;code&gt;yasnippet&lt;/code&gt;, and looping is exactly what the code above does.  The
parameters for this loop expansion are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;integer range start: &lt;code&gt;1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;integer range end: &lt;code&gt;7&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;separator to join the expressions: &lt;code&gt;&amp;quot;;\n&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Elisp expression to transform the linear range: &lt;code&gt;(* x x)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;format&lt;/code&gt; expression for the result: &lt;code&gt;&amp;quot;hex: 0x%x&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So ideally, in order to have a package called &lt;code&gt;tiny&lt;/code&gt;, I&amp;#39;d like to
keep only the parameters and throw away everything else.&lt;/p&gt;

&lt;h2 id=&quot;the-result&quot;&gt;The Result&lt;/h2&gt;

&lt;p&gt;Here&amp;#39;s the final result of the shortening, and what &lt;code&gt;tiny-expand&lt;/code&gt; would produce:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#demo-1&quot;&gt;&lt;code&gt;m1;\n7*xx|hex: 0x%x&lt;/code&gt;&lt;/button&gt;
&lt;div id=&quot;demo-1&quot; class=&quot;collapse&quot;&gt;
&lt;pre&gt;&lt;code&gt;
hex: 0x1;
hex: 0x4;
hex: 0x9;
hex: 0x10;
hex: 0x19;
hex: 0x24;
hex: 0x31
&lt;/pre&gt;&lt;/code&gt;
&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;As you see, it&amp;#39;s pretty compact, with only two characters which are not
actually the parameters of the template:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;m&lt;/code&gt; signifies the start of the template. I think this way is much
better than something like having to mark the template body with a
region before expanding. &lt;code&gt;tiny-expand&lt;/code&gt; should be called from the end
of the snippet, so there&amp;#39;s no need to mark the end position.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;|&lt;/code&gt; signifies the end of the Elisp expression and the start of the format string.
It can be omitted if your format string starts with a &lt;code&gt;%&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note also the use of shortened Elisp. You can still use the full thing
if you want.  Or just use only the closing parens to resolve the
ambiguities.&lt;/p&gt;

&lt;h2 id=&quot;the-demos&quot;&gt;The Demos&lt;/h2&gt;

&lt;p&gt;Here are some more snippets, you can click on them to see what they
expand to. You can also find them and more in the comments section of
the source code:
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-2&quot;&gt; &lt;code&gt;m10&lt;/code&gt;
&lt;/button&gt; &lt;div id=&quot;demo-2&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;0 1 2 3 4 5 6 7 8 9 10
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-3&quot;&gt;&lt;code&gt;m5 10&lt;/code&gt;&lt;/button&gt;
&lt;div id=&quot;demo-3&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;5 6 7 8 9 10
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-4&quot;&gt;&lt;code&gt;m5,10&lt;/code&gt;&lt;/button&gt;
&lt;div id=&quot;demo-4&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;5,6,7,8,9,10
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-5&quot;&gt;&lt;code&gt;m5 10*xx&lt;/code&gt;&lt;/button&gt;
&lt;div id=&quot;demo-5&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;25 36 49 64 81 100
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-6&quot;&gt;&lt;code&gt;m5 10*xx%x&lt;/code&gt;&lt;/button&gt;
&lt;div id=&quot;demo-6&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;19 24 31 40 51 64
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-7&quot;&gt;&lt;code&gt;m5 10*xx|0x%x&lt;/code&gt;&lt;/button&gt;
&lt;div id=&quot;demo-7&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;0x19 0x24 0x31 0x40 0x51 0x64
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-8&quot;&gt;
&lt;code&gt;m25+x?a%c&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-8&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;a b c d e f g h i j k l m n o p q r s t u v w x y z
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-9&quot;&gt;
&lt;code&gt;m25+x?A%c&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-9&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-10&quot;&gt;
&lt;code&gt;m97,122(string x)&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-10&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-11&quot;&gt;
&lt;code&gt;m97,122stringxx&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-11&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww,xx,yy,zz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-12&quot;&gt;
&lt;code&gt;m97,120stringxupcasex&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-12&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;aA,bB,cC,dD,eE,fF,gG,hH,iI,jJ,kK,lL,mM,nN,oO,pP,qQ,rR,sS,tT,uU,vV,wW,xX
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-13&quot;&gt;
&lt;code&gt;m97,120stringxupcasex)x&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-13&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;aAa,bBb,cCc,dDd,eEe,fFf,gGg,hHh,iIi,jJj,kKk,lLl,mMm,nNn,oOo,pPp,qQq,rRr,sSs,tTt,uUu,vVv,wWw,xXx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-14&quot;&gt;
&lt;code&gt;m\n10|%(+ x x) and %(* x x) and %s&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-14&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;0 and 0 and 0
2 and 1 and 1
4 and 4 and 2
6 and 9 and 3
8 and 16 and 4
10 and 25 and 5
12 and 36 and 6
14 and 49 and 7
16 and 64 and 8
18 and 81 and 9
20 and 100 and 10
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-15&quot;&gt;
&lt;code&gt;m10*2+3x&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-15&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;6 8 10 12 14 16 18 20 22 24 26
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-16&quot;&gt;
&lt;code&gt;m\n10expx&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-16&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;1.0
2.718281828459045
7.38905609893065
20.085536923187668
54.598150033144236
148.4131591025766
403.4287934927351
1096.6331584284585
2980.9579870417283
8103.083927575384
22026.465794806718
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-17&quot;&gt;
&lt;code&gt;m1\n20expx%014.2f&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-17&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;00000000002.72
00000000007.39
00000000020.09
00000000054.60
00000000148.41
00000000403.43
00000001096.63
00000002980.96
00000008103.08
00000022026.47
00000059874.14
00000162754.79
00000442413.39
00001202604.28
00003269017.37
00008886110.52
00024154952.75
00065659969.14
00178482300.96
00485165195.41
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-18&quot;&gt;
&lt;code&gt;m7|%(expt 2 x)&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-18&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;1 2 4 8 16 32 64 128
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-19&quot;&gt;
&lt;code&gt;m, 7|0x%02x&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-19&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-20&quot;&gt;
&lt;code&gt;m10|%0.2f&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-20&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;0.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-21&quot;&gt;
&lt;code&gt;m1\n14|* TODO http://emacsrocks.com/e%02d.html&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-21&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;* TODO http://emacsrocks.com/e01.html
* TODO http://emacsrocks.com/e02.html
* TODO http://emacsrocks.com/e03.html
* TODO http://emacsrocks.com/e04.html
* TODO http://emacsrocks.com/e05.html
* TODO http://emacsrocks.com/e06.html
* TODO http://emacsrocks.com/e07.html
* TODO http://emacsrocks.com/e08.html
* TODO http://emacsrocks.com/e09.html
* TODO http://emacsrocks.com/e10.html
* TODO http://emacsrocks.com/e11.html
* TODO http://emacsrocks.com/e12.html
* TODO http://emacsrocks.com/e13.html
* TODO http://emacsrocks.com/e14.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;button type=&quot;button&quot; class=&quot;btn btn-info&quot;
data-toggle=&quot;collapse&quot; data-target=&quot;#demo-22&quot;&gt;
&lt;code&gt;m\n8|* TODO Wash dog %(+ x 2) \nDEADLINE: &amp;lt;%(date &amp;quot;Jan 1&amp;quot; (* x 5))&amp;gt;&lt;/code&gt;
&lt;/button&gt;
&lt;div id=&quot;demo-22&quot; class=&quot;collapse&quot;&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;* TODO Wash dog 2
DEADLINE: &amp;lt;2015-01-01 Thu&amp;gt;
* TODO Wash dog 3
DEADLINE: &amp;lt;2015-01-06 Tue&amp;gt;
* TODO Wash dog 4
DEADLINE: &amp;lt;2015-01-11 Sun&amp;gt;
* TODO Wash dog 5
DEADLINE: &amp;lt;2015-01-16 Fri&amp;gt;
* TODO Wash dog 6
DEADLINE: &amp;lt;2015-01-21 Wed&amp;gt;
* TODO Wash dog 7
DEADLINE: &amp;lt;2015-01-26 Mon&amp;gt;
* TODO Wash dog 8
DEADLINE: &amp;lt;2015-01-31 Sat&amp;gt;
* TODO Wash dog 9
DEADLINE: &amp;lt;2015-02-05 Thu&amp;gt;
* TODO Wash dog 10
DEADLINE: &amp;lt;2015-02-10 Tue&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;You can expand them one-by-one to see what they do.  As you can see,
Ruby-style interpolation is available in the format string.  There&amp;#39;s
also one special function called &lt;code&gt;date&lt;/code&gt; that you can use there.  It
takes the start date as a string (&lt;code&gt;&amp;quot;Jan 1&amp;quot;&lt;/code&gt; in the example) and an
integer shift and prints an &lt;code&gt;org&lt;/code&gt;-style date.&lt;/p&gt;

&lt;h2 id=&quot;the-full-syntax&quot;&gt;The full syntax&lt;/h2&gt;

&lt;p&gt;The full syntax for the snippet is:&lt;/p&gt;

&lt;pre style=&quot;font-size: 0.6em&quot;&gt;&lt;code&gt;m{range start:=0}{separator:= }{range end}{Lisp expr:=indentity}|{format expr:=%d}&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;You always start with &lt;code&gt;m&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then optional &lt;code&gt;range start&lt;/code&gt; that defaults to &lt;code&gt;0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then optional &lt;code&gt;separator&lt;/code&gt; that defaults to a single space.&lt;/li&gt;
&lt;li&gt;Then mandatory &lt;code&gt;range end&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then optional &lt;code&gt;Lisp expr&lt;/code&gt;, that defaults to &lt;code&gt;identity&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then optional &lt;code&gt;format&lt;/code&gt;-style string, that defaults to &lt;code&gt;%d&lt;/code&gt;. You have
to separate it with &lt;code&gt;|&lt;/code&gt; if the format string does not start with
&lt;code&gt;%&lt;/code&gt;. You can also Ruby-style interpolation here, e.g. &lt;code&gt;%(* x x)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;With the point at the end of the snippet, &lt;kbd&gt;M-x&lt;/kbd&gt;&lt;code&gt;tiny-expand&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;the-summary&quot;&gt;The Summary&lt;/h2&gt;

&lt;p&gt;In the end, &lt;a href=&quot;https://github.com/abo-abo/tiny&quot;&gt;tiny&lt;/a&gt; lives up to the name,
implementing only one snippet that can be used in a variety of ways.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;tiny is not yasnippet&lt;/p&gt;
&lt;/blockquote&gt;
</content>
 </entry>
 
 <entry>
   <title>Ode to the toggle</title>
   <link href="https://oremacs.com/2014/12/25/ode-to-toggle/"/>
   <updated>2014-12-25T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/25/ode-to-toggle</id>
   <content type="html">&lt;p&gt;Man, I just love toggles: the light switches, the
&lt;kbd&gt;f&lt;/kbd&gt; - full-screen key in &lt;code&gt;vlc&lt;/code&gt;, and the clicky pens (ooh, those
are the best). So I try to model some of my Emacs key bindings as
toggles.&lt;/p&gt;

&lt;p&gt;Let me just quantify the two features that make a good toggle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;only two states: &lt;em&gt;on&lt;/em&gt; and &lt;em&gt;off&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;the state is visible at a glance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One could argue that with &lt;code&gt;undo&lt;/code&gt; most editing commands become toggles.
But they&amp;#39;re not, since each time you call &lt;code&gt;undo&lt;/code&gt;, you mess with
Emacs&amp;#39;s undo state. And the undo state isn&amp;#39;t visible at a glance, so
both requirements for a good toggle aren&amp;#39;t fulfilled.&lt;/p&gt;

&lt;p&gt;I&amp;#39;ll demonstrate the two editing commands that I use every day,
&lt;code&gt;capitalize-word-toggle&lt;/code&gt; and &lt;code&gt;upcase-word-toggle&lt;/code&gt;, that are good
toggles.&lt;/p&gt;

&lt;h2 id=&quot;capitalize-word-toggle&quot;&gt;&lt;code&gt;capitalize-word-toggle&lt;/code&gt;&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Talk is cheap. Show me the code.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;char-upcasep&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;upcase&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;capitalize-word-toggle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;start&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;backward-word&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bounds-of-thing-at-point&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;start&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;funcall&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;char-upcasep&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;char-after&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
               &lt;span class=&quot;ss&quot;&gt;&amp;#39;downcase-region&lt;/span&gt;
             &lt;span class=&quot;ss&quot;&gt;&amp;#39;upcase-region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;nv&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1+&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;capitalize-word&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;capitalize-word-toggle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I may not have mentioned this before, but you should for the most part
ignore the key bindings mentioned on this blog. I&amp;#39;m actually using
them, they work for me because of my non-standard layout, but you
should assign what works for you.&lt;/p&gt;

&lt;p&gt;Anyway, &lt;code&gt;capitalize-word-toggle&lt;/code&gt; clearly has a state that&amp;#39;s visible at
a glance: the first char of the current symbol. Also, there are only
two possible states: the char can either be upper-case or lower-case.
Hence, I can toggle this state with &lt;kbd&gt;C-z&lt;/kbd&gt; for fun and profit.&lt;/p&gt;

&lt;p&gt;Maybe some background on how this command is useful for me. I write a bunch of C++,
and the code features a lot of lines like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c++&quot; data-lang=&quot;c++&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Triangulation&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;triangulation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// duh&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So when I&amp;#39;m using &lt;code&gt;auto-complete&lt;/code&gt;, it often eagerly expands to
&lt;code&gt;Triangulation&lt;/code&gt; when I want &lt;code&gt;triangulation&lt;/code&gt;, and the other way around.
So &lt;code&gt;capitalize-word-toggle&lt;/code&gt; is super-useful there.&lt;/p&gt;

&lt;h2 id=&quot;upcase-word-toggle&quot;&gt;&lt;code&gt;upcase-word-toggle&lt;/code&gt;&lt;/h2&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;upcase-word-toggle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bounds&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bounds-of-thing-at-point&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;symbol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;beg&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;end&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;regionp&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;this-command&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;last-command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;this-command&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;regionp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;put&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;this-command&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;regionp&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cond&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;region-active-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;regionp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;beg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;region-beginning&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;nv&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;region-end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;put&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;this-command&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;regionp&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bounds&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;beg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;nv&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;beg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;nv&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1+&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;beg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;beg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;[A-Za-z]&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;funcall&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;char-upcasep&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;char-before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                        &lt;span class=&quot;ss&quot;&gt;&amp;#39;downcase-region&lt;/span&gt;
                      &lt;span class=&quot;ss&quot;&gt;&amp;#39;upcase-region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                    &lt;span class=&quot;nv&quot;&gt;beg&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;upcase-word-toggle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;upcase-word-toggle&lt;/code&gt;&amp;#39;s state becomes binary after you call it once,
since initially the thing at point could have mixed case.
But afterwards, it&amp;#39;s either all lowercase or all uppercase.
So again, a clearly visible binary state is a good thing.&lt;/p&gt;

&lt;p&gt;This command works either on &lt;code&gt;(bounds-of-thing-at-point &amp;#39;symbol)&lt;/code&gt; or
on the active region. Since &lt;code&gt;region-active-p&lt;/code&gt; is deactivated after you
call the command once, there&amp;#39;s some machinery to remember the state
and to toggle when called again.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Light it up! Pygments for Emacs Lisp.</title>
   <link href="https://oremacs.com/2014/12/24/light-it-up/"/>
   <updated>2014-12-24T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/24/light-it-up</id>
   <content type="html">&lt;h2 id=&quot;the-challenge&quot;&gt;The Challenge&lt;/h2&gt;

&lt;p&gt;More than 2 years ago, the formidable @bbatsov of &lt;a href=&quot;http://emacsredux.com&quot;&gt;Emacs Redux&lt;/a&gt; had this to say:&lt;/p&gt;

&lt;blockquote class=&quot;twitter-tweet&quot; lang=&quot;en&quot;&gt;&lt;p&gt;After so many years pygments (a popular syntax highlighting library used by GitHub &amp;amp; others) still lacks proper support for Emacs Lisp &lt;a href=&quot;https://twitter.com/hashtag/fail?src=hash&quot;&gt;#fail&lt;/a&gt;&lt;/p&gt;&amp;mdash; Bozhidar Batsov (@bbatsov) &lt;a href=&quot;https://twitter.com/bbatsov/status/246929917546221568&quot;&gt;September 15, 2012&lt;/a&gt;&lt;/blockquote&gt;

&lt;script async src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;p&gt;Well, let&amp;#39;s turn that #fail-frown upside down!&lt;/p&gt;

&lt;h2 id=&quot;the-python&quot;&gt;The Python&lt;/h2&gt;

&lt;p&gt;A quick search brought me to this page:
&lt;a href=&quot;http://pygments.org/docs/lexerdevelopment/&quot;&gt;Write your own lexer -- Pygments&lt;/a&gt;.
Turns out that the Pygments development takes place on
&lt;a href=&quot;https://bitbucket.org/birkenfeld/pygments-main&quot;&gt;Bitbucket&lt;/a&gt;, so I had
to start an account there. I shortly cloned the repository:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;hg clone https://abo-abo@bitbucket.org/birkenfeld/pygments-main
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then I quickly copy-pasted some starting code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__all__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;SchemeLexer&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;CommonLispLexer&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
           &lt;span class=&quot;s1&quot;&gt;&amp;#39;HyLexer&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;RacketLexer&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
           &lt;span class=&quot;s1&quot;&gt;&amp;#39;NewLispLexer&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;EmacsLispLexer&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;EmacsLispLexer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RegexLexer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;sd&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    An ELisp lexer, parsing a stream and outputting the tokens&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    needed to highlight elisp code.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;ELisp&amp;#39;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;aliases&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;emacs&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;elisp&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;filenames&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;*.el&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;mimetypes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;text/x-elisp&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;flags&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;re&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MULTILINE&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# the rest of the code was copied from CommonLispLexer for now&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Apparently, infrastructure-wise, I only need to know two commands.
The first one needs to be run just once, so that Pygments is aware of the new lexer:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;$ cd ~/git/pygments-main &amp;amp;&amp;amp; make mapfiles
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The second command is to (re-)generate &lt;code&gt;/tmp/example.html&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;$ cp ~/git/emacs/lisp/vc/ediff.el \
  ~/git/pygments-main/tests/examplefiles/
$ ./pygmentize -O full -f html -o /tmp/example.html \
  tests/examplefiles/ediff.el
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I would repeat the last line with each update to the code, and then
refresh the page in Firefox to see the result.&lt;/p&gt;

&lt;h2 id=&quot;the-elisp&quot;&gt;The Elisp&lt;/h2&gt;

&lt;p&gt;To finalize the lexer, the following tasks ensued:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;get a list of built-in macros&lt;/li&gt;
&lt;li&gt;get a list of special forms&lt;/li&gt;
&lt;li&gt;get a list of built-in functions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the process, I&amp;#39;ve added two more lists:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;a list of built-in functions that are highlighted with &lt;code&gt;font-lock-keyword-face&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;&amp;#39;defvaralias&amp;#39;, &amp;#39;provide&amp;#39;, &amp;#39;require&amp;#39;,
&amp;#39;with-no-warnings&amp;#39;, &amp;#39;define-widget&amp;#39;, &amp;#39;with-electric-help&amp;#39;,
&amp;#39;throw&amp;#39;, &amp;#39;defalias&amp;#39;, &amp;#39;featurep&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;a list of built-in functions and macros that are highlighted with &lt;code&gt;font-lock-warning-face&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;&amp;#39;cl-assert&amp;#39;, &amp;#39;cl-check-type&amp;#39;, &amp;#39;error&amp;#39;, &amp;#39;signal&amp;#39;,
&amp;#39;user-error&amp;#39;, &amp;#39;warn&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To generate the other three lists, I started off writing things in
&lt;code&gt;*scratch*&lt;/code&gt;, but after a while my compulsion to &lt;kbd&gt;C-x C-s&lt;/kbd&gt;
kicked in and I&amp;#39;ve saved the work to &lt;code&gt;research.el&lt;/code&gt;.  At least,
&lt;a href=&quot;http://batsov.com/articles/2012/03/08/emacs-tip-number-5-save-buffers-automatically-on-buffer-or-window-switch/&quot;&gt;thanks to @bbatsov&lt;/a&gt;,
I&amp;#39;m not &lt;kbd&gt;C-x C-s&lt;/kbd&gt;-ing that much since I&amp;#39;ve added this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;save-and-switch-buffer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-file-name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;bound-and-true-p&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;archive-subfile-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;save-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ido-switch-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;η&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;save-and-switch-buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But it&amp;#39;s time for the student to one-up the master, so here&amp;#39;s a tip to
improve even further:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;oleh-ido-setup-hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ido-buffer-completion-map&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;η&amp;quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ido-next-match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This way I can cycle the buffers with the same shortcut that invokes
&lt;code&gt;save-and-switch-buffer&lt;/code&gt;. The defaults are &lt;kbd&gt;C-s&lt;/kbd&gt; and
&lt;kbd&gt;C-r&lt;/kbd&gt;, in case you didn&amp;#39;t know.&lt;/p&gt;

&lt;h2 id=&quot;the-c&quot;&gt;The C&lt;/h2&gt;

&lt;p&gt;Getting the list of built-in C functions and special forms, obviously
involved browsing the C source code. In case you don&amp;#39;t (yet) have the Emacs sources,
they&amp;#39;re here:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;$ git clone git://git.savannah.gnu.org/emacs.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I switched to the &lt;code&gt;./src&lt;/code&gt; directory and called &lt;kbd&gt;M-x&lt;/kbd&gt; &lt;code&gt;find-name-dired&lt;/code&gt; with
&lt;code&gt;*.c&lt;/code&gt; to build a list of all the sources.
Then I ran the following code from &lt;code&gt;research.el&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;foo-c-functions&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;foo-c-special-forms&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;c-research&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;dired-get-marked-files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dolist&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;%d&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;incf&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;with-current-buffer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;find-file-noselect&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point-min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;^DEFUN (&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;backward-char&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;beg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
                       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;forward-list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                       &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
                &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forward-char&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;buffer-substring-no-properties&lt;/span&gt;
                             &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;beg&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;1-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;re-search-forward&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;UNEVALLED&amp;quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;foo-c-special-forms&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;foo-c-functions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This was beautiful, by the way, to just generate this sort of
documentation from such well-formatted and documented C sources.  Free
Software FTW.&lt;/p&gt;

&lt;p&gt;If you&amp;#39;re interested, there are 1294 built-in functions.
Here&amp;#39;s a list of 23 special forms that I found:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;condition-case&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;defconst&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;defvar&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;let*&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;prog1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;prog2&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;progn&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;quote&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;save-current-buffer&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;save-excursion&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;save-restriction&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;setq-default&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;unwind-protect&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can read up on the special forms in the
&lt;a href=&quot;http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html#%_sec_1.1.3&quot;&gt;SICP&lt;/a&gt;.
There&amp;#39;s no node for them, so just use isearch.&lt;/p&gt;

&lt;h2 id=&quot;the-result&quot;&gt;The Result&lt;/h2&gt;

&lt;p&gt;You can see it here: &lt;a href=&quot;/download/ediff.html&quot;&gt;ediff.html&lt;/a&gt;, as well as on
the rest of the site, since I&amp;#39;ve switched it on everywhere.&lt;/p&gt;

&lt;h2 id=&quot;the-impact&quot;&gt;The Impact&lt;/h2&gt;

&lt;p&gt;Unfortunately this won&amp;#39;t have impact on the Github source code
highlighter, since
&lt;a href=&quot;http://www.greghendershott.com/2014/11/github-dropped-pygments.html&quot;&gt;Github dropped Pygments&lt;/a&gt;
recently.&lt;/p&gt;

&lt;p&gt;But people that use the static blog generator
&lt;a href=&quot;http://jekyllrb.com&quot;&gt;Jekyll&lt;/a&gt; or the LaTeX package
&lt;a href=&quot;http://code.google.com/p/minted&quot;&gt;minted&lt;/a&gt; (that&amp;#39;s the package that
&lt;code&gt;org-mode&lt;/code&gt;&amp;#39;s PDF Export uses by default) will be able to get better
Elisp highlighting. In fact, this blog is already using the new highlighter.&lt;/p&gt;

&lt;p&gt;See the rest of projects that use Pygments
&lt;a href=&quot;http://pygments.org/faq/#who-uses-pygments&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-bitbucket&quot;&gt;The Bitbucket&lt;/h2&gt;

&lt;p&gt;So now, to share the new lexer with the world I just have to learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stage and commit in Mercurial&lt;/li&gt;
&lt;li&gt;push Mercurial to Bitbucket&lt;/li&gt;
&lt;li&gt;open a pull request on Bitbucket&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I don&amp;#39;t &lt;em&gt;want&lt;/em&gt; to become a &lt;a href=&quot;http://xkcd.com/1220/&quot;&gt;hipster&lt;/a&gt;, these things just happen.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>upcase-word, you so silly</title>
   <link href="https://oremacs.com/2014/12/23/upcase-word-you-silly/"/>
   <updated>2014-12-23T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/23/upcase-word-you-silly</id>
   <content type="html">&lt;p&gt;Do you know what the
&lt;a href=&quot;http://ergoemacs.org/emacs/command-frequency.html&quot;&gt;most frequently used&lt;/a&gt;
Emacs commands are? I can confirm by my own experience that they are
&lt;code&gt;next-line&lt;/code&gt; and &lt;code&gt;previous-line&lt;/code&gt; (in that order).
So why do &lt;kbd&gt;M-u&lt;/kbd&gt; - &lt;code&gt;upcase-word&lt;/code&gt;, &lt;kbd&gt;M-l&lt;/kbd&gt; - &lt;code&gt;downcase-word&lt;/code&gt;, and
&lt;kbd&gt;M-c&lt;/kbd&gt; - &lt;code&gt;capitalize-word&lt;/code&gt; have such terrible synergy with Emacs&amp;#39;s best commands?&lt;/p&gt;

&lt;p&gt;No, &lt;code&gt;upcase-word&lt;/code&gt;, this is not what I had in mind:&lt;/p&gt;

&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;
&lt;pre style=&quot;font-size: 0.6em&quot;&gt;
Learn basic key&lt;cursor&gt;s&lt;/cursor&gt;troke commands
Overview of Emacs features at gnu.org
&lt;/pre&gt;
&lt;/td&gt;&lt;td&gt;
&lt;kbd&gt;M-u&lt;/kbd&gt;
&lt;/td&gt;&lt;td&gt;
&lt;pre style=&quot;font-size: 0.6em&quot;&gt;
Learn basic keySTROKE&lt;cursor&gt; &lt;/cursor&gt;commands
Overview of Emacs features at gnu.org
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;If you say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;But how did you get the cursor in such a crazy position in the first
place? You should have used &lt;kbd&gt;M-b&lt;/kbd&gt;/&lt;kbd&gt;M-f&lt;/kbd&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Well, I got there with &lt;code&gt;previous-line&lt;/code&gt; - one of the best Emacs commands!&lt;/p&gt;

&lt;h2 id=&quot;resolve-the-word-malarkey-with-defadvice&quot;&gt;Resolve the &lt;code&gt;*-word&lt;/code&gt; malarkey with &lt;code&gt;defadvice&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Here are some simple advice commands that I&amp;#39;ve just rolled:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defadvice&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;upcase-word&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;before&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;upcase-word-advice&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;activate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;looking-back&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\b&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;backward-word&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defadvice&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;downcase-word&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;before&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;downcase-word-advice&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;activate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;looking-back&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\b&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;backward-word&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defadvice&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;capitalize-word&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;before&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;capitalize-word-advice&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;activate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;looking-back&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;\\b&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;backward-word&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Small explanation to the Elisp novices:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;before &lt;code&gt;upcase-word&lt;/code&gt; is called, execute the body of &lt;code&gt;upcase-word-advice&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;unless&lt;/code&gt; we are at the beginning of the word&lt;/li&gt;
&lt;li&gt;&lt;code&gt;backward-word&lt;/code&gt; once to move to the beginning of the word&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I&amp;#39;m intentionally not using the newest advice system here, since not everyone
has yet upgraded to Emacs 24.4.
In fact, I saw this gem today at Stack Overflow:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I am using Emacs 23 and cedet 1.0.1 ...&lt;/p&gt;
&lt;/blockquote&gt;
</content>
 </entry>
 
 <entry>
   <title>Sometimes things break</title>
   <link href="https://oremacs.com/2014/12/22/sometimes-things-break/"/>
   <updated>2014-12-22T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/22/sometimes-things-break</id>
   <content type="html">&lt;p&gt;I was very surprised to find the
&lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;lispy&lt;/a&gt; build broken after I pushed
some minor update, like a change to README.md.  I mean, how in the
world would a few words in README.md break the Elisp tests?  Upon
investigation, it turned out that only one test was broken &lt;sup id=&quot;fnref1&quot;&gt;&lt;a href=&quot;#fn1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.  This
one:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ert-deftest&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;clojure-thread-macro&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;cider&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;should&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;string=&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;lispy-with&lt;/span&gt;
     &lt;span class=&quot;s&quot;&gt;&amp;quot;|(map sqr (filter odd? [1 2 3 4 5]))&amp;quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;2(-&amp;gt;&amp;gt;]&amp;lt;]&amp;lt;]wwlM&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&amp;quot;(-&amp;gt;&amp;gt; [1 2 3 4 5]\n  (map sqr)\n  (filter odd?))|&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The culprit was an update in &lt;code&gt;clojure-mode&lt;/code&gt;&amp;#39;s indentation.
The previous behavior:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;map &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sqr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;filter &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;odd?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;is now replaced with:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-clojure&quot; data-lang=&quot;clojure&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;-&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;map &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;sqr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;filter &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;odd?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Thankfully, the &lt;a href=&quot;https://travis-ci.com/&quot;&gt;Travis CI&lt;/a&gt; in combination
with &lt;a href=&quot;https://github.com/cask/cask&quot;&gt;cask&lt;/a&gt; is keeping me up to date.
Apparently, there were some
&lt;a href=&quot;https://github.com/clojure-emacs/clojure-mode/issues/265&quot;&gt;heated discussions&lt;/a&gt;
accompanying the change, and there was some reverting going on.
Anyway, it looks to me that both approaches have merit: the first one
is more logical, since &lt;code&gt;-&amp;gt;&amp;gt;&lt;/code&gt; is an operation akin to Elisp&amp;#39;s
&lt;code&gt;with-current-buffer&lt;/code&gt;, where the first argument is different from the
others, while the second one is more aesthetically pleasing.  Fine
with me either way, I&amp;#39;m not complaining:)&lt;/p&gt;

&lt;p&gt;Also, the key sequence in the test is pretty ancient.  These days I&amp;#39;d
probably use:
&lt;kbd&gt;2(-&amp;gt;&amp;gt;&lt;/kbd&gt;&lt;kbd&gt;C-f&lt;/kbd&gt;&lt;kbd&gt;d&amp;lt;j&amp;lt;skwAM&lt;/kbd&gt;.  I&amp;#39;ve
recently done a more complex Elisp refactoring screencast, check it
out &lt;a href=&quot;https://www.youtube.com/watch?v=Djn6dXzXp_E&quot;&gt;here&lt;/a&gt;.  Later on, I
plan to do more Emacs-related screencasts (not just &lt;code&gt;lispy&lt;/code&gt;-related)
on my &lt;a href=&quot;https://www.youtube.com/user/abo5abo/videos&quot;&gt;channel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you haven&amp;#39;t tried &lt;a href=&quot;https://github.com/abo-abo/lispy&quot;&gt;&lt;code&gt;lispy&lt;/code&gt;&lt;/a&gt; yet, you&amp;#39;re missing out -
doing this refactor operation feels like you&amp;#39;re doing the 15-number puzzle:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/download/15-puzzle.png&quot; alt=&quot;15puzzle&quot;&gt;&lt;/p&gt;

&lt;p&gt;And that&amp;#39;s fun in my book. But let me get back to the short overview
of the Emacs testing tools that lead me to this post, mainly &lt;code&gt;cask&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;cask-what-does-it-do&quot;&gt;&lt;code&gt;cask&lt;/code&gt;: what does it do?&lt;/h2&gt;

&lt;p&gt;According to &lt;a href=&quot;http://cask.readthedocs.org/en/latest/&quot;&gt;its own documentation&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Cask is a project management tool for Emacs Lisp to automate the
package development cycle; development, dependencies, testing,
building, packaging and more.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Yes, please, I&amp;#39;d like to do that! But after the exciting intro
sentence, there&amp;#39;s very little followup documentation-wise.  It took me
ages to figure out how &lt;code&gt;cask&lt;/code&gt; can actually give me some tangible
benefits, since I thought that &lt;code&gt;package.el&lt;/code&gt; is enough to maintain my
own config (it still is).&lt;/p&gt;

&lt;h2 id=&quot;tangible-benefits-of-cask&quot;&gt;tangible benefits of &lt;code&gt;cask&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;I&amp;#39;d like to be sure that my packages work across recent Emacs
versions.  I&amp;#39;m using the
&lt;a href=&quot;http://savannah.gnu.org/git/?group=emacs&quot;&gt;bleeding edge&lt;/a&gt; myself, but
people who download my packages from MELPA might be using something
older, like &lt;code&gt;emacs-24.3&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So I want to run my tests on both versions. Also, even for just one
version, the tests need to be run in a minimum environment, i.e. with
only the dependencies loaded, so that my personal configuration does
not interfere with the tests.&lt;/p&gt;

&lt;p&gt;This is where &lt;code&gt;cask&lt;/code&gt; actually shines: it can bootstrap a whole new
&lt;code&gt;.emacs.d&lt;/code&gt;, separate from your own, just for running tests.  It can do
it on your machine as well as on Travis CI.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s my &lt;code&gt;Cask&lt;/code&gt; file for &lt;code&gt;lispy&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;(source gnu)
(source melpa)

(package-file &amp;quot;lispy.el&amp;quot;)

(files &amp;quot;*.el&amp;quot; (:exclude &amp;quot;init.el&amp;quot; &amp;quot;lispy-test.el&amp;quot;))

(development
 (depends-on &amp;quot;helm&amp;quot;)
 (depends-on &amp;quot;ace-jump-mode&amp;quot;)
 (depends-on &amp;quot;noflet&amp;quot;)
 (depends-on &amp;quot;iedit&amp;quot;)
 (depends-on &amp;quot;multiple-cursors&amp;quot;)
 (depends-on &amp;quot;cider&amp;quot;)
 (depends-on &amp;quot;slime&amp;quot;)
 (depends-on &amp;quot;geiser&amp;quot;)
 (depends-on &amp;quot;projectile&amp;quot;)
 (depends-on &amp;quot;s&amp;quot;)
 (depends-on &amp;quot;highlight&amp;quot;))
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here&amp;#39;s the &lt;code&gt;Makefile&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-Makefile&quot; data-lang=&quot;Makefile&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;EMACS&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; emacs
&lt;span class=&quot;c&quot;&gt;# EMACS = emacs-24.3&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;CASK&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; ~/.cask/bin/cask
&lt;span class=&quot;nv&quot;&gt;CASKEMACS&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;CASK&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;exec&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;EMACS&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;LOAD&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; -l lispy-inline.el -l lispy.el -l lispy-test.el

&lt;span class=&quot;nf&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;test&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;cask&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;shell &lt;span class=&quot;nv&quot;&gt;EMACS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;EMACS&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;CASK&lt;span class=&quot;k&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;compile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;CASKEMACS&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -q  &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;LOAD&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; lispy.el &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    --eval &lt;span class=&quot;s2&quot;&gt;&amp;quot;(progn (mapc #&amp;#39;byte-compile-file &amp;#39;(\&amp;quot;lispy.el\&amp;quot; \&amp;quot;lispy-inline.el\&amp;quot; \&amp;quot;le-clojure.el\&amp;quot; \&amp;quot;le-scheme.el\&amp;quot; \&amp;quot;le-lisp.el\&amp;quot;)) (switch-to-buffer \&amp;quot;*Compile-Log*\&amp;quot;) (ert t))&amp;quot;&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;CASKEMACS&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -batch &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;LOAD&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; -f ert-run-tests-batch-and-exit

&lt;span class=&quot;nf&quot;&gt;clean&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
    rm -f *.elc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you can see, the &lt;code&gt;Makefile&lt;/code&gt; has two separate testing targets: an
interactive one (&lt;code&gt;compile&lt;/code&gt;) and a non-interactive one (&lt;code&gt;test&lt;/code&gt;).
There&amp;#39;s actually some validity to this, since it happened once that
the same tests we failing in non-interactive mode, but passing in
interactive mode. Also, &lt;code&gt;compile&lt;/code&gt; obviously compiles, testing for
compilation warnings/errors.  I can change the Emacs version at the
top, although I don&amp;#39;t have to do it too often.&lt;/p&gt;

&lt;p&gt;Finally, here&amp;#39;s &lt;code&gt;.travis.yml&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;&lt;/span&gt;language: emacs-lisp
env:
  matrix:
    - EMACS=emacs24

before_install:
  - sudo add-apt-repository -y ppa:cassou/emacs
  - sudo apt-get update -qq
  - sudo apt-get install -qq $EMACS
  - curl -fsSkL --max-time 10 --retry 10 --retry-delay 10 https://raw.github.com/cask/cask/master/go | python

script:
  - make cask
  - make test
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So each time I push a change to github, Travis CI will&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;install emacs24&lt;/li&gt;
&lt;li&gt;install cask&lt;/li&gt;
&lt;li&gt;install the packages from MELPA:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;helm&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ace-jump-mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;noflet&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;iedit&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;multiple-cursors&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cider&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;slime&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;geiser&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;projectile&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;s&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;highlight&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;load Emacs with these packages&lt;/li&gt;
&lt;li&gt;load &lt;code&gt;lispy-test.el&lt;/code&gt; and run it&lt;/li&gt;
&lt;li&gt;show up green if &lt;code&gt;make test&lt;/code&gt; returned &lt;code&gt;0&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Seems a bit wasteful, but it&amp;#39;s &lt;a href=&quot;http://xkcd.com/908/&quot;&gt;the Cloud&lt;/a&gt; - what can you do?&lt;/p&gt;

&lt;div class=&quot;footnotes&quot;&gt;
&lt;hr&gt;
&lt;ol&gt;

&lt;li id=&quot;fn1&quot;&gt;
&lt;p&gt;upon even further investigation, the test itself was broken for almost a year, since &lt;code&gt;lispy-with-clojure&lt;/code&gt; should have been used instead of &lt;code&gt;lispy-with&lt;/code&gt;, but &lt;code&gt;cider&lt;/code&gt; was changing the indentation of &lt;code&gt;-&amp;gt;&amp;gt;&lt;/code&gt; also for &lt;code&gt;emacs-lisp-mode&lt;/code&gt;, so things were kind of working out&amp;nbsp;&lt;a href=&quot;#fnref1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Easy helm improvement</title>
   <link href="https://oremacs.com/2014/12/21/helm-backspace/"/>
   <updated>2014-12-21T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/21/helm-backspace</id>
   <content type="html">&lt;p&gt;When you press &lt;kbd&gt;DEL&lt;/kbd&gt; (also known as backspace) in a &lt;code&gt;helm&lt;/code&gt;
buffer, and there isn&amp;#39;t any input to delete, it only errors at you
with:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Text is read only&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Why not make it do something useful instead, for instance close &lt;code&gt;helm&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;Easy:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;helm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-backspace&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Forward to &lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;`backward-delete-char&amp;#39;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;On error (read-only), quit without selecting.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;condition-case&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;backward-delete-char&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ne&quot;&gt;error&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;helm-keyboard-quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;define-key&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;helm-map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;DEL&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;helm-backspace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Poyekhali!</title>
   <link href="https://oremacs.com/2014/12/20/poyekhali!/"/>
   <updated>2014-12-20T00:00:00+01:00</updated>
   <id>https://oremacs.com/2014/12/20/poyekhali!</id>
   <content type="html">&lt;p&gt;Welcome to &lt;b&gt;&lt;code&gt;(or emacs&lt;/code&gt;&lt;/b&gt;!&lt;/p&gt;

&lt;p&gt;My name is Oleh and I&amp;#39;ve been using Emacs for about 3 years now.  I
think that it&amp;#39;s an awesome editor, and I&amp;#39;ve accumulated some know-how
to make it even better (at least for me and people who think like me).
Sharing is caring, so here we go.&lt;/p&gt;

&lt;h2 id=&quot;ace-window-update&quot;&gt;&lt;code&gt;ace-window&lt;/code&gt; update&lt;/h2&gt;

&lt;p&gt;On this weekend I&amp;#39;ve made a major update to my package
&lt;a href=&quot;https://github.com/abo-abo/ace-window&quot;&gt;ace-window&lt;/a&gt; that allows it to
be used as a library. Luckily the change went smoothly, as there are
no complaints in the github issues so far.  In case you don&amp;#39;t know
what the package does in the first place, a short blurb follows.&lt;/p&gt;

&lt;h2 id=&quot;ace-windows-what-and-why&quot;&gt;&lt;code&gt;ace-window&lt;/code&gt;&amp;#39;s &amp;quot;what and why&amp;quot;&lt;/h2&gt;

&lt;p&gt;I&amp;#39;m sure you&amp;#39;re aware of the &lt;code&gt;other-window&lt;/code&gt; command. While it&amp;#39;s great for
two windows, it quickly loses its value when there are more windows:
you need to call it many times, and since it&amp;#39;s not easily predictable,
you have to check each time if you&amp;#39;re in the window that you wanted.&lt;/p&gt;

&lt;p&gt;Another approach is to use &lt;code&gt;windmove-left&lt;/code&gt;, &lt;code&gt;windmove-up&lt;/code&gt; etc.  These
are fast and predictable. Their disadvantage is that they need 4 key
bindings.  The default ones are shift+arrows, which are hard to reach.&lt;/p&gt;

&lt;p&gt;This package aims to take the speed and predictability of &lt;code&gt;windmove&lt;/code&gt;
and pack it into a single key binding, similar to &lt;code&gt;other-window&lt;/code&gt;.  To
achieve this, I&amp;#39;m using the excellent
&lt;a href=&quot;https://github.com/winterTTr/ace-jump-mode&quot;&gt;ace-jump-mode&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s how the package looks in action: &lt;a href=&quot;/download/ace-window.gif&quot;&gt;ace-window.gif&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since switching windows is a frequently used operation, I recommend
binding &lt;code&gt;ace-window&lt;/code&gt; to something short, like &lt;kbd&gt;M-p&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;By default, three actions are available:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;M-p&lt;/kbd&gt; - select window&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-u M-p&lt;/kbd&gt; - swap the current window with the selected window&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;C-u C-u M-p&lt;/kbd&gt; - delete the selected window&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;finally-the-library-part&quot;&gt;finally, the library part&lt;/h2&gt;

&lt;p&gt;So now, what if you want to select a window to maximize with &lt;code&gt;ace-window&lt;/code&gt;?
After the change that I&amp;#39;ve mentioned, the code to do this is dirt simple:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ace-maximize-window&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&amp;quot;Ace maximize window.&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;interactive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aw--current-op&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;wnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aj-position-window&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;aj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;select-window&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;wnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;delete-other-windows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;aw--doit&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot; Ace - Maximize Window&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kbd&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;C-M-o&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;#39;ace-maximize-window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 

</feed>
