<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Elsa Gonsiorowski</title>
        <description>My Personal Website</description>
        <link>http://gonsie.com/</link>
        <atom:link href="http://gonsie.com/blorg/feeds/emacs.xml" rel="self" type="application/rss+xml"/>
        <pubDate>Mon, 02 Mar 2026 21:25:14 +0000</pubDate>
        <lastBuildDate>Mon, 02 Mar 2026 21:25:14 +0000</lastBuildDate>
        <generator>Jekyll v3.10.0</generator>
        
        
            <item>
                <title>Emacs Carnival: Org Mode Completions</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;p&gt;I’m so happy to be joining &lt;a href=&quot;https://sachachua.com/blog/2026/01/emacs-carnival-february-2026-completion/&quot;&gt;this month’s emacs carnival&lt;/a&gt;!
I love the idea behind these carnivals and I think it’s such a good way of building community virtually.&lt;/p&gt;

&lt;p&gt;This month’s topic is Emacs completions.
I’m going to share a sort of “hack”… a way that I’ve been able to achieve completions within core org mode.&lt;/p&gt;

&lt;h2 id=&quot;org-mode-tempo-templates&quot;&gt;Org Mode Tempo Templates&lt;/h2&gt;

&lt;p&gt;Org Mode has long supported a template expansion mechanism, some times called “easy templates” or “structured templates”.
The default behavior changed dramatically in &lt;a href=&quot;https://orgmode.org/worg/org-release-notes.html#orgf815049&quot;&gt;version 9.2&lt;/a&gt;, and is now built on top of the Emacs builtin &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tempo.el&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update&lt;/em&gt; To get the behavior described here, you must add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(require &apos;org-tempo)&lt;/code&gt; to your config.&lt;/p&gt;

&lt;p&gt;Essentially, you start a new line with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;X&lt;/code&gt; (where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X&lt;/code&gt; is a pre-defined key), then hit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TAB&lt;/code&gt; to have the template expanded.
For example, starting a new line with:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-org&quot; data-lang=&quot;org&quot;&gt;&amp;lt;s&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;and hitting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TAB&lt;/code&gt; will expand to:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-nil&quot; data-lang=&quot;nil&quot;&gt;#+begin_src

#+end_src&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Super handy and very easy to remember.&lt;/p&gt;

&lt;h3 id=&quot;default-templates&quot;&gt;Default templates&lt;/h3&gt;

&lt;p&gt;The default are not entirely documented, though most are listed on the &lt;a href=&quot;https://orgmode.org/manual/Structure-Templates.html&quot;&gt;Structured Templates manual page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Listed again here for convenience:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Key&lt;/th&gt;
      &lt;th&gt;Expansion&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;a&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+BEGIN_EXPORT ascii … #+END_EXPORT&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;c&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+BEGIN_CENTER … #+END_CENTER&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;C&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+BEGIN_COMMENT … #+END_COMMENT&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;e&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+BEGIN_EXAMPLE … #+END_EXAMPLE&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;E&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+BEGIN_EXPORT … #+END_EXPORT&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;h&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+BEGIN_EXPORT html … #+END_EXPORT&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;l&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+BEGIN_EXPORT latex … #+END_EXPORT&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;q&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+BEGIN_QUOTE … #+END_QUOTE&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;s&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+BEGIN_SRC … #+END_SRC&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;v&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+BEGIN_VERSE … #+END_VERSE&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;In addition to those blocks, there are also some quick tags:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Key&lt;/th&gt;
      &lt;th&gt;Expansion&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;L&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+latex:&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;H&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+html:&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;A&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+ascii:&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;i&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+index:&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;I&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+include:&lt;/code&gt; (will interactively find file to include)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;You can see that there is sort of a convention, uppercase letters usually insert a tag, whereas lowercase letters are mainly for blocks (though it’s definitely not perfect).&lt;/p&gt;

&lt;h3 id=&quot;additional-templates&quot;&gt;Additional Templates&lt;/h3&gt;

&lt;p&gt;Some additional templates can be defined by packages.
For example, the &lt;a href=&quot;https://gitlab.com/oer/org-re-reveal&quot;&gt;org-re-reveal&lt;/a&gt; package adds:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Key&lt;/th&gt;
      &lt;th&gt;Expansion&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;n&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+begin_notes ... #+end_notes&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;basic-customization&quot;&gt;Basic Customization&lt;/h2&gt;

&lt;p&gt;You can add your own tags and blocks.
In fact, there is actually no need for the “keys” to single characters.&lt;/p&gt;

&lt;h3 id=&quot;adding-tags&quot;&gt;Adding Tags&lt;/h3&gt;

&lt;p&gt;Adding another tag is very easy, seen here:&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-tempo-keywords-alist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;N&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Which results in this completion:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Key&lt;/th&gt;
      &lt;th&gt;Expansion&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;N&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+name:&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;create-a-new-hotkey&quot;&gt;Create a New Hotkey&lt;/h3&gt;

&lt;p&gt;I don’t like the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;E&lt;/code&gt; hotkey for export block, instead I would like that to be &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;x&lt;/code&gt;.
That is easily added with:&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-tempo-tags&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;x&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tempo-template-org-export&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;create-a-completion&quot;&gt;Create a Completion&lt;/h3&gt;

&lt;p&gt;You can define your own completion with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tempo-define-template&lt;/code&gt; function (see the doc string for full details).
It is very flexible!
You can specify where the cursor (or “prompt”) ends up after the completion, or you can interactively prompt (via the minibuffer) for additional details.
There are more advance features, including auto indentation and dealing with regions.&lt;/p&gt;

&lt;h2 id=&quot;my-custom-completions&quot;&gt;My Custom Completions&lt;/h2&gt;

&lt;p&gt;There is no requirement that these templates be simply blocks or tags.
I’ve implemented about 5 custom templates, but here are a few that I think would be most useful for others.&lt;/p&gt;

&lt;h3 id=&quot;properties-drawer1&quot;&gt;Properties Drawer&lt;sup&gt;&lt;a id=&quot;fnr.1&quot; class=&quot;footref&quot; href=&quot;#fn.1&quot; role=&quot;doc-backlink&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/h3&gt;

&lt;p&gt;Org headings can have properties, specified by the &lt;a href=&quot;https://orgmode.org/manual/Property-Syntax.html&quot;&gt;properties drawer&lt;/a&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-org&quot; data-lang=&quot;org&quot;&gt;:PROPERTIES:

:END:&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I add this as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;p&lt;/code&gt; via this implementation code:&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;tempo-define-template&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;org-properties-block&quot;&lt;/span&gt;
                       &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;:PROPERTIES:&quot;&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;nv&quot;&gt;p&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;s&quot;&gt;&quot;:END:&quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n&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;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-tempo-tags&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;p&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tempo-template-org-properties-block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;title-block&quot;&gt;Title Block&lt;/h3&gt;

&lt;p&gt;This is one that I use most frequently.
It’s a title block that I start all my org documents with.
It also executes a function call to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;format-time-string&lt;/code&gt; to get today’s date in my preferred format.
By having this completion, all of my org documents get a title with a date and I always know when I started working on a document!&lt;/p&gt;

&lt;p&gt;My desired result:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-org&quot; data-lang=&quot;org&quot;&gt;#+title:
#+author: Elsa Gonsiorowski
#+date: February 28, 2026&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The implementation code:&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;tempo-define-template&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;org-title-block&quot;&lt;/span&gt;
                       &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#+title: &quot;&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;nv&quot;&gt;n&lt;/span&gt;
                         &lt;span class=&quot;s&quot;&gt;&quot;#+author: Elsa Gonsiorowski&quot;&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;nv&quot;&gt;concat&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;#+date: &quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;format-time-string&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;%B %e, %Y&quot;&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;%&lt;/span&gt;&lt;span class=&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;&apos;org-tempo-tags&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;t&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tempo-template-org-title-block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I also implement another completion that is a slightly different title block which I use for starting all my blog posts.
It includes the all the options that I want by default.&lt;/p&gt;

&lt;h2 id=&quot;finally&quot;&gt;Finally&lt;/h2&gt;

&lt;p&gt;In writing this article I stumbled across orgmode documentation page for &lt;a href=&quot;https://orgmode.org/manual/Completion.html&quot;&gt;Completions&lt;/a&gt;.
I had no idea these &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-tab&lt;/code&gt; completions existed!
(Clearly, since I implemented my own completion for the properties drawer).
I’ll definitely be trying these out.&lt;/p&gt;

&lt;h1 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h1&gt;

&lt;p&gt;&lt;sup&gt;&lt;a id=&quot;fn.1&quot; href=&quot;#fnr.1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:properties:&lt;/code&gt; keyword can also be added with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-tab&lt;/code&gt; completion on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:&lt;/code&gt;&lt;/p&gt;
</description>
                <pubDate>Sat, 28 Feb 2026 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/org-completion-feb26-carnival.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/org-completion-feb26-carnival.html</guid>
                
                <category>emacs</category>
                
                <category>orgmode</category>
                
                
            </item>
        
        
        
        
        
        
        
            <item>
                <title>Beautifying the Tab Bar</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;p&gt;&lt;img src=&quot;/images/tab-bar.png&quot; alt=&quot;Screenshot of stylized tab bar&quot; title=&quot;Tab Bar&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Emacs 27.1 introduced a tab bar and I finally got around to trying it out.
I found it particularly useful for switching between a few buffers quickly, particularly because I have muscle memory for the Safari tab keybindings (which I set for Emacs tabs).&lt;/p&gt;

&lt;p&gt;I must say, the implementation is really nice.
Ultimately customizable (a la everything Emacs).
It also has some nice interactions with the mouse (if that’s your jam).
You can use drag-and-drop to change tab ordering!&lt;/p&gt;

&lt;h2 id=&quot;basic-key-bindings&quot;&gt;Basic Key Bindings&lt;/h2&gt;

&lt;p&gt;This was the first thing I setup, especially since I knew exactly what I wanted.
These mirror Safari’s tab keybindings.&lt;/p&gt;

&lt;figure 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;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;&quot;s-{&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;tab-bar-switch-to-prev-tab&lt;/span&gt;&lt;span class=&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;&quot;s-}&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;tab-bar-switch-to-next-tab&lt;/span&gt;&lt;span class=&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;&quot;s-t&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;tab-bar-new-tab&lt;/span&gt;&lt;span class=&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;&quot;s-w&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;tab-bar-close-tab&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s-&lt;/code&gt; prefix key is the “command ⌘” key on a Mac.&lt;/p&gt;

&lt;p&gt;I think &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s-w&lt;/code&gt; is set to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kill-emacs&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delete-frame&lt;/code&gt; something similar by default.
I personally never want that to happen so I’ve had those functions and keybinding disabled for years now.
I also had &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s-{&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s-}&lt;/code&gt; bound to switch between frames (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;other-frame&lt;/code&gt;), but I usually use the Emacs GUI in full screen mode, so using these for tabs makes more sense.
At least for right now.&lt;/p&gt;

&lt;h2 id=&quot;settings&quot;&gt;Settings&lt;/h2&gt;

&lt;p&gt;Of course, the tab bar comes with a bunch of customizable settings.
I’m using:&lt;/p&gt;

&lt;figure 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;nb&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;26&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;emacs-major-version&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tab-bar-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;c1&quot;&gt;;; enable tab bar&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;tab-bar-show&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;c1&quot;&gt;;; hide bar if &amp;lt;= 1 tabs open&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;tab-bar-close-button-show&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;;; hide tab close / X button&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;tab-bar-new-tab-choice&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;*dashboard*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;;; buffer to show in new tabs&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;tab-bar-tab-hints&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 tab numbers&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;tab-bar-format&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tab-bar-format-tabs&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tab-bar-separator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
                                            &lt;span class=&quot;c1&quot;&gt;;; elements to include in bar&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;when&lt;/code&gt; clause wrapping these settings ensures my configuration is maximally compatible with &lt;a href=&quot;./emacs-v22.html&quot;&gt;all modern Emacs versions&lt;/a&gt;.
I figured out these settings through a combination of looking at the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*Customize*&lt;/code&gt; menu for Tab Bar and reading the help documentation for each variable.&lt;/p&gt;

&lt;p&gt;One setting I really like (but am not using right now), is the ability to have a “Menu” button in the tab bar.
This is achieved by adding &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tab-bar-format-menu-bar&lt;/code&gt; at the beginning of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tab-bar-format&lt;/code&gt; value list.&lt;/p&gt;

&lt;h2 id=&quot;theme&quot;&gt;Theme&lt;/h2&gt;

&lt;p&gt;I worked really hard on my &lt;a href=&quot;./modeline.html&quot;&gt;modeline&lt;/a&gt; and I can reuse all that styling!
This is the snippet from my personal dusk theme&lt;sup&gt;&lt;a id=&quot;fnr.1&quot; class=&quot;footref&quot; href=&quot;#fn.1&quot; role=&quot;doc-backlink&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; modeline settings&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mode-line&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;ss&quot;&gt;:underline&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:overline&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:box&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:line-width&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;#353644&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:style&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;ss&quot;&gt;:foreground&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;white&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:background&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;#353644&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mode-line-buffer-id&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;ss&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;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mode-line-emphasis&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;ss&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;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mode-line-highlight&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((((&lt;/span&gt;&lt;span class=&quot;nc&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;min-colors&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;88&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:box&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:line-width&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;grey40&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:style&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;released-button&lt;/span&gt;&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;ss&quot;&gt;:inherit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;highlight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mode-line-inactive&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;ss&quot;&gt;:weight&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;light&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:underline&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:overline&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:box&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:line-width&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:color&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;#565063&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:style&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;ss&quot;&gt;:foreground&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;white&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:background&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;#565063&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:inherit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;mode-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; tab bar settings&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tab-bar&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;ss&quot;&gt;:inherit&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mode-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tab-bar-tab&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;ss&quot;&gt;:inherit&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mode-line&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:foreground&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;white&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;tab-bar-tab-inactive&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;ss&quot;&gt;:inherit&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mode-line-inactive&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:foreground&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;black&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;binding-the-tab-hint-numbers&quot;&gt;Binding the Tab Hint Numbers&lt;/h2&gt;

&lt;p&gt;I have a pretty wonky keybinding setup, where I create my own minor mode key map and use that by default (as recommended by this &lt;a href=&quot;https://emacs.stackexchange.com/questions/352/how-to-override-major-mode-bindings/360#360&quot;&gt;stackexchange post&lt;/a&gt;).
Here I use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(setq mac-command-modifier &apos;super)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The tab bar documentation indicates that to enable pressing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;⌘-1&lt;/code&gt; (or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s-1&lt;/code&gt; as Emacs sees it) to switch to tab number 1 I would need:&lt;/p&gt;

&lt;figure 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;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tab-bar-select-tab-modifiers&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;super&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;But this didn’t work for me.
Instead, I bound each super-number combination (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s-1&lt;/code&gt; through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s-0&lt;/code&gt;) to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tab-bar-select-tab&lt;/code&gt; and it works!&lt;/p&gt;

&lt;h2 id=&quot;final-comments&quot;&gt;Final Comments&lt;/h2&gt;

&lt;p&gt;As I mentioned above, the tab bar implementation is really nice.
This reflects the high standards that the Emacs community and developers have, especially for anything that becomes built in.
I was able to do all of this implementation and blogging while flying back from a semi-vacation in Greece (where I spent a lot of time improving my blog, if you didn’t notice).
An editor with completely built-in documentation and an interface for configuring / customizing is really, really pleasant.
Not needing the internet to do something productive feels increasingly rare.&lt;/p&gt;

&lt;h2 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h2&gt;

&lt;p&gt;&lt;sup&gt;&lt;a id=&quot;fn.1&quot; href=&quot;#fnr.1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; Back when I wrote about &lt;a href=&quot;./cl-deprecated.html&quot;&gt;package cl being deprecated&lt;/a&gt;, I noted that the way I define my theme was outdated.
I finally got around to modernizing it, but never wrote about the process.
I’m not sure a blog post would be useful, since I’m guessing most readers use existing theme packages.
I did start with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;customize-create-theme&lt;/code&gt; function, which made the process of porting my old color-theme definition to the modern customize format trivial.&lt;/p&gt;

&lt;p&gt;You can view my theme in my &lt;a href=&quot;https://github.com/gonsie/dotfiles/blob/master/emacs/dusk-theme.el&quot;&gt;dotfiles GitHub repo&lt;/a&gt;.&lt;/p&gt;
</description>
                <pubDate>Fri, 08 Jul 2022 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/tab-bar.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/tab-bar.html</guid>
                
                <category>emacs</category>
                
                
            </item>
        
        
        
        
        
            <item>
                <title>Package cl is deprecated</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;blockquote&gt;
  &lt;p&gt;Package cl is deprecated&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I’ve been ignoring this startup message for maybe a year now (since the release of Emacs 27).
After recently updating all my packages (and completely breaking my emacs setup) I decided to go through all the startup messages and start fixing things.&lt;/p&gt;

&lt;h2 id=&quot;the-fix&quot;&gt;The Fix&lt;/h2&gt;

&lt;p&gt;Searching around the fix is straight forward.
Instead of requiring &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cl&lt;/code&gt; the correct name is now &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cl-lib&lt;/code&gt;.&lt;/p&gt;

&lt;figure 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;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;cl-lib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I knew of one place where I had used &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cl&lt;/code&gt; (I used the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;return-from&lt;/code&gt; function to do an early exit from a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;while&lt;/code&gt; loop), but after making the change, I was still getting the startup message.
Unfortunately that meant the startup message was coming from one of the many packages I had installed, how would I ever find it?&lt;/p&gt;

&lt;h2 id=&quot;finding-cl-requirements&quot;&gt;Finding &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cl&lt;/code&gt; requirements&lt;/h2&gt;

&lt;p&gt;Luckily, we have the &lt;a href=&quot;https://emacs.stackexchange.com/questions/58489/how-do-i-debug-package-cl-is-deprecated&quot;&gt;emacs stackexchange&lt;/a&gt;, with this handy snippet:&lt;/p&gt;

&lt;figure 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;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;loadhist&lt;/span&gt;&lt;span class=&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-dependents&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;feature-file&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;cl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Showing the one place with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cl&lt;/code&gt; requirement:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Users/gonsie/.config/emacs/elisp/color-theme-6.6.0/color-theme.el&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Unfortunately this is in one of the packages I’ve been hand carrying around for over 10 years (longer than my dotfiles repo has existed).
It’s finally time to update the implementation of my preferred color theme, but that is a post for another day.&lt;/p&gt;
</description>
                <pubDate>Wed, 22 Dec 2021 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/cl-deprecated.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/cl-deprecated.html</guid>
                
                <category>emacs</category>
                
                <category>cl</category>
                
                <category>packages</category>
                
                
            </item>
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
            <item>
                <title>Don&apos;t be afraid of eshell</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;p&gt;One of the reasons I decided to switch to emacs was the ability to embed a terminal window directly within my editor.
Before last week, I never got the embedded terminal working and never really gave eshell much of a try.
Initially, I tried to setup my regular shell (&lt;a href=&quot;https://fishshell.com&quot;&gt;fish&lt;/a&gt;), but that never quite worked correctly.
I also learned the power of dired and haven’t had the need to use the command line quite as much.
Then, last week, I found myself editing and re-compiling code in a tight loop.
I wanted access to the terminal, to trigger compilation, without leaving emacs.
I created a quick-and-dirty eshell setup… and then wondered why I hadn’t done this sooner.&lt;/p&gt;

&lt;h2 id=&quot;what-is-eshell&quot;&gt;What is eshell?&lt;/h2&gt;

&lt;p&gt;Emacs shell, or eshell, presents bash-like command line interface built directly on emacs.
It tries to be the best of two worlds:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;An elisp REPL wherein elisp commands can be directly executed&lt;/li&gt;
  &lt;li&gt;A command line interface similar to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bash&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By understanding that eshell is presenting emacs in a terminal/shell sort of way, I can choose if I want to execute a command the elisp or bash way.
More details can be found on the &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_mono/eshell.html&quot;&gt;eshell page in the emacs manual&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;bare-minimum&quot;&gt;Bare Minimum&lt;/h2&gt;

&lt;p&gt;First things first: to launch an eshell terminal, run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x eshell&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Next, there are 2 things I need to have a basic, functioning shell environment:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Have the correct PATH&lt;/li&gt;
  &lt;li&gt;Have my most used aliases&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;path&quot;&gt;Path&lt;/h3&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PATH&lt;/code&gt; variable used by eshell is exposed through the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addpath&lt;/code&gt; command.
Without any arguments, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addpath&lt;/code&gt; simply prints out the directories currently in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PATH&lt;/code&gt;.
When called with one or more arguments, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addpath&lt;/code&gt; will append these paths to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PATH&lt;/code&gt;.
There is no need to include the current &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PATH&lt;/code&gt; contents, as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addpath&lt;/code&gt; always appends.&lt;/p&gt;

&lt;h3 id=&quot;aliases&quot;&gt;Aliases&lt;/h3&gt;

&lt;p&gt;Eshell has a number of built in commands, which are similar to the &lt;a href=&quot;https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Builtin-Commands&quot;&gt;bash builtins&lt;/a&gt;.
The most useful command is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alias&lt;/code&gt;, which can be used to create any commands that you are used to using in your regular shell.
The first step for me was to figure out which aliases I use most often and add them to eshell.&lt;/p&gt;

&lt;p&gt;First, I needed the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ls&lt;/code&gt; alternative that I use.
Luckily, there is an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ls&lt;/code&gt; provided by eshell (shown by running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;which ls&lt;/code&gt;).
It takes the same arguments as my Mac’s builtin version.&lt;/p&gt;

&lt;p&gt;Next, I needed a way to open an emacs buffer with a specific file.
I use the command &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;em&lt;/code&gt; to launch a new emacs session within my terminal window (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;emacs -nw&lt;/code&gt;).
The alias for eshell is slightly different, since I am &lt;em&gt;already&lt;/em&gt; running an emacs session.
I simply want to start editing a particular file.
Thus, the alias makes a call to the emacs function &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;find-file&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;My alias file (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.emacs.d/eshell/alias&lt;/code&gt;) looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-eshell&quot; data-lang=&quot;eshell&quot;&gt;alias la ls -AFGhl $1
alias em find-file $1&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;next-steps&quot;&gt;Next Steps&lt;/h2&gt;

&lt;p&gt;The bare minimum takes care of my most frequent use case.
Now, I can compile code without switching away from emacs!&lt;/p&gt;

&lt;p&gt;The next step for me is to add the aliases to &lt;a href=&quot;https://github.com/gonsie/dotfiles&quot;&gt;dotfiles&lt;/a&gt; and continue to improve my eshell setup.
A quick web search lead me to a literate config for eshell in &lt;a href=&quot;https://github.com/howardabrams/dot-files/blob/master/emacs-eshell.org&quot;&gt;howardabrams/dot-files&lt;/a&gt;.
There are several settings here that I will have to add for myself.&lt;/p&gt;
</description>
                <pubDate>Wed, 31 Jul 2019 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/eshell.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/eshell.html</guid>
                
                <category>emacs</category>
                
                <category>eshell</category>
                
                
            </item>
        
        
        
        
        
            <item>
                <title>Sending Email from Org Mode</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;p&gt;Every so often, I need to generate a bunch of form emails.
Often, I’m sending the same email to multiple groups of people and I want use variables, such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$first_name&lt;/code&gt;, in the text.
While I’m sure there a number of online services which could achieve this for me, I really don’t need to set up a fancy campaign or use tracking.
Plus, I’m wary of submitting others’ emails to a third party.&lt;/p&gt;

&lt;p&gt;Of course, I’ve used Emacs to do this, using org mode and AppleScript.&lt;/p&gt;

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

&lt;p&gt;To approach this task I start with a single org file.
Getting AppleScript executing from an org block is trickier than I would like.
Instead, I write the script whole cloth in my org file and tangle it out to a separate &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.scpt&lt;/code&gt; file.
I store the data in my file as a table.
I then use a bash block, which takes the data through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:var&lt;/code&gt;, to loop over running the script.&lt;/p&gt;

&lt;h2 id=&quot;applescript-for-email&quot;&gt;AppleScript for Email&lt;/h2&gt;

&lt;p&gt;I’ve never formally learned AppleScript, but some searching on StackOverFlow and trial-and-error can get you pretty far.
Mac OS X has a built in editor found in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/Applications/Utilities/Script Editor&lt;/code&gt;.
Once you’ve opened the editor, you can browse the dictionary with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;File &amp;gt; Open Dictionary...&lt;/code&gt;.
This dictionary lists all the classes and commands for different applications.
The AppleScript language itself looks like natural language and is relatively easy to understand… especially once someone else has properly constructed the program.&lt;/p&gt;

&lt;p&gt;For my email-sender script, I store the AppleScript source is as a block.
This block is tangled (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-c C-v C-t&lt;/code&gt;) to a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.scpt&lt;/code&gt; file.
The first half of this script sets some variables, including the body of the email message.
The second half creates the message and sets a “to” recipient (could also set a “cc” recipient).&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-applescript&quot; data-lang=&quot;applescript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#+NAME: script&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;#+BEGIN_SRC apples :tangle email.scpt&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
   &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;varName&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
   &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;varEmail&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
   &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;varBody&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello &quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;varName&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;,

Blah blah blah. Lor ipsum, etc.

Sincerely,
Elsa&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

   &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;tell&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Mail&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;theMessage&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;outgoing&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;properties&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Email&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;varBody&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;visible&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;tell&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;theMessage&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
             &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;recipient&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;properties&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;varName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;varEmail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
             &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;#send&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;tell&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
   &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;tell&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;#+END_SRC&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Note that I’ve commented out the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;send&lt;/code&gt; command and set the message property &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;visible: true&lt;/code&gt;.
This means that the draft emails appear in the Mail GUI, but do not get automatically sent.
This allows me to do trial runs before spamming my recipients.&lt;/p&gt;

&lt;h2 id=&quot;filling-the-variables&quot;&gt;Filling the Variables&lt;/h2&gt;

&lt;p&gt;Once I have the script and email body written, I know what variables I’ll need to fill in.
The next step is to put all the data into a named org table.
I usually do this data formatting by hand since I’m bringing together data items from many different sources.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-nil&quot; data-lang=&quot;nil&quot;&gt;#+NAME: data
|    Name    |      Email      |
|------------|-----------------|
| Mx. Person | person@test.com |&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Since I tangle the email sending AppleScript program, I need to run it from the command line.
I call the script once for each row in the data table using a bash loop and variable arrays.
Then, I use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-c C-c&lt;/code&gt; to run the bash loop and generate the emails.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#+BEGIN_SRC bash :var name=data[,0] email=data[,1]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;i &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;seq &lt;/span&gt;0 0&lt;span class=&quot;sb&quot;&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;osascript email.scpt &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&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;$i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;email&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;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#+END_SRC&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Note that I do not calculate the total number of data items / rows.
That would take way too much bash magic for this simple example.
Also, if you want to test the variables with an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo&lt;/code&gt; statement, use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:results output&lt;/code&gt; as an argument to the org block.&lt;/p&gt;

&lt;h2 id=&quot;hitting-send&quot;&gt;Hitting Send&lt;/h2&gt;

&lt;p&gt;I usually choose to manually hit send on each individual email once I’m satisfied with the script.&lt;/p&gt;

&lt;p&gt;I keep all of these org commands in a single &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;notes.org&lt;/code&gt; file so that I can remember how to recreate the emails (usually a year later when it’s time to send them again).
For example, this &lt;a href=&quot;https://github.com/womeninhpc/mentoring/blob/master/notes.org&quot;&gt;notes.org&lt;/a&gt; file sends introduction emails for a mentoring program I organized with Women in HPC.&lt;/p&gt;
</description>
                <pubDate>Wed, 01 May 2019 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/emailer.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/emailer.html</guid>
                
                <category>emacs</category>
                
                <category>orgmode</category>
                
                <category>mac</category>
                
                <category>applescript</category>
                
                <category>email</category>
                
                
            </item>
        
        
        
        
        
        
        
        
        
        
        
        
        
            <item>
                <title>Emacs Delete vs. Kill</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;p&gt;One thing that has always vexed me is the Emacs kill ring.
It’s great that it makes a list of things you’ve killed, but often I just want delete things quickly without saving it.
So I need to change the default settings to enable both killing and deleting words and lines.&lt;/p&gt;

&lt;p&gt;Basic nomenclature (for this blog post at least);&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;kill means removing text and putting it in the kill ring&lt;/li&gt;
  &lt;li&gt;delete means removing text and not putting it in the kill ring&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;understanding-key-bindings&quot;&gt;Understanding Key Bindings&lt;/h2&gt;

&lt;p&gt;The default behavior of Emacs can depend on the underlying operating system.
This is because key presses are first translated by the OS, then passed (if they don’t trigger an OS function) to the application, e.g., Emacs.
This can be further complicated by the keyboard setup and, further still, by an Emacs instance running inside of a Terminal.&lt;/p&gt;

&lt;p&gt;To figure out the name that Emacs itself has for each key, use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h k KEY&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x describe-key KEY&lt;/code&gt;.
This internal name will come in handy when rebinding these keys.&lt;/p&gt;

&lt;p&gt;For extended keyboards, there are often two “delete” keys, one which performs a backspace and one which does a forward delete.
The forward delete is often found on the “keypad” or number pad and is thus called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kp-delete&lt;/code&gt; by Emacs.&lt;/p&gt;

&lt;h3 id=&quot;mac-keyboards&quot;&gt;Mac Keyboards&lt;/h3&gt;

&lt;p&gt;Mac keyboards have the following modifier keys: Shift, Control, Option (Alt), and Command.
While Shift and Control are already mapped for Emacs (known as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;S&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C&lt;/code&gt; respectively), the Option and Command keys are not mapped.
I use Option/Alt as a meta (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M&lt;/code&gt;) key and Command as a super (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s&lt;/code&gt;) key.&lt;/p&gt;

&lt;figure 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;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mac-command-modifier&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;super&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;;; command -&amp;gt; s&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;mac-option-modifier&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;meta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;;; option/alt -&amp;gt; M&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;default-commands&quot;&gt;Default Commands&lt;/h2&gt;

&lt;p&gt;By default, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delete&lt;/code&gt; key removes a single letter (backwards).
In Emacs keybindings, this is sometimes denoted as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;backspace&lt;/code&gt; (in addition to sometimes being called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delete&lt;/code&gt;).
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-delete&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ALT-delete&lt;/code&gt; on a Mac keyboard) will remove a whole word, but place it in the kill ring.
Killing a line is simple: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-k&lt;/code&gt;, but this kills a line forwards.&lt;/p&gt;

&lt;p&gt;Putting the most recently killed word or line back is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-y&lt;/code&gt;, called yanking.
Yanking previous items in the ring is achieved with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-y&lt;/code&gt;, which will cycle through the ring.&lt;/p&gt;

&lt;h2 id=&quot;combinations&quot;&gt;Combinations&lt;/h2&gt;

&lt;p&gt;There is a 3 dimensional problem to solve here, with 16 possible combinations (14 unique operations):&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Removal direction (backwards or forwards)&lt;/li&gt;
  &lt;li&gt;Removal type (kill or delete)&lt;/li&gt;
  &lt;li&gt;Removal size (character, word, visual line, whole line)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;direction&quot;&gt;Direction&lt;/h3&gt;

&lt;p&gt;I use the Mac internal for marking the direction as backwards or forwards.
Even on laptop keyboards, I can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Fn-delete&lt;/code&gt; to get the forwards deletion.&lt;/p&gt;

&lt;p&gt;The whole line removal does not have a direction, but must be bound to both &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delete&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kp-delete&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;removal-type&quot;&gt;Removal Type&lt;/h3&gt;

&lt;p&gt;The un-modified delete key-press should trigger a character delete.
Using the meta (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M&lt;/code&gt;) modifier triggers a word removal.
Using the control (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C&lt;/code&gt;) modifier triggers a line removal.&lt;/p&gt;

&lt;h3 id=&quot;saving-items-to-the-kill-ring&quot;&gt;Saving Items to the Kill Ring&lt;/h3&gt;

&lt;p&gt;I use the Shift (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;S&lt;/code&gt;) modifier to explicitly trigger adding the removed text to the kill ring.&lt;/p&gt;

&lt;h2 id=&quot;binding-the-keys&quot;&gt;Binding the Keys&lt;/h2&gt;

&lt;p&gt;The following table tracks all the combinations which must be implemented.
The implementation looks like:&lt;/p&gt;

&lt;figure 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;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;&quot;&amp;lt;&amp;lt;keybinding&amp;gt;&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;&amp;lt;&amp;lt;function&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Direction&lt;/th&gt;
      &lt;th&gt;Type&lt;/th&gt;
      &lt;th&gt;Save&lt;/th&gt;
      &lt;th&gt;Key Binding&lt;/th&gt;
      &lt;th&gt;Function&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Backwards&lt;/td&gt;
      &lt;td&gt;Char&lt;/td&gt;
      &lt;td&gt;No&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;delete&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;None needed&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;&lt;del&gt;Char&lt;/del&gt;&lt;/td&gt;
      &lt;td&gt;&lt;del&gt;Yes&lt;/del&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Not implemented&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Word&lt;/td&gt;
      &lt;td&gt;No&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;M-delete&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;backward-delete-word&lt;/code&gt; *&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Word&lt;/td&gt;
      &lt;td&gt;Yes&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;M-S-backspace&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;backward-kill-word&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Line&lt;/td&gt;
      &lt;td&gt;No&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;C-backspace&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;backward-delete-line&lt;/code&gt; *&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Line&lt;/td&gt;
      &lt;td&gt;Yes&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;C-S-backspace&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;backward-kill-line&lt;/code&gt; *&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Forwards&lt;/td&gt;
      &lt;td&gt;Char&lt;/td&gt;
      &lt;td&gt;No&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;kp-delete&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delete-forward-char&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;&lt;del&gt;Char&lt;/del&gt;&lt;/td&gt;
      &lt;td&gt;&lt;del&gt;Yes&lt;/del&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Not implemented&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Word&lt;/td&gt;
      &lt;td&gt;No&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;M-kp-delete&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delete-word&lt;/code&gt; *&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Word&lt;/td&gt;
      &lt;td&gt;Yes&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;M-S-kp-delete&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kill-word&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Line&lt;/td&gt;
      &lt;td&gt;No&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;C-kp-delete&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delete-line&lt;/code&gt; *&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Line&lt;/td&gt;
      &lt;td&gt;Yes&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;C-S-kp-delete&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kill-line&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Both&lt;/td&gt;
      &lt;td&gt;Line&lt;/td&gt;
      &lt;td&gt;No&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;s-backspace&amp;gt;&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;s-kp-delete&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delete-current-line&lt;/code&gt; *&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Both&lt;/td&gt;
      &lt;td&gt;Line&lt;/td&gt;
      &lt;td&gt;Yes&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;s-S-backspace&amp;gt;&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;s-S-kp-delete&amp;gt;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kill-whole-line&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The functions marked with a * must be implemented.&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; from https://stackoverflow.com/a/12990359/1160876&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;backward-delete-word&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;s&quot;&gt;&quot;Delete characters backward until encountering the beginning of a word.
With argument ARG, do this that many times.&quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&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-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;progn&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;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;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;delete-word&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;s&quot;&gt;&quot;Delete characters forwards until encountering the beginning of a word.
With argument ARG, do this that many times.&quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&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-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;progn&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;forward-word&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;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;backward-delete-line&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;s&quot;&gt;&quot;Delete (not kill) the current line, backwards from cursor.
With argument ARG, do this that many times.&quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&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-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;progn&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;beginning-of-visual-line&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;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;delete-line&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;s&quot;&gt;&quot;Delete (not kill) the current line, forwards from cursor.
With argument ARG, do this that many times.&quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&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-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;progn&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;end-of-visual-line&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;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;backward-kill-line&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;s&quot;&gt;&quot;Kill the current line, backwards from cursor.
With argument ARG, do this that many times.&quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&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-region&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;progn&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;beginning-of-visual-line&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;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;;; from https://stackoverflow.com/a/35711240/1160876&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;delete-current-line&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;s&quot;&gt;&quot;Delete (not kill) the current line.&quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;p&quot;&lt;/span&gt;&lt;span class=&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-excursion&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;delete-region&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-visible-line&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;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;progn&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;forward-visible-line&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;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

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

&lt;p&gt;I am very happy with how cleanly these keybindings map to functionality.
Let’s see if I can actually put these to use!&lt;/p&gt;
</description>
                <pubDate>Wed, 04 Jul 2018 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/delete-v-kill.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/delete-v-kill.html</guid>
                
                <category>emacs</category>
                
                
            </item>
        
        
        
            <item>
                <title>Developing ox-jekyll</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;p&gt;In a previous post, I &lt;a href=&quot;./survey-org-jekyll.md&quot;&gt;surveyed existing org and jekyll&lt;/a&gt; integration workflows.
This survey found two common approaches, one that is Jekyll-centric and one that uses Org-publish (Emacs-centric).
Unfortunately, neither fit with my workflow and I decided to develop my own Org exporter.&lt;/p&gt;

&lt;p&gt;I finally have some functioning code, so I figured I should share details about the project and the development process.
You can find the project &lt;a href=&quot;https://github.com/gonsie/ox-jekyll&quot;&gt;on GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;starting-point&quot;&gt;Starting Point&lt;/h2&gt;

&lt;p&gt;In &lt;a href=&quot;http://www.gonsie.com/blorg/survey-org-jekyll.html&quot;&gt;my survey&lt;/a&gt; I found some useful resources:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The Worg Documentation on &lt;a href=&quot;https://orgmode.org/worg/dev/org-export-reference.html&quot;&gt;Org Export Engine&lt;/a&gt;;&lt;/li&gt;
  &lt;li&gt;An existing ox-jekyll in &lt;a href=&quot;https://github.com/yoshinari-nomura/org-octopress&quot;&gt;org-octopress&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;Great artists steal.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I want everything that org-octopress is doing with it’s jekyll exporter, I just want it built on markdown instead of HTML.&lt;/p&gt;

&lt;p&gt;So, I’ve copied &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ox-jekyll.el&lt;/code&gt; and replaced “html” with “md”.
After fixing a few function names, it works!&lt;/p&gt;

&lt;p&gt;Most importantly, the front matter is in the right spot (with and without a table of contents).
The next step is to make this work with the particulars of my publishing workflow.&lt;/p&gt;

&lt;h2 id=&quot;my-publishing-workflow-details&quot;&gt;My Publishing Workflow Details&lt;/h2&gt;

&lt;p&gt;There are a number of things I want my exporter to accomplish.
Many of which are particular to my workflow.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I use a single org file per post.&lt;/li&gt;
  &lt;li&gt;Upon export, the date (YYYY-MM-DD) should get added to the file name.&lt;/li&gt;
  &lt;li&gt;Subtree level matches export heading level (this is just how I design my site’s CSS)&lt;/li&gt;
  &lt;li&gt;Code snippets should be easy to export with appropriate syntax.
This is where many markdown converters differ, but jekyll currently wraps code blocks with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{ % highlight LANG %}&lt;/code&gt; / &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{ % endhighlight %}&lt;/code&gt;.
[Ignore the extra space before the %]&lt;/li&gt;
  &lt;li&gt;Jekyll front matter should be added above org-inserted table of contents.
The manual HTML source block is just hideous.&lt;/li&gt;
  &lt;li&gt;It should be easy to move the generated file to a separate location (I think this addressed in the org-publish workflow).&lt;/li&gt;
  &lt;li&gt;Org-y way to add tags to the post.&lt;/li&gt;
  &lt;li&gt;Safe export of title (colon character mucks things up for Jekyll).&lt;/li&gt;
  &lt;li&gt;Fix up links and export connected images.
This one is really a nice to have, not necessary.&lt;/li&gt;
  &lt;li&gt;TOC should be an ordered list (with the option to make it unordered)
WTF is the HTML exporter doing making it an unordered list with numbers in the text.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many of these are solved with code from org-octopress, particularly the yaml front matter.&lt;/p&gt;

&lt;h2 id=&quot;implementing-features&quot;&gt;Implementing Features&lt;/h2&gt;

&lt;p&gt;Here are some notes on my implementation.&lt;/p&gt;

&lt;h3 id=&quot;thinking-about-the-table-of-contents&quot;&gt;Thinking about the Table of Contents&lt;/h3&gt;

&lt;p&gt;I had been including a table of contents at the top of each of my posts.
I didn’t actually label it with “table of contents” and I prefer an un-numbered list.
This seems to be very contrary to what the org-exporter likes to do.
It pretty much does not allow for any fine-grained control of how the table of contents appears.&lt;/p&gt;

&lt;p&gt;While I was able to get the code to do what I wanted, it ended up being way too much of a hack.
In the end, I’ve decided that I don’t want a table of contents at all.
Really, it will be up to the markdown / jekyll / liquid parser to create a TOC if necessary.
This makes it easy to apply separate HTML styles to the TOC (to put it in a sidebar or something).&lt;/p&gt;

&lt;h3 id=&quot;preserving-the-headline-level&quot;&gt;Preserving the Headline Level&lt;/h3&gt;

&lt;p&gt;I would like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:headline-offset&lt;/code&gt; (as described &lt;a href=&quot;https://orgmode.org/worg/dev/org-export-reference.html&quot;&gt;here&lt;/a&gt;) to work on a file level.
This allows me to make sure the contents of my post match up the CSS on the web site (the content’s final destination).
This is definitely a more markdown-y way to do things rather than the org way.&lt;/p&gt;

&lt;p&gt;Unfortunately, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:headline-offset&lt;/code&gt; option is only supported per subtree.
I can hack it with a simple function that adds an “offset by 0” property to each subtree:&lt;/p&gt;

&lt;figure 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;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-jekyll-headline-offset&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;headline&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;contents&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;&quot;proper headline offset&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;info&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;plist-put&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;info&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:headline-offset&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;org-md-headline&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;headline&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;contents&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I add it to the derived backend &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:translate-alist&lt;/code&gt; like so:&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;org-export-define-derived-backend&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;jekyll&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;md&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:translate-alist&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;headline&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-jekyll-headline-offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;;; ...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now, this function is called each time a headline is translated by the export engine and my headline level is directly translated to markdown.&lt;/p&gt;

&lt;h3 id=&quot;setting-the-date&quot;&gt;Setting the Date&lt;/h3&gt;

&lt;p&gt;I have a strange workflow where I want the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+DATE:&lt;/code&gt; tag to be the day I started working on a post and the date in the filename to be the day I hit publish.
For my exporter, I can use the option &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date:&lt;/code&gt; to trigger this behavior.
The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date:&lt;/code&gt; option takes precedence over the variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-export-with-date&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;While I would like my code to support putting the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+DATE:&lt;/code&gt; property into the filename, this seems impossible with the export engine.
The date property is stored in the info plist which I don’t have access to at file naming time.&lt;/p&gt;

&lt;p&gt;Instead, I’ve implemented this functionality:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date:&lt;/code&gt; option controls if the value of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+DATE&lt;/code&gt; property is put into the Jekyll front matter.&lt;/li&gt;
  &lt;li&gt;I’ve added a new option to the exporter: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-jekyll-use-today-date&lt;/code&gt;.
If &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t&lt;/code&gt;, the exporter will prepend the filename with today’s date.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;results&quot;&gt;Results&lt;/h2&gt;

&lt;p&gt;I’m quite happy with my exporter, I even used it to export this post!
I still need to figure out how to use the org-publish workflow, but for now I can successfully export my blog posts.&lt;/p&gt;

&lt;p&gt;As with most of my projects, you can find it &lt;a href=&quot;http://github.com/gonsie/ox-jekyll&quot;&gt;on GitHub&lt;/a&gt;.
Please feel free to file an issue and share any feed back you have.&lt;/p&gt;
</description>
                <pubDate>Sat, 12 May 2018 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/ox-jekyll.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/ox-jekyll.html</guid>
                
                <category>emacs</category>
                
                <category>org</category>
                
                <category>blog</category>
                
                <category>jekyll</category>
                
                
            </item>
        
        
        
        
        
            <item>
                <title>Org Export Hooks</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;p&gt;In my quest for a simplified, org-based publishing scheme, I would like to add some information to a file when I export it.
Namely, I would like to add some metadata within the file, something like:&lt;/p&gt;

&lt;figure 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;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;property:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;exported:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;2018-01-30&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Let’s see if I can prototype this functionality through Org-mode!&lt;/p&gt;

&lt;h2 id=&quot;hooks-and-useful-functions&quot;&gt;Hooks and Useful Functions&lt;/h2&gt;

&lt;p&gt;I can think of some functions and/or variables I will need:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/34397046/org-export-hook-does-not-trigger#34397363&quot;&gt;StackOverflow: org-export-preprocess-final-hook&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.howtobuildsoftware.com/index.php/how-do/c0Og/datetime-emacs-org-mode-org-mode-timestamp-format-when-exported&quot;&gt;Org mode timestamp format&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Interesting functions from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h f org-insert-TAB&lt;/code&gt;:
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-insert-comment&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-insert-time-stamp&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;end-of-buffer&lt;/code&gt; which references &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(goto-char (point-max))&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s put them together into an elisp snippet.&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-export-preprocess-final-hook&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;save-excursion&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;insert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;\n#+property: exported: &quot;&lt;/span&gt;&lt;span class=&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-insert-time-stamp&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current-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;nv&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I think that does the thing that I want.
Ideally the property would go near (but not at) the top of my document, but that seems overly hard for the moment.
Notice that executing the block puts the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+property&lt;/code&gt; at the end of the document.
That is the behavior we want, BUT it should not be happening when executing the block rather it should happen on export.
Also, this function will keep inserting more text, rather than update an existing property.&lt;/p&gt;

&lt;p&gt;That seems like a rather hacky way to set properties.
There must be something included with org.
Let’s try the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-set-property&lt;/code&gt; function.&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;save-excursion&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;goto-char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;nv&quot;&gt;org-set-property&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;exported:&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;format-time-string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-time-stamp-formats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current-time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Gross.
Without going to the beginning of the file, it just adds a property drawer to the current subtree.
Going to the beginning of the file just inserts the timestamp with the error: “Before first headline in position 1”.&lt;/p&gt;

&lt;h2 id=&quot;stackexchange-to-the-rescue&quot;&gt;StackExchange to the Rescue&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://emacs.stackexchange.com/questions/21459/programmatically-read-and-set-buffer-wide-org-mode-property&quot;&gt;This StackExchange Question&lt;/a&gt; leads me in the direction of the powerful &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-element-parse-buffer&lt;/code&gt;.
Actually, there is one solution which includes a rather elegant set of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-global-prop&lt;/code&gt; functions that I want to properly package up and attribute&lt;sup&gt;&lt;a id=&quot;fnr.1&quot; class=&quot;footref&quot; href=&quot;#fn.1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.
Let’s try them out:&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;org-global-prop-set&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;exported:&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;format-time-string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-time-stamp-formats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current-time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;That function works!
What about as a hook?&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-export-before-parsing-hook&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-global-prop-set&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;exported:&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;format-time-string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-time-stamp-formats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current-time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Ugh, hooks are dead.
Reading through &lt;a href=&quot;https://orgmode.org/worg/doc.html#hooks&quot;&gt;the official org documenatation&lt;/a&gt;, it seems like each hook operates on a copy of the current buffer, not what I want.&lt;/p&gt;

&lt;h2 id=&quot;hooking-on-to-something&quot;&gt;Hooking on to Something&lt;/h2&gt;

&lt;p&gt;That’s fine, I can hack in another way.
Let’s just rebind the keys that do the exporting to a new function which will do the export property update.&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; add exported: property with date to org files when exporting&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/org-export-dispatch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;&quot;updateds the exported: property before opening the dispatch&quot;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-global-prop-set&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;exported:&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;format-time-string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;org-time-stamp-formats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;current-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;nv&quot;&gt;org-export-dispatch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure 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;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org&lt;/span&gt;
              &lt;span class=&quot;o&quot;&gt;&apos;&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;&quot;C-c C-e&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;my/org-export-dispatch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Not perfect (the spaces/newlines after the property are globbed) but good enough for now.
Someday I’ll have to work on integrating this functionality into the publishing process (rather than this hack), but hey, it works.&lt;/p&gt;

&lt;h1 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h1&gt;

&lt;p&gt;&lt;sup&gt;&lt;a id=&quot;fn.1&quot; href=&quot;#fnr.1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; I found the author, Tobias Zawada, and put the &lt;a href=&quot;https://github.com/gonsie/org-global-prop.el&quot;&gt;code on GitHub&lt;/a&gt;.&lt;/p&gt;
</description>
                <pubDate>Thu, 22 Mar 2018 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/ox-hook.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/ox-hook.html</guid>
                
                <category>org</category>
                
                <category>emacs</category>
                
                <category>elisp</category>
                
                
            </item>
        
        
        
        
        
        
        
            <item>
                <title>Org and Jekyll: A Survey</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;div id=&quot;table-of-contents&quot;&gt;
&lt;div id=&quot;text-table-of-contents&quot;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#sec-1&quot;&gt;My Current Process&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#sec-2&quot;&gt;Survey of Related Work&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#sec-3&quot;&gt;Future Work&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#sec-4&quot;&gt;Conclusions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;I am getting more into Org mode and I’ve started to use it in my blogging process.
I host my blog on GitHub pages with Jekyll.
I would like to keep my posts in markdown and not push HTML direct to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_site&lt;/code&gt;.
At first I thought I needed to build my own org exporter for Jekyll, but I’ve realized there a number of solutions (and blog posts about those solutions) already out there.&lt;/p&gt;

&lt;p&gt;This post is a survey of existing approaches to blogging with Org and Jekyll.&lt;/p&gt;

&lt;h2 id=&quot;my-current-process&quot;&gt;My Current Process&lt;a id=&quot;sec-1&quot; name=&quot;sec-1&quot;&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/images/blorg-process.png&quot; alt=&quot;Blogging Process&quot; /&gt;&lt;/p&gt;

&lt;p&gt;My current process includes several non-optimal “fix up” steps that I would like to eliminate.
Ideally, the Emacs publish transformation would spit-out the markdown exactly as I want it.
A bonus would be to take advantage of the Org publish workflow (rather than just an export of the document).
Then, I would be able to make any copy edits directly on the Org draft and the publish/deploy process could happen at the push of a button.&lt;/p&gt;

&lt;h2 id=&quot;survey-of-related-work&quot;&gt;Survey of Related Work&lt;a id=&quot;sec-2&quot; name=&quot;sec-2&quot;&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Before codifying my workflow, I’ve surveyed the work of others.
I have found a number of blog posts that discuss each author’s experience with and workflow for blogging with Org mode and Jekyll.&lt;/p&gt;

&lt;p&gt;There are three categories of approaches:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Support a Jekyll-centric workflow by developing a Jekyll plugin / converter.&lt;/li&gt;
  &lt;li&gt;Support an Org and Emacs-centric workflow by building on the org-publish functionality.
This approach transforms the Org content directly to HTML.&lt;/li&gt;
  &lt;li&gt;Support the Org-publish workflow by transitioning away from Jekyll altogether (i.e., using a different platform).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;jekyll-centric-approaches&quot;&gt;Jekyll-centric Approaches&lt;a id=&quot;sec-2-1&quot; name=&quot;sec-2-1&quot;&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Jekyll-centric approaches often attempt to make Org syntax a first-class citizen in Jekyll.
However, none of these tools have been adapted by the Jekyll community and thus remain outside of Jekyll itself.
This means that org-based blogs are not able to take advantage of automatic publishing by GitHub Pages.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://joelmccracken.github.io/entries/org-mode-jekyll-plugin/&quot;&gt;&lt;em&gt;An Org-Mode Jekyll Plugin&lt;/em&gt; by Joel’s Journal&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;This post takes a &lt;em&gt;literate programming&lt;/em&gt; approach to developing the Jekyll plugin for understanding org documents.
This post is great review of what is happening under the hood (including details on the I/O streams, which can be complex).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/eggcaker/jekyll-org&quot;&gt;&lt;em&gt;eggcaker/jekyll-org&lt;/em&gt; on GitHub&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Yet another Jekyll plugin.
Maybe I’m missing something as to why this approach is so attractive.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/tjaartvdwalt/jekyll-org-mode-converter&quot;&gt;&lt;em&gt;tjaartvdwalt/jekyll-org-mode-converter&lt;/em&gt; on GitHub&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;The ReadMe in this project is the equivalent of blog post.
It covers some other, existing projects and again uses the Jekyll converter/plugin approach.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;org-publish-approaches&quot;&gt;Org-publish Approaches&lt;a id=&quot;sec-2-2&quot; name=&quot;sec-2-2&quot;&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;There are many “hacks” that smash together Jekyll and Org.
Unfortunately, it seems that neither Jekyll nor Org are used in all their glory.
Each workflow contains a bunch of new elisp for getting everything to work.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;“Official” Guidance: &lt;a href=&quot;https://orgmode.org/worg/org-tutorials/org-jekyll.html&quot;&gt;&lt;em&gt;Using org to Blog with Jekyll&lt;/em&gt; on Worg&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Worg provides some guidance for blogging with Org.
This is the unofficial starting place for many Org bloggers and describes several Org-centric workflows.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.mfoot.com/blog/2015/11/17/using-org-mode-to-write-jekyll-blogs/&quot;&gt;&lt;em&gt;Using org-mode to blog with Jekyll&lt;/em&gt; by Martin Foot&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;This post expands on the Worg guidance for generating HTML for Jekyll.
It uses the HTML blocks to export the Jekyll front matter.
It includes the elisp snippets to set up proper project publishing.
As such, it’s a great starting place for new bloggers.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://levlaz.org/using-org-mode-with-jekyll/&quot;&gt;&lt;em&gt;Using org-mode with Jekyll&lt;/em&gt; by Levlaz&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;This post again starts from the Worg guidance (and a bad experience with Google Docs).
He includes the elisp &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-publish&lt;/code&gt; snippet which moves the draft out of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_org&lt;/code&gt; and into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_posts&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://juanreyero.com/open/org-jekyll/&quot;&gt;&lt;em&gt;Org-jekyll&lt;/em&gt; by Juan Reyero&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;The first line of the posts mentions that author is no longer using this method.
I really appreciate having this information up front!&lt;/p&gt;

    &lt;p&gt;The post uses org-publish to export subtrees from a single org document as individual posts.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;other-platform-approaches&quot;&gt;Other Platform Approaches&lt;a id=&quot;sec-2-3&quot; name=&quot;sec-2-3&quot;&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;It is important to recognize that there are some other approaches.
Some users have transitioned away from Jekyll completely, while new platforms have appeared to enable to blogging.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.superloopy.io/articles/2017/blogging-with-org-mode.html&quot;&gt;&lt;em&gt;Blogging with Org mode&lt;/em&gt; by Superloopy.io&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;&lt;strong&gt;Approach&lt;/strong&gt;:&lt;/p&gt;
    &lt;ul&gt;
      &lt;li&gt;Originally tried upstreaming a Jekyll plugin.&lt;/li&gt;
      &lt;li&gt;Moved away from Jekyll altogether, now using org-publish&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;Superloopy’s post has a lot of great ideas and discussion of the task.&lt;/p&gt;

    &lt;p&gt;First, I completely agree that setting up the Jekyll tech stack is a huge pain.
That is somewhat mitigated by the fact that GitHub will automatically publish them with Jekyll for you.
Also, it is disappointing that the gem/jekyll-plugin was ignored.&lt;/p&gt;

    &lt;p&gt;The post also describes a way to lower the barriers to blogging through a capture template (which looks fantastic).
The post also includes code for publishing direct from org and converting existing jekyll-markdown posts back to org.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/yoshinari-nomura/org-octopress&quot;&gt;&lt;em&gt;yoshinari-nomura/org-octopress&lt;/em&gt; on GitHub&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;The org-octopress package contains exporters for octopress and jekyll.
These exporters have a number of features I will want:&lt;/p&gt;
    &lt;ul&gt;
      &lt;li&gt;support for automatically adding yaml frontmatter&lt;/li&gt;
      &lt;li&gt;setting the layout in the frontmatter (with a default value)&lt;/li&gt;
      &lt;li&gt;some filename and date functionality&lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;This package still exports to HTML, rather than the markdown that I want.
But, if I can easily get it into my workflow, it might make sense to use this rather than developing a new tool.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;future-work&quot;&gt;Future Work&lt;a id=&quot;sec-3&quot; name=&quot;sec-3&quot;&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;At the start of this survey I thought that an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ox-jekyll&lt;/code&gt; solution would already exist.
On the contrary, I haven’t found one that builds on top of markdown and native Jekyll parsing.&lt;/p&gt;

&lt;p&gt;I will have to develop my own.
This exporter will have to fit neatly in existing workflows (if I want to make it useful to others).
I have a number of assumptions about the setup of projects and org files that I will have to be careful about or document clearly.&lt;/p&gt;

&lt;h2 id=&quot;conclusions&quot;&gt;Conclusions&lt;a id=&quot;sec-4&quot; name=&quot;sec-4&quot;&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;I’ve learned a lot from this review, including some useful takeaways for my own blogging purposes:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I should make sure my blog has a header.
I’ve been working on this post offline and with the relevant web pages already open.
If I were looking at a post on my own blog, I would have no context/meta-information on the page.&lt;/li&gt;
  &lt;li&gt;Starting the post with any update about its contents is such a courtesy to the reader.
I must do this for my own posts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One key take away: there are &lt;strong&gt;a ton&lt;/strong&gt; of people using Emacs and Org to blog (and write and do work).
The influence of literate programming means that many of these people write blog posts about their workflow.
As a result of this project, I’ve added about 5 blogs to my RSS feed.&lt;/p&gt;
</description>
                <pubDate>Wed, 07 Feb 2018 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/survey-org-jekyll.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/survey-org-jekyll.html</guid>
                
                <category>org</category>
                
                <category>emacs</category>
                
                
            </item>
        
        
        
            <item>
                <title>Configuring for Emacs 22 and 25</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;div id=&quot;table-of-contents&quot;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#sec-1&quot;&gt;Old Initialization File Setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#sec-2&quot;&gt;New Scheme&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#sec-3&quot;&gt;Tips&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#sec-4&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;p&gt;I work in high performance computing (HPC).
This means I work on some of biggest and best supercomputers in the world.
It also means that I work on some biggest and best supercomputers from 5 or 10 years ago.&lt;/p&gt;

&lt;p&gt;Recently, I found myself on a machine with Emacs 22.
This post documents some of the changes I had to make to my Emacs configuration files to ensure that they could be used for any Emacs version I was likely to come across.&lt;/p&gt;

&lt;h2 id=&quot;old-initialization-file-setup&quot;&gt;Old Initialization File Setup&lt;a id=&quot;sec-1&quot; name=&quot;sec-1&quot;&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Ever since I’ve restarted using Emacs (from &lt;a href=&quot;http://gonsie.com/blorg/subl-to-emacs.html&quot;&gt;SublimeText&lt;/a&gt;), I’ve been using a few configuration files.
I wanted my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs&lt;/code&gt; to be pretty generic and high level.
This would call an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init.el&lt;/code&gt; file which had a bunch of settings and packages.
I also put a bunch of machine-specific configurations in a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs-custom.el&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Looking at Emacs 22, I don’t think there is any support for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package.el&lt;/code&gt;.
I could roll with an old version, but after a quick search I could only find a snapshot for Emacs 23.
In reality, I don’t need full Emacs package support, I just want to ensure my basic settings are on (I love my colors and hate auto-save files).&lt;/p&gt;

&lt;h2 id=&quot;new-scheme&quot;&gt;New Scheme&lt;a id=&quot;sec-2&quot; name=&quot;sec-2&quot;&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The new scheme has four files, three of which are called from the root &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs&lt;/code&gt; file.&lt;/p&gt;

&lt;h3 id=&quot;emacs&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs&lt;/code&gt;&lt;a id=&quot;sec-2-1&quot; name=&quot;sec-2-1&quot;&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This file contains all vanilla Emacs 22 settings.
Some packages, such as autopair or org, have at one point been included in the Emacs distribution, but are not guaranteed.
That said, the settings in this file should be safe for &lt;strong&gt;all&lt;/strong&gt; versions of Emacs.&lt;/p&gt;

&lt;h3 id=&quot;emacs-customel&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs-custom.el&lt;/code&gt;&lt;a id=&quot;sec-2-2&quot; name=&quot;sec-2-2&quot;&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This file contains any machine-specific settings (such as the ispell path) or customize settings.
Note that you have to manually &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;touch&lt;/code&gt; this file when getting set up on a new machine or Emacs will complain.&lt;/p&gt;

&lt;h3 id=&quot;initel&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init.el&lt;/code&gt;&lt;a id=&quot;sec-2-3&quot; name=&quot;sec-2-3&quot;&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This file contains everything to do with packages.
It has the set-up for MELPA and then use-package for everything else.
I actually really like how clean and single purpose this file turned out to be.&lt;/p&gt;

&lt;h3 id=&quot;themeel&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;theme.el&lt;/code&gt;&lt;a id=&quot;sec-2-4&quot; name=&quot;sec-2-4&quot;&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This file contains all the settings for my color theme.
This file must be correct (i.e., not throwing errors) for all versions of Emacs as well.
Any package-specific colors must be properly protected in case the package isn’t loaded.&lt;/p&gt;

&lt;p&gt;For my particular setup, I am only able to achieve this because I include the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;color-theme&lt;/code&gt; package/elisp files with my dotfiles distribution.
Colors are notoriously tricky, so I’ve got something that works and I’m not changing it.&lt;/p&gt;

&lt;h2 id=&quot;tips&quot;&gt;Tips&lt;a id=&quot;sec-3&quot; name=&quot;sec-3&quot;&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Here are a few snippets I used to make everything work.&lt;/p&gt;

&lt;h3 id=&quot;checking-the-emacs-version&quot;&gt;Checking The Emacs Version&lt;a id=&quot;sec-3-1&quot; name=&quot;sec-3-1&quot;&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init.el&lt;/code&gt; should only be called from Emacs 25 or greater.
My &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init.el&lt;/code&gt; would probably work for Emacs 24 as well, but I’ll leave it for now.&lt;/p&gt;

&lt;figure 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;nb&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;24&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;emacs-major-version&lt;/span&gt;&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;load&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;~/.config/emacs/init.el&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;checking-for-a-package&quot;&gt;Checking for a Package&lt;a id=&quot;sec-3-2&quot; name=&quot;sec-3-2&quot;&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Some package specific colors can only be set if the package is loaded.
I suppose this could be done through use-package, but I have org outside of that for now.&lt;/p&gt;

&lt;figure 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;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;noerror&lt;/span&gt;&lt;span class=&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-face-attribute&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-table&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:foreground&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;#536fd6&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;package-initialization&quot;&gt;Package Initialization&lt;a id=&quot;sec-3-3&quot; name=&quot;sec-3-3&quot;&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Since my packages are all loaded in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init.el&lt;/code&gt; file (and the file is only loaded for specific Emacs versions), I put the MELPA setup and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(package-initialize)&lt;/code&gt; calls in there.
This causes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package.el&lt;/code&gt; to complain and automatically put a call to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(package-initalize)&lt;/code&gt; in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs&lt;/code&gt; file.
Thus, to use a setup like this, I needed to add a comment at the beginning of my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs&lt;/code&gt; file.&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; package.el will check for this comment; it&apos;s actually called from init.el&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; (package-initialize)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;a id=&quot;sec-4&quot; name=&quot;sec-4&quot;&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;I think this new scheme is quite slick.
I get my favorite colors and settings no matter what machine I’m working on.
Plus, there are no complaints/warnings/errors when I start up Emacs.&lt;/p&gt;
</description>
                <pubDate>Sat, 03 Feb 2018 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/emacs-v22.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/emacs-v22.html</guid>
                
                <category>emacs</category>
                
                <category>org</category>
                
                
            </item>
        
        
        
        
        
        
        
            <item>
                <title>Part 2: Counting Words</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;p&gt;&lt;em&gt;This post is part of a series.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/blorg/part1-org-for-dev-elisp.html&quot;&gt;Part 1: Using Org to Develop E-lisp Snippets&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(You are here) Part 2: Counting Words&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#org71ee782&quot;&gt;Exploring Existing Functionality&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#org02a74e3&quot;&gt;Marking and Counting&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#org6527a27&quot;&gt;Jaunting&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#org98fd9b5&quot;&gt;Count All the Things!&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I often use an separate (Org) file to develop written content, especially when I am filling out an application that has essay questions.
The answers often have a word-count or character-count limit.
Let’s use Emacs and Org to count words!&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;org71ee782&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;exploring-existing-functionality&quot;&gt;Exploring Existing Functionality&lt;/h2&gt;

&lt;p&gt;First, I use builtin documentation (and tab completion) to compile some useful functions.
Actually, I flailed a lot and bugged my friend who knows a bunch about Emacs and Org.&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;count-words&lt;/code&gt; function is obviously a good place to start.
The documentation indicates that functions works on either a region or buffer and that it acts differently if called from lisp (rather than interactively).
I don’t know anything about regions, but the Emacs Lisp documentation for “The Region” mentions two more useful functions: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;region-beginning&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;region-end&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Looking through all the Org functions, two stick out: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-mark-subtree&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-babel-mark-block&lt;/code&gt;.
These functions create a region on a specified chunk of Org content.&lt;/p&gt;

&lt;p&gt;Finally, I’ll need to go to the Org location to mark the region.
There are a few functions that look good for that: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-goto&lt;/code&gt; (though that seems to be very interactive) and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-id-goto&lt;/code&gt;.
Also, I come across &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-babel-goto-named-src-block&lt;/code&gt;.
I already know how to name a source block.
For the other go-tos, making an Org ID is easy enough: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-id-get-create&lt;/code&gt;.
(Note, although &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-id-new&lt;/code&gt; looks promising, I eventually learn that it doesn’t do what I want).&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;org02a74e3&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;marking-and-counting&quot;&gt;Marking and Counting&lt;/h2&gt;

&lt;p&gt;I need to create an Org section for each answer that I want to word count.
I can either use a header/node/subtree or a source block (of text).
In the first case, I’ll add a unique ID to the header (by invoking the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-id-get-create&lt;/code&gt;) so I can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-id-goto&lt;/code&gt;.
In the source block case, I can simply give it a name.&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;**&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Describe&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Blah&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;words&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;:PROPERTIES:&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;:ID:&lt;/span&gt;       &lt;span class=&quot;nv&quot;&gt;460D55A4-7C61-485C-8778-075406BAE8A4&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;:END:&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;My&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;answer&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;that&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blah.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure 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;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;question1&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;BEGIN_SRC&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;text&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;Blah&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blah&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blah.&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;END_SRC&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The snippet for counting words in a subtree looks something like:&lt;/p&gt;

&lt;figure 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;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;subtree-method&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;BEGIN_SRC&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elisp&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-id-goto&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;460D55A4-7C61-485C-8778-075406BAE8A4&quot;&lt;/span&gt;&lt;span class=&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-mark-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;nv&quot;&gt;count-words&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;nv&quot;&gt;region-end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; note that this snippet does not work&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;END_SRC&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Unfortunately, the first snippet doesn’t work.
Instead, it shows the error “Wrong type argument: markerp nil”.&lt;/p&gt;

&lt;p&gt;Let’s try the source block way:&lt;/p&gt;

&lt;figure 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;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;src-block-method&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;BEGIN_SRC&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elisp&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-babel-goto-named-src-block&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;question1&quot;&lt;/span&gt;&lt;span class=&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-babel-mark-block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;count-words&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;nv&quot;&gt;region-end&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;END_SRC&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Huzzah! This one works.
Strangely, the result appears below the question block, not where I would expect it (below the code snippet).&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;org6527a27&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;jaunting&quot;&gt;Jaunting&lt;/h2&gt;

&lt;p&gt;My friend (who actually reads books) shows me an awesome Emacs lisp function&lt;sup&gt;&lt;a id=&quot;fnr.6&quot; class=&quot;footref&quot; href=&quot;#fn.6&quot;&gt;6&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;save-excursion&lt;/code&gt;: Save point, and current buffer; execute BODY; restore those things.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Turns out, this function is all over a bunch of e-lisp code.
Let’s try it!
First, the subtree version of counting words:&lt;/p&gt;

&lt;figure 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;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;subtree-method&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;BEGIN_SRC&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elisp&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;save-excursion&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;org-id-goto&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;460D55A4-7C61-485C-8778-075406BAE8A4&quot;&lt;/span&gt;&lt;span class=&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-mark-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;nv&quot;&gt;count-words&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;nv&quot;&gt;region-end&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;END_SRC&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Low and behold! It suddenly works.
Plus, the results appear below the current code block.
Using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;save-excursion&lt;/code&gt; also fixes the source block method, making the results block appear near it.&lt;/p&gt;

&lt;p&gt;One remaining issue with the subtree method is that it counts the Org properties drawer in the word count.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;org98fd9b5&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;count-all-the-things&quot;&gt;Count All the Things!&lt;/h2&gt;

&lt;p&gt;Finally, our word counting snippet should work on a bunch of subtrees or blocks.
Let’s pass some input to the snippets.
Also, we should pretty print the results.
Finally, I’ve included the code to count the characters as well.
The source block method ends up looking like:&lt;/p&gt;

&lt;figure 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;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;questions&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;question1&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;question2&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;question3&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;BEGIN_SRC&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elisp&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blks=questions&lt;/span&gt;  &lt;span class=&quot;ss&quot;&gt;:results&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;nv&quot;&gt;save-excursion&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blks&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;b&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blks&lt;/span&gt;&lt;span class=&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;blks&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;blks&lt;/span&gt;&lt;span class=&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-babel-goto-named-src-block&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;org-babel-mark-block&lt;/span&gt;&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;princ&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;princ&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;\t&quot;&lt;/span&gt;&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;princ&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;count-words&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;nv&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;nb&quot;&gt;princ&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; words\t&quot;&lt;/span&gt;&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;princ&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;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&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;nv&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;nb&quot;&gt;princ&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; chars\n&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;END_SRC&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;RESULTS:&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;question1&lt;/span&gt;	&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;words&lt;/span&gt;	&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;chars&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;question2&lt;/span&gt;	&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;words&lt;/span&gt;	&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;chars&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;question3&lt;/span&gt;	&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;words&lt;/span&gt;	&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;chars&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The same can be done for the subtree method, but with IDs as the input.&lt;/p&gt;

&lt;h2 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h2&gt;

&lt;p&gt;&lt;sup&gt;&lt;a id=&quot;fn.6&quot; href=&quot;#fnr.6&quot;&gt;6&lt;/a&gt;&lt;/sup&gt; Documentation for &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/eintr/save_002dexcursion.html#save_002dexcursion&quot;&gt;Emacs Lisp save-excursion&lt;/a&gt;&lt;/p&gt;
</description>
                <pubDate>Wed, 10 Jan 2018 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/part2-counting-words.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/part2-counting-words.html</guid>
                
                <category>emacs</category>
                
                <category>elisp</category>
                
                <category>org</category>
                
                
            </item>
        
        
        
            <item>
                <title>Part 1: Using Org to Develop Elisp</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;p&gt;&lt;em&gt;This post is part of a series.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;(You are here) Part 1: Using Org to Develop E-lisp snippets&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/blorg/part2-counting-words.html&quot;&gt;Part 2: Counting Words&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#org408d605&quot;&gt;Useful Commands&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#orgf8927c2&quot;&gt;The Power of Introspection&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#org6ddd2d2&quot;&gt;Starting with Org Blocks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the powers of Org mode is the ability to run blocks of code and collect the output.
This allows you to capture code, context for writing the code (as actual text), and results in a single document.
This blog-post will describe how I’ve started to learn Emacs lisp using org and Emacs itself.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;org408d605&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;useful-commands&quot;&gt;Useful Commands&lt;/h2&gt;

&lt;p&gt;In Emacs, there are many ways to trigger the same actions.
I find that memorizing chords is terribly difficult (if I have any memorized its through muscle memory rather than my brain knowing what I’m typing).
Here is a short table of commands I’ve needed to get at the documentation builtin to Emacs.
Usually I run these via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x FUNCTION&lt;/code&gt;, which allows me to get at tab-completion if I don’t remember the exact name.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Chord&lt;/th&gt;
      &lt;th&gt;Function&lt;/th&gt;
      &lt;th&gt;Out Come&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h f FUNCTION&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;describe-function&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;show doc page for function&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-k F FUNCTION&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Info-goto-emacs-command-node&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;show manual page for function&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h k KEY&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;describe-key&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;show doc page for a chord&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h K KEY&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Info-goto-emacs-key-command-node&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;show manual page for chord&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h C-f&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;view-emacs-FAQ&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;show GNU Emacs FAQ&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h i&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;info&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;Bring up info documentation browser to the last info page you were looking at&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h i m elisp RET&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Shortcut to ELisp documentation&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h i d&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;Top level info directory&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-c C-c&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-ctrl-c-ctrl-c&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;Great function name. Does a bunch of things, namely running the source code block&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-c &apos;&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;org-edit-special&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;Edit block/table in a separate buffer popup&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Helpful web pages:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://orgmode.org/org.html#Editing-source-code&quot;&gt;Orgmode Source Code Editing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://orgmode.org/org.html#Easy-templates&quot;&gt;Org Easy Templates&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://orgmode.org/org.html#Specific-header-arguments&quot;&gt;Org Source Block Header Arguments&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/eintr/index.html#Top&quot;&gt;GNU Manual on Lisp in Emacs&lt;/a&gt; and the page on &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/eintr/save_002dexcursion.html#save_002dexcursion&quot;&gt;save-excursion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;orgf8927c2&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-power-of-introspection&quot;&gt;The Power of Introspection&lt;/h2&gt;

&lt;p&gt;I do not learn through text books.
Often, I find that they have all this extra narrative, when all I really want is the equation or detailed function documentation.
This does make it somewhat difficult for me to learn new programming languages as I’m not going to sit down a read a book.
This is where an IDE can really help.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In psychology, the process of introspection relies exclusively on observation of one’s mental state.
Introspection is closely related to human self-reflection and is contrasted with external observation&lt;sup&gt;&lt;a id=&quot;fnr.1&quot; class=&quot;footref&quot; href=&quot;#fn.1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In programming, introspection is the ability to look at the code itself, as a program is running.
Emacs allows this (in a sense) through the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;describe-function&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;describe-key&lt;/code&gt; functions.
Users can view both documentation and even the source code itself&lt;sup&gt;&lt;a id=&quot;fnr.2&quot; class=&quot;footref&quot; href=&quot;#fn.2&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.
Using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;describe-function&lt;/code&gt; function, along with tab completion, you can guess at functions that may exists and start to build e-lisp snippets.&lt;/p&gt;

&lt;p&gt;Built-in documentation isn’t technically introspection, but it is nice.
To bring up the “Emacs Lisp” manual, type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h i m elisp RET&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Despite my dislike of narrative, I now present a basic walk-through for getting started with Org mode code blocks.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;org6ddd2d2&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;starting-with-org-blocks&quot;&gt;Starting with Org Blocks&lt;/h2&gt;

&lt;p&gt;Now that we know how to bring up documentation without leaving Emacs, lets code!
I’m sure we could create a new elisp file / project, but who has time?
I would rather do my day job and learn a little new elisp when the opportunity arises.
This means I’m already working on something while writing in Org-mode.&lt;/p&gt;

&lt;h3 id=&quot;basics-running-and-results&quot;&gt;Basics: Running and Results&lt;/h3&gt;

&lt;p&gt;Org source blocks contain snippets of code that can be executed.
First, make sure executing e-lisp code through Org babel in enabled (usually in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init.el&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs&lt;/code&gt; file):&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;org-babel-do-load-languages&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;&apos;org-babel-load-languages&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;emacs-lisp&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;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Let’s start with a very basic Emacs lisp snippet.
Typing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;s TAB&lt;/code&gt; will automatically create a source code block (this is called a template&lt;sup&gt;&lt;a id=&quot;fnr.3&quot; class=&quot;footref&quot; href=&quot;#fn.3&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;).&lt;/p&gt;

&lt;figure 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;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;calc&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;BEGIN_SRC&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elisp&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;10&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;nv&quot;&gt;END_SRC&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Placing the cursor within the block at hitting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-c C-c&lt;/code&gt; triggers the run (type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;y&lt;/code&gt; to allow the snippet to run on your computer).
The results appear in the document.&lt;/p&gt;

&lt;figure 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;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;RESULTS:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;calc&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;8&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;string-manipulations&quot;&gt;String Manipulations&lt;/h3&gt;

&lt;p&gt;Elisp isn’t my go-to calculator, but it is a handy way to run simple calculations.
Let’s get more complicated with some quick text parsing.
Here I create 2 lists of items, then print all the permutations through an Org block.&lt;/p&gt;

&lt;figure 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;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;letters&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;A&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;B&lt;/span&gt;
&lt;span class=&quot;nb&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;nv&quot;&gt;NAME:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;numbers&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;2&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str-permute&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;BEGIN_SRC&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;elisp&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s1=letters&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s2=numbers&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:results&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;nv&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s1&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;x&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s1&lt;/span&gt;&lt;span class=&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;s1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s1&lt;/span&gt;&lt;span class=&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;tmp&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tmp&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;y&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tmp&lt;/span&gt;&lt;span class=&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;tmp&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tmp&lt;/span&gt;&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;princ&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&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;princ&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;car&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;nb&quot;&gt;princ&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;\n&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;END_SRC&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;#+&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;RESULTS:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;str-permute&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;A1&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;A2&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;B1&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;B2&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;C1&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;C2&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;A few notes about this example:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;To edit the e-lisp code in an “Emacs-Lisp” mode buffer, move the cursor in to the source block and type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-c &apos;&lt;/code&gt;.
This ensures proper indentation and other major mode niceness.
Note that this can work for any major mode&lt;sup&gt;&lt;a id=&quot;fnr.4&quot; class=&quot;footref&quot; href=&quot;#fn.4&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;, including text.&lt;/li&gt;
  &lt;li&gt;Notice the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:results output&lt;/code&gt; header argument on the code block&lt;sup&gt;&lt;a id=&quot;fnr.5&quot; class=&quot;footref&quot; href=&quot;#fn.5&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;.
There are a bunch of arguments, but the results one always messes me up.
In this case, I want to print the output as the snippet executes, not the return value of the snippet.&lt;/li&gt;
  &lt;li&gt;Do not forget to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cdr&lt;/code&gt; your while loop variable.
Should you forget, use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-g&lt;/code&gt; to kill the execution.&lt;/li&gt;
  &lt;li&gt;Emacs print functions are weird and the documentation is obtuse… I just use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;princ&lt;/code&gt;.
Unfortunately there is no easy to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;princ&lt;/code&gt; many items in a single, variable argument command (and I don’t want figure out how to build strings).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h2&gt;

&lt;p&gt;&lt;sup&gt;&lt;a id=&quot;fn.1&quot; href=&quot;#fnr.1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Introspection&quot;&gt;Introspection&lt;/a&gt;. &lt;em&gt;Wikipedia, The Free Encyclopedia&lt;/em&gt;. Accessed Jan. 4, 2018.&lt;/p&gt;

&lt;p&gt;&lt;sup&gt;&lt;a id=&quot;fn.2&quot; href=&quot;#fnr.2&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; Okay, this isn’t technically programmatic introspection, more like “built-in documentation.”
On the other hand, Emacs is somewhat unique in how users can interact with the documentation and the underlying code.&lt;/p&gt;

&lt;p&gt;&lt;sup&gt;&lt;a id=&quot;fn.3&quot; href=&quot;#fnr.3&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; Documentation for &lt;a href=&quot;https://orgmode.org/org.html#Easy-templates&quot;&gt;Org Easy Templates&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;sup&gt;&lt;a id=&quot;fn.4&quot; href=&quot;#fnr.4&quot;&gt;4&lt;/a&gt;&lt;/sup&gt; Documentation for &lt;a href=&quot;https://orgmode.org/org.html#Editing-source-code&quot;&gt;Org source blocks&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;sup&gt;&lt;a id=&quot;fn.5&quot; href=&quot;#fnr.5&quot;&gt;5&lt;/a&gt;&lt;/sup&gt; Documentation for &lt;a href=&quot;https://orgmode.org/org.html#Specific-header-arguments&quot;&gt;Org source block header arguments&lt;/a&gt;&lt;/p&gt;
</description>
                <pubDate>Wed, 10 Jan 2018 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/part1-org-for-dev-elisp.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/part1-org-for-dev-elisp.html</guid>
                
                <category>emacs</category>
                
                <category>elisp</category>
                
                <category>org</category>
                
                
            </item>
        
        
        
            <item>
                <title>Part 0: Word Count Goals</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;h2 id=&quot;an-excursion-into-e-lisp-and-org&quot;&gt;An Excursion into E-Lisp and Org&lt;/h2&gt;

&lt;p&gt;I have had some recent success with learning Emacs lisp through Org-mode.
I’ve decided to write about for others looking to get started with elisp.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/blorg/part1-org-for-dev-elisp.html&quot;&gt;Part 1: Using Org to Develop E-lisp Snippets&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/blorg/part2-counting-words.html&quot;&gt;Part 2: Counting Words&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I plan to eventually write a third post describing the process of publishing a package.&lt;/p&gt;
</description>
                <pubDate>Wed, 10 Jan 2018 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/part0-word-count.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/part0-word-count.html</guid>
                
                <category>emacs</category>
                
                <category>elisp</category>
                
                <category>org</category>
                
                
            </item>
        
        
        
        
        
            <item>
                <title>Converting from Sublime Text to Emacs</title>
                <author>gonsie@me.com (Elsa Gonsiorowski)</author>
                <description>&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#motivation&quot;&gt;Motivation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#prerequisites&quot;&gt;Prerequisites&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#the-basics&quot;&gt;The Basics&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#the-best-from-sublime-text&quot;&gt;The Best from Sublime Text&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#things-that-never-really-worked-in-st&quot;&gt;Things That Never Really Worked in ST&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#org-mode&quot;&gt;Org-mode&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;/h1&gt;

&lt;p&gt;Until recently, Sublime Text (ST) has been my go-to code editor,
especially when working on projects. The multi-cursor capabilities
completely changed my life and I can&apos;t imagine living without them.
Other than that, ST makes everything else pretty easy: simple package
management, straight forward project navigation, easy synchronization
across systems.&lt;/p&gt;

&lt;p&gt;For the past couple of months, I have been working closely with someone
who is an expert in Emacs and uses org-mode throughout his workday. The
power of tangling and exporting from a single document makes so much
&lt;em&gt;sense&lt;/em&gt;, I just have to try it. I&apos;ve always been a member of Team Emacs
and I even created my first GitHub read-me in org syntax. But, without
someone&apos;s door to knock on, I didn&apos;t truly understand the full power
of org-mode and it didn&apos;t stick.&lt;/p&gt;

&lt;p&gt;In this post I attempt to document my transition from Sublime Text 3 to
Emacs. The main motivation is for full org-mode support. While there are
some packages for ST that provide some org-mode syntax, full
functionality is lacking. Thus, I want to take everything I&apos;ve learned
(all the productivity enhancing features) in ST and replicate it with
Emacs.&lt;/p&gt;

&lt;p&gt;Throughout this post, I continually come to the same conclusion: Emacs
has support for the weird thing I want to do. Truly, &lt;a href=&quot;https://www.xkcd.com/378/&quot;&gt;this XKCD
comic&lt;/a&gt; is real.&lt;/p&gt;

&lt;p&gt;Setup: I use a Mac (technically 2, one at home and one at work) with the
latest Emacs installed via Homebrew. Based on &lt;a href=&quot;https://blog.aaronbieber.com/2016/12/29/don-t-use-terminal-emacs.html&quot;&gt;this
post&lt;/a&gt;
from Aaron Bieber, I have been mainly using Emacs through the GUI
program.&lt;/p&gt;

&lt;h1 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h1&gt;

&lt;p&gt;I&apos;m sure there are several resources for those who are just &lt;a href=&quot;https://www.gnu.org/software/emacs/tour/index.html&quot;&gt;getting
started with Emacs&lt;/a&gt;.
I will cover just the basics that you should know before reading the
rest of this post.&lt;/p&gt;

&lt;h2 id=&quot;assumptions&quot;&gt;Assumptions&lt;/h2&gt;

&lt;p&gt;You should know the basics of Emacs, meaning:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Understand chords, such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-x C-c&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Get help with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-h ?&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Quit (usually used for a chord gone-wrong) with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-g&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Understand how to check your Emacs environment
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x describe-key&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x describe-variable&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x describe-function&lt;/code&gt; (run this before trying
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-x M-c butterfly&lt;/code&gt;).&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Understand buffers and windows
    &lt;ul&gt;
      &lt;li&gt;Switch between open windows with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-x o&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;Remove this window with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-x 0&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;Split this window in half horizontally, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-x 2&lt;/code&gt;, or vertically
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-x 3&lt;/code&gt;.&lt;/li&gt;
      &lt;li&gt;Switch to another buffer with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-x b&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Knowing these things should get you pretty far… and prevent you from
breaking too many things. For the rest, just google it!&lt;/p&gt;

&lt;h2 id=&quot;package-management&quot;&gt;Package Management&lt;/h2&gt;

&lt;p&gt;Emacs supports many package managers, but the most popular one is
&lt;a href=&quot;http://melpa.org/#/&quot;&gt;MELPA&lt;/a&gt;. Check the MELPA website for the latest
&lt;a href=&quot;http://melpa.org/#/getting-started&quot;&gt;installation instructions&lt;/a&gt;. Once
MELPA is configured, you can manually install packages with:&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;M-x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;package-install&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;RET&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;package-name&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;On top of MELPA, I use the &lt;a href=&quot;http://melpa.org/#/use-package&quot;&gt;use-package&lt;/a&gt;
package to organize all of the packages I need. This works especially
well for syncing between multiple machines.&lt;/p&gt;

&lt;p&gt;Another solution could be &lt;a href=&quot;http://melpa.org/#/req-package&quot;&gt;req-package&lt;/a&gt;.
This is built on top of use-package, but I haven&apos;t tried it yet.&lt;/p&gt;

&lt;h2 id=&quot;color-theme&quot;&gt;Color Theme&lt;/h2&gt;

&lt;p&gt;Setting the terminal color scheme is actually a very hard thing to do.
Mainly the conflict arises from where the colors should actually be
specified: in the back-end or front-end. Should Emacs dictate what
&quot;red&quot; looks like, or should the terminal program? Plus, getting the
same color scheme in the GUI and terminal can be tricky.&lt;/p&gt;

&lt;p&gt;Here is my code for initializing the Emacs color theme. It has a useful
snippet is to set background color for GUI Emacs (which should not be
done when in the Terminal).&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;eval-after-load&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;color-theme&quot;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;&apos;&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;color-theme-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;nv&quot;&gt;color-theme-dusk&lt;/span&gt;&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;display-graphic-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
       &lt;span class=&quot;c1&quot;&gt;;; settings for GUI emacs&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;&apos;default-frame-alist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;background-color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;#282B35&quot;&lt;/span&gt;&lt;span class=&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;&apos;default-frame-alist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;foreground-color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;White&quot;&lt;/span&gt;&lt;span class=&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-frame-font&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Inconsolata 18&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;/figure&gt;

&lt;p&gt;I will cover my particular color theme in more detail in a separate
post.&lt;/p&gt;

&lt;h1 id=&quot;the-basics&quot;&gt;The Basics&lt;/h1&gt;

&lt;p&gt;There are a few basic things needed for setting up Emacs (or any
editor). If you already have a great Emacs configuration going, just
skip ahead.&lt;/p&gt;

&lt;h2 id=&quot;syncing-between-machines&quot;&gt;Syncing Between Machines&lt;/h2&gt;

&lt;p&gt;For years I have been syncing ST settings and packages with Dropbox.
This worked well until I started working for a company where arbitrary
cloud services are frowned upon. While a cloud solution could work
equally as well with Emacs, I would like my new setup to better support
remote machines.&lt;/p&gt;

&lt;p&gt;For my regular UNIX settings (bash profiles and so forth) I use a
&lt;a href=&quot;https://github.com/gonsie/dotfiles&quot;&gt;dot-files&lt;/a&gt; git repo. This repo gets
cloned to any new machine and includes instructions for getting setup.
It also includes a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;synch.sh&lt;/code&gt; script which does two things:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;For new installations, any existing dot-files that would be over
written are saved to a special folder. Then, all of my dot-files are
installed and symlinked to my home directory.&lt;/li&gt;
  &lt;li&gt;For existing installations, the synch script will diff the files in
the repo to those installed. Thus, any changes I&apos;ve made locally
can be added back to the repo and committed and shared.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For Emacs specifically, this is where
&lt;a href=&quot;http://melpa.org/#/use-package&quot;&gt;use-package&lt;/a&gt; comes in. Use-package will
auto-magically handle installing packages when I startup on a new
machine. For now, I have a setup with 3 separate Emacs-related dot
files:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs&lt;/code&gt;: This file is bare bones. It sets up MELPA and and includes
instructions for setting up a new machine (such as installing
use-package). It also makes the calls to load the other 2 files.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init.el&lt;/code&gt;: This is the file where all my settings live. It doesn&apos;t
necessarily need to be separate from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs&lt;/code&gt; file, but for now,
it is. All of my use-package declarations live in this file.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.emacs-custom.el&lt;/code&gt;: This file is where all of my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x customize&lt;/code&gt;
settings go. Many of these variable are machine specific, e.g.,
which packages are installed and where org files exist.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This setup is a work in progress and may be more convoluted than
necessary.&lt;/p&gt;

&lt;h2 id=&quot;trim-spaces&quot;&gt;Trim Spaces&lt;/h2&gt;

&lt;p&gt;I absolutely hate extra white space and a newline at the end of a file
is a must. Here are the Emacs settings:&lt;/p&gt;

&lt;figure 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;nv&quot;&gt;add-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;before-save-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;delete-trailing-whitespace&lt;/span&gt;&lt;span class=&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;require-final-newline&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;/figure&gt;

&lt;p&gt;Which does the equivalent of these ST options:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;trim_trailing_white_space_on_save&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;ensure_newline_at_eof_on_save&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;closing-parenthesis-insertion&quot;&gt;Closing Parenthesis Insertion&lt;/h2&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;autopair&lt;/code&gt; package is built-in to Emacs and will insert the closing
parenthesis. It isn&apos;t the smartest (such as inserting markup on a
selected word in org-mode), but it works for now. Additionally, since I
assume it is always on, there is no need to show it on my mode line
(which I&apos;ll get into later). Also, since I&apos;m now using Emacs and I
find myself editing more and more lisp, I&apos;ve turned on a mode which
shows the matching open or close parenthesis if one is selected.&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; autopair&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;autopair-global-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;diminish&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;autpair-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;show-paren-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;/figure&gt;

&lt;h2 id=&quot;large-files&quot;&gt;Large Files&lt;/h2&gt;

&lt;p&gt;One of the greatest things about ST is its handling of large files. In
Emacs, I can at least set the threshold for warning me about the large
file:&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; warn when opening files bigger than 100MB&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;large-file-warning-threshold&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100000000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;adding-language-syntax&quot;&gt;Adding Language Syntax&lt;/h2&gt;

&lt;p&gt;Emacs has built-in support for many coding languages, but sometimes
you&apos;ll need to ensure that the right mode is triggered for the correct
filenames and/or extensions. Here are two examples for turning on CMake
file support.&lt;/p&gt;

&lt;p&gt;In this first example, it assumes that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cmake-mode&lt;/code&gt; has been installed
manually:&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; CMake&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;auto-mode-alist&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;append&lt;/span&gt;
       &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;CMakeLists\\.txt\\&apos;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cmake-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
       &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\\.cmake\\&apos;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;cmake-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
       &lt;span class=&quot;nv&quot;&gt;auto-mode-alist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In this second example, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;use-package&lt;/code&gt; syntax is used for lazy-loading.
This means we don&apos;t have to remember to package-install cmake-mode. It
also means that the cmake-mode package is not installed until I open a
CMake file.&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; CMake&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;cmake-mode&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\\.cmake\\&apos;&quot;&lt;/span&gt;
         &lt;span class=&quot;s&quot;&gt;&quot;CMakeLists\\.txt\\&apos;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:config&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;cmake-font-lock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Here is another example, but for Rust:&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; rust&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;rust-mode&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\\.rs\\&apos;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;rust-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;the-best-from-sublime-text&quot;&gt;The Best from Sublime Text&lt;/h1&gt;

&lt;p&gt;There are so many things that Sublime Text just gets right, some things
I never knew I needed until they were at my finger tips.&lt;/p&gt;

&lt;h2 id=&quot;project-view&quot;&gt;Project View&lt;/h2&gt;

&lt;p&gt;One of the features from ST that I have come to expect is the project
sidebar. Having a file browser is key to orienting myself within the
project.&lt;/p&gt;

&lt;p&gt;For this, I use &lt;a href=&quot;http://melpa.org/#/neotree&quot;&gt;Neotree&lt;/a&gt; (some
documentation found &lt;a href=&quot;https://www.emacswiki.org/emacs/NeoTree&quot;&gt;here&lt;/a&gt;).
Its look and feel can be customized, but I haven&apos;t experimented with
that yet. I stuck with the suggested keybinding of &amp;lt;f8&amp;gt;. To customize
it for Mac, I had to change the default system command to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;open&lt;/code&gt;
program.&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; neotree&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;neotree&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:bind&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;[f8]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;neotree-toggle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;ss&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;neo-default-system-application&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;open&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Neotree supports a bunch of functionality in its buffer, including
&quot;quicklook&quot; and &quot;add file here&quot;. The one thing that is missing is
the equivalent of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dired-do-shell-command&lt;/code&gt;. This would allow me to
place the cursor at a file and trigger some command-line input.
Keybindings which matched (or were similar) to dired&apos;s would be nice,
but at least neotree supports the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;?&lt;/code&gt; key.&lt;/p&gt;

&lt;h2 id=&quot;multiple-cursors&quot;&gt;Multiple Cursors&lt;/h2&gt;

&lt;p&gt;The arguably best thing about ST is the multiple cursors. Once you know
about it, there are some many small things I open in ST just to use it.&lt;/p&gt;

&lt;p&gt;Emacs does have its very own
&lt;a href=&quot;http://melpa.org/#/multiple-cursors&quot;&gt;multiple-cursors&lt;/a&gt; package.
Unfortunately, there are several issues with getting the right
keybindings working on a Mac. Thus, I&apos;ve dedicated the &amp;lt;f2&amp;gt; and
&amp;lt;f3&amp;gt; keys for this. I&apos;ve also used ESC ESC as the quit-this-mode
command (similar to what would work in ST):&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; multiple-cursors&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;multiple-cursors&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:bind&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;f2&amp;gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mc/mark-previous-like-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;&quot;&amp;lt;f3&amp;gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mc/mark-next-like-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;&quot;C-c &amp;lt;f2&amp;gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mc/mark-all-like-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;&quot;&amp;lt;ESC&amp;gt; &amp;lt;ESC&amp;gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mc/keyboard-quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:ensure&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;/figure&gt;

&lt;p&gt;As you get started with multiple-cursors mode, it will ask you several
questions to make sure you really intend to something at all cursors.
The answer is usually yes. Sometimes things get mucked up and multiple
cursors will behave weird in a particular mode. As documented
&lt;a href=&quot;https://lists.gnu.org/archive/html/Emacs-orgmode/2015-10/msg00380.html&quot;&gt;here&lt;/a&gt;,
the solution is remove the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.emacs.d/.mc-lists.el&lt;/code&gt; file.&lt;/p&gt;

&lt;h2 id=&quot;project-wide-search&quot;&gt;Project-Wide Search&lt;/h2&gt;

&lt;p&gt;After some preliminary exploration, I still haven&apos;t been able to get a
good cross-file search going. The built-in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x grep&lt;/code&gt; does some nice
things, but isn&apos;t very reliable. I will investigate this further in a
future post.&lt;/p&gt;

&lt;h2 id=&quot;spell-check&quot;&gt;Spell Check&lt;/h2&gt;

&lt;p&gt;My spelling is atrocious, so spell checking is a must. ST on Mac can
turn on the system wide spell checker (with additional functionality to
remember/ignore words). Unfortunately, getting spell checking on Emacs
is much more complicated.&lt;/p&gt;

&lt;p&gt;The default spelling program in Emacs is ispell, or interactive spell.
To actually install the ispell dictionary on a Mac you must use homebrew
and tell Emacs where to find the program.&lt;/p&gt;

&lt;p&gt;I define the ispell program variable in my custom file since location is
machine specific.&lt;/p&gt;

&lt;figure 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;setq&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ispell-program-name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/usr/local/bin/aspell&quot;&lt;/span&gt;&lt;span class=&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;ispell-list-command&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;--list&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The only missing element is an always-on spell checker. Another Emacs
package, &lt;a href=&quot;https://www.emacswiki.org/emacs/FlySpell&quot;&gt;Flyspell&lt;/a&gt;, does the
trick. Now I just need to enable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flyspell-mode&lt;/code&gt; by default for
text-type buffers:&lt;/p&gt;

&lt;figure 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;dolist&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hook&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;text-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;nv&quot;&gt;hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&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;flyspell-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;nb&quot;&gt;dolist&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;hook&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;change-log-mode-hook&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;log-edit-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;nv&quot;&gt;hook&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&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;flyspell-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;/figure&gt;

&lt;h1 id=&quot;things-that-never-really-worked-in-st&quot;&gt;Things That Never Really Worked in ST&lt;/h1&gt;

&lt;p&gt;Now there are a couple of things that I could never really get working
with ST. This includes deep git integration and opening a shell. Of
course, Emacs supports these things! Over time, you&apos;ll slowly come to
the opinion that you should never have to leave Emacs.&lt;/p&gt;

&lt;h2 id=&quot;git&quot;&gt;Git&lt;/h2&gt;

&lt;p&gt;Emacs git support is done through &lt;a href=&quot;https://magit.vc&quot;&gt;magit&lt;/a&gt;. This is an
amazing project which gives you full git control without leaving Emacs.
Magit works through a series of popups, meaning you only need to know
one keybinding. Once you are in a magit popup, you can figure out how to
do things with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;?&lt;/code&gt; key.&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; MAGIT&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;magit&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:bind&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;C-x g&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&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;ss&quot;&gt;:ensure&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;/figure&gt;

&lt;h2 id=&quot;shell-integration&quot;&gt;Shell Integration&lt;/h2&gt;

&lt;p&gt;Unsurprisingly, Emacs offers deep shell integration. This post on
&lt;a href=&quot;https://masteringemacs.org/article/running-shells-in-emacs-overview&quot;&gt;Mastering Emacs
Shells&lt;/a&gt;
goes into the nitty-gritty details. There may be some settings needed to
get &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x shell&lt;/code&gt; working properly with fish. However, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x ansi-term&lt;/code&gt;
seems do everything needed, just be careful that you don&apos;t startup
Emacs inside your Emacs.&lt;/p&gt;

&lt;p&gt;For very simple shell one-liners, there is always dired mode. The
command &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!&lt;/code&gt; allows you to run a shell command on the selected file. This
works great for generating dot output from a graphviz file. I would
really like a shortcut for opening the selected file from the system,
but &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;! open&lt;/code&gt; works for now.&lt;/p&gt;

&lt;h1 id=&quot;org-mode&quot;&gt;Org-mode&lt;/h1&gt;

&lt;p&gt;The absolutely best thing about Emacs is
&lt;a href=&quot;https://orgmode.org&quot;&gt;org-mode&lt;/a&gt;. There is way too much to cover here, so
I&apos;ll talk about &lt;em&gt;why&lt;/em&gt; you should consider org-mode and provide links to
checkout. Case-in-point, this entire post was created with org mode.
Unlike the other packages, I manually install org-mode when setting up a
new computer.&lt;/p&gt;

&lt;h2 id=&quot;basics-syntax--outlining&quot;&gt;Basics Syntax &amp;amp; Outlining&lt;/h2&gt;

&lt;p&gt;Org-mode is a lot like markdown, at its core it is a syntax for markup
of plain text. Here is the basic markup:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Effect&lt;/th&gt;
      &lt;th&gt;Code&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;em&gt;italic&lt;/em&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/italic/&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;bold&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*bold*&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;del&gt;strike through&lt;/del&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;+strike through+&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;u&gt;underlined&lt;/u&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_underlined_&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;code&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~code~&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;verbatim&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=verbatim=&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;h1&amp;gt;Heading 1&amp;lt;/h1&amp;gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;* Heading 1&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;lt;h2&amp;gt;Heading 2&amp;lt;/h2&amp;gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;** Heading 2&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;http://gonsie.com&quot;&gt;Link Text&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-c C-l&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[[http://gonsie.com][Link Text]]&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Also (as seen above), org supports spreadsheets (aka really smart
tables). This support includes extra whitespace so that the tables
always look aligned.&lt;/p&gt;

&lt;p&gt;Org-mode does section folding with each heading. Hitting TAB will cycle
through the visibility of the children.&lt;/p&gt;

&lt;p&gt;Org-mode also supports blocks, such as code blocks, quotes, examples,
and more:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-org&quot; data-lang=&quot;org&quot;&gt;#+BEGIN_SRC rust
fn sample_code () -&amp;gt; u32 {
    10
}
#+END_SRC&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

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

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-rust&quot; data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;k&quot;&gt;fn&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sample_code&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;u32&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;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-org&quot; data-lang=&quot;org&quot;&gt;#+BEGIN_QUOTE
Everybody lies
 -- Dr. House
#+END_QUOTE&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

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

&lt;blockquote&gt;
  &lt;p&gt;Everybody lies – Dr. House&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As you&apos;ll learn, the standard way to add markup/options/metadata within
an org document is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#+SETTING&lt;/code&gt; marker at the beginning of a line.
This is the way that org is able to support complex exporting to latex
documents.&lt;/p&gt;

&lt;h2 id=&quot;literate-programming&quot;&gt;Literate Programming&lt;/h2&gt;

&lt;p&gt;Literate programming is the idea that a single document should include
the thought process used to create code as well as the code itself. This
works for R scripts, where the author is trying to tell a story about
the data while presenting and including the data itself.&lt;/p&gt;

&lt;h3 id=&quot;export&quot;&gt;Export&lt;/h3&gt;

&lt;p&gt;Each org document can be exported, or converted, to a document in a
different language. Export options include LaTeX, Beamer, Markdown,
HTML, and more. The exporter pane is brought up with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-c C-e&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;tangle&quot;&gt;Tangle&lt;/h3&gt;

&lt;p&gt;All the pieces come together with tangling. Tangling takes a piece of
code which is written your document and executes it. Then, it can even
embed result directly in the document itself.&lt;/p&gt;

&lt;p&gt;Here are two examples of org-mode source code blocks.
To generate the RESULTS blocks, one would type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-c C-c&lt;/code&gt; within a source block.&lt;/p&gt;

&lt;h4 id=&quot;example-1-shell-command&quot;&gt;Example 1: Shell Command&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-org&quot; data-lang=&quot;org&quot;&gt;#+BEGIN_SRC bash
hostname
#+END_SRC

#+RESULTS:
Eris.local&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h4 id=&quot;example-2-generate-and-embed-an-image&quot;&gt;Example 2: Generate and Embed an Image&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-org&quot; data-lang=&quot;org&quot;&gt;#+BEGIN_SRC dot :file images/example_dot.png :cmdline -Kdot -Tpng
digraph g {
rankdir = LR;
a -&amp;gt; b;
}
#+END_SRC

#+RESULTS:&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;img src=&quot;/images/example_dot.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I&apos;ll just let that seep in. The possibilities are truly endless.&lt;/p&gt;

&lt;h2 id=&quot;agendas&quot;&gt;Agendas&lt;/h2&gt;

&lt;p&gt;One great feature of org-mode is its ability to track to do items.
Getting this system setup and organized can be somewhat of a bear, so
I&apos;ll avoid getting overly detailed. Instead, I encourage you to start
with a bare bones setup and see what works for you. If you do decide
that org-mode agenda can fit into your daily workflow, I encourage you
to look around at what others have done.&lt;/p&gt;

&lt;p&gt;First, you&apos;ll need to turn on the org-mode agenda functions with some
keybindings. The defaults are:&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; org-mode agenda recommended keybindings&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;&quot;\C-cl&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-store-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;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;\C-ca&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-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;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;\C-cc&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;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;nv&quot;&gt;global-set-key&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;\C-cb&quot;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;org-iswitchb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next, you&apos;ll need an easy way to keep track of any TODO item you
create. The easiest way I&apos;ve found is this on-save hook (from
&lt;a href=&quot;http://fgiasson.com/blog/index.php/2016/06/21/optimal-Emacs-settings-for-org-mode-for-literate-programming/&quot;&gt;Frederick
Giasson&lt;/a&gt;).
Through this hook, every org file is automatically &quot;filed&quot; and any to
do items inside will be found by the org-mode agenda builder.&lt;/p&gt;

&lt;figure 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;c1&quot;&gt;;; Add Org files to the agenda when we save them&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;to-agenda-on-save-org-mode-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;when&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;string=&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;&quot;%s&quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;major-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;org-mode&quot;&lt;/span&gt;&lt;span class=&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-file-to-front&lt;/span&gt;&lt;span class=&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;&apos;after-save-hook&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;to-agenda-on-save-org-mode-file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This does mean that when files are deleted or moved the org agenda
complains.&lt;/p&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;I&apos;ve been down the Emacs rabbit hole about 2 months now. It has been
fun and I&apos;m excited to continue to modify my setup and play with new
packages. You can find my setup &lt;a href=&quot;https://github.com/gonsie/dotfiles/blob/master/emacs/init.el&quot;&gt;on GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In my brief exploration I&apos;ve found a number of extremely helpful
individuals:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://sachachua.com/blog/&quot;&gt;Sacha Chua&lt;/a&gt;: Sacha is incredibly
inspiring and a prolific contributor to the Emacs community. She
writes a weekly roundup of Emacs and Org news.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://fgiasson.com/blog/&quot;&gt;Frederick Giasson&lt;/a&gt;: He had the tip for
automatically filing org files on save.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://pragmaticemacs.com&quot;&gt;Pragmatic Emacs&lt;/a&gt; This blog has a number
of tips for using Emacs in academia and with LaTeX.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blog.aaronbieber.com&quot;&gt;Aaron Bieber&lt;/a&gt; He had blog post on
using GUI Emacs, which convinced me to try it.&lt;/li&gt;
&lt;/ul&gt;
</description>
                <pubDate>Sat, 09 Dec 2017 00:00:00 +0000</pubDate>
                <link>http://gonsie.com/blorg/subl-to-emacs.html</link>
                <guid isPermaLink="true">http://gonsie.com/blorg/subl-to-emacs.html</guid>
                
                <category>emacs</category>
                
                <category>org</category>
                
                
            </item>
        
        
        
        
    </channel>
</rss>
