<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us"><generator uri="https://gohugo.io/" version="0.101.0">Hugo</generator><title type="html">logbook on A Scripter's Notes</title><subtitle type="html">Emacs, scripting and anything text oriented.</subtitle><link href="https://scripter.co/tags/logbook/" rel="alternate" type="text/html" title="HTML"/><link href="https://scripter.co/tags/logbook/index.xml" rel="alternate" type="application/rss+xml" title="RSS"/><link href="https://scripter.co/tags/logbook/atom.xml" rel="self" type="application/atom+xml" title="Atom"/><link href="https://scripter.co/tags/logbook/jf2feed.json" rel="alternate" type="application/jf2feed+json" title="jf2feed"/><updated>2026-04-22T08:24:58-04:00</updated><author><name>Kaushal Modi</name><email>kaushal.modi@gmail.com</email></author><id>https://scripter.co/tags/logbook/</id><entry><title type="html">Using Org Logbook Notes to record blog post updates</title><link href="https://scripter.co/using-org-logbook-notes-to-record-blog-post-updates/?utm_source=atom_feed" rel="alternate" type="text/html"/><link href="https://scripter.co/building-org-development-version/?utm_source=atom_feed" rel="related" type="text/html" title="Building Org Development version (2022)"/><link href="https://scripter.co/downloading-nim/?utm_source=atom_feed" rel="related" type="text/html" title="Downloading Nim"/><link href="https://scripter.co/creating-a-patch-file-using-magit/?utm_source=atom_feed" rel="related" type="text/html" title="Creating a patch file using Magit"/><link href="https://scripter.co/presenting-tomelr/?utm_source=atom_feed" rel="related" type="text/html" title="Presenting tomelr!"/><link href="https://scripter.co/defining-tomelr/?utm_source=atom_feed" rel="related" type="text/html" title="Defining tomelr – A library for converting Lisp expressions to TOML"/><id>https://scripter.co/using-org-logbook-notes-to-record-blog-post-updates/</id><author><name>Kaushal Modi</name></author><published>2022-05-16T00:59:00-04:00</published><updated>2022-05-16T00:59:00-04:00</updated><content type="html"><![CDATA[<blockquote>Quick introduction to Org mode&rsquo;s <code>:LOGBOOK:</code> feature and how I use it
to record time-stamped notes for blog post updates.</blockquote><div class="ox-hugo-toc toc">
<div class="heading">Table of Contents</div>
<ul>
<li><a href="#prior-forms-of-adding-post-updates">Prior forms of adding post updates</a></li>
<li><a href="#introducing-logbook">Introducing <code>:LOGBOOK:</code></a></li>
<li><a href="#adding-notes-to-logbook">Adding notes to <code>:LOGBOOK:</code></a></li>
<li><a href="#logbook-notes-example"><code>:LOGBOOK:</code> Notes Example</a></li>
<li><a href="#references">References</a></li>
</ul>
</div>
<!--endtoc-->
<p>Most of my blog posts are mainly to serve as documentation for my
future self
<span class="sidenote-number"><small class="sidenote">
This post will serve to remind me how to get the <code>:LOGBOOK:</code> notes
working once again in case I end up with some issue there.
</small></span>
. So when I get a chance, I try to fix outdated stuff in
my old blog posts. And along with the act of updating things, adding
brief notes describing those updates comes naturally to me.</p>

<h2 id="prior-forms-of-adding-post-updates">Prior forms of adding post updates&nbsp;<a class="headline-hash no-text-decoration" href="#prior-forms-of-adding-post-updates">#</a></h2>


<p>As I author my posts in Org mode, I can easy enter a date stamp using
the <code>org-time-stamp</code> command (bound by default to <kbd>C-c</kbd> <kbd>.</kbd> <kbd>RET</kbd>) and
follow that by the update note.</p>
<p>While that worked, that approach bothered me because those notes
didn&rsquo;t have consistent format across multiple posts. For example, I
might type the update as &ldquo;<code class="code-inline language-org"><span class="gs">*Update (&lt;time stamp&gt;)*</span>: &lt;<span class="s">note</span>&gt;</code>&rdquo; in one post, while I might type the same in a
<em>description list</em> form in another: &ldquo;<code class="code-inline language-org"><span class="k">- </span>&lt;<span class="s">time stamp</span>&gt;) :: &lt;<span class="s">note</span>&gt;</code>&rdquo;.</p>
<p>To solve the consistency problem, I came up with this Org macro:</p>
<p><a id="code-snippet--update-org-macro"></a></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-org" data-lang="org"><span class="line"><span class="cl"><span class="cs">#+macro</span><span class="c">: update - $1 :: $2</span>
</span></span></code></pre></div><div class="src-block-caption">
  <span class="src-block-number"><a href="#code-snippet--update-org-macro">Code Snippet 1</a>:</span>
  <code>{{{update(..)}}}</code> Org Macro
</div>
<p>This worked mostly &hellip; except when the update text needed to be a bit
longer, like a paragraph. It didn&rsquo;t look elegant in that case. Also,
if the text had a <em>comma</em> character in there, it needed to be escaped
with a backslash (<code>\</code>).</p>

<h2 id="introducing-logbook">Introducing <code>:LOGBOOK:</code>&nbsp;<a class="headline-hash no-text-decoration" href="#introducing-logbook">#</a></h2>


<p>So when I learned
<span class="sidenote-number"><small class="sidenote">
A little bit of history .. I learned about the <code>:LOGBOOK:</code> drawer when
Adam Porter mentioned it in <a href="https://github.com/kaushalmodi/ox-hugo/issues/203"><code>ox-hugo</code> Issue # 203</a> back in
September 2018. I wanted to use that feature, but I didn&rsquo;t have time
and/or know-how on how exactly I would parse those Org Drawers in
<code>ox-hugo</code> until very recently (May 2022)!
</small></span>
about the Org <code>:LOGBOOK:</code> drawer, it solved all those problems: (i)
consistency in adding notes (ii) easy to add update notes &ndash; in fact
much easier (iii) easy to type long form notes (iv) no comma escaping
needed.</p>
<p>Org Drawers look like this:</p>
<p><a id="code-snippet--code-org-drawers"></a></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-org" data-lang="org"><span class="line"><span class="cl">Content before the drawer
</span></span><span class="line"><span class="cl"><span class="c">:DRAWERNAME:
</span></span></span><span class="line"><span class="cl"><span class="c"></span><span class="cs">Content inside the drawer
</span></span></span><span class="line"><span class="cl"><span class="cs"></span><span class="c">:END:</span>
</span></span><span class="line"><span class="cl">Content after the drawer
</span></span></code></pre></div><div class="src-block-caption">
  <span class="src-block-number"><a href="#code-snippet--code-org-drawers">Code Snippet 2</a>:</span>
  Org Drawers
</div>
<p>and they can be inserted anywhere in your Org content using the
<code>org-insert-drawer</code> command (bound by default to <kbd>C-c</kbd> <kbd>C-x</kbd> <kbd>d</kbd>).</p>
<p><code>:LOGBOOK:</code> is a special kind of drawer that&rsquo;s auto-inserted by Org
mode when certain actions are detected, like changing the TODO state
of a subtree, or
<mark>adding a note</mark> . That latter action is what this blog post is about.</p>

<h2 id="adding-notes-to-logbook">Adding notes to <code>:LOGBOOK:</code>&nbsp;<a class="headline-hash no-text-decoration" href="#adding-notes-to-logbook">#</a></h2>


<p>You need to enable this feature using one of these methods:</p>
<ol>
<li>Set the <code>org-log-into-drawer</code> variable to a non-nil value
(typically <code>t</code>) in your Emacs config, or as a file-local variable,
or in your project&rsquo;s <strong><code>.dir-locals.el</code></strong> (⭐ my preference).</li>
<li>Set <code>#+startup: logdrawer</code> to enable this for the whole Org file.</li>
<li>To enable this feature for only selected subtrees, set the
<code>:LOG_INTO_DRAWER: t</code> property in the subtree (or one of its parent
subtrees).</li>
</ol>
<p>Once this is set, call the <code>org-add-note</code> command (bound by default to
<kbd>C-c</kbd> <kbd>C-z</kbd>). That will open a window with ∗Org Note∗ buffer where-in
you will type your post update and then <kbd>C-c</kbd> <kbd>C-c</kbd> to save it to the
subtree&rsquo;s <code>:LOGBOOK:</code> drawer. If that drawer didn&rsquo;t exist already, it
will be created directly under the subtree&rsquo;s heading.</p>
<p>The note will get recorded in this format by default under the current
subtree:</p>
<p><a id="code-snippet--logbook-default-format"></a></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-org" data-lang="org"><span class="line"><span class="cl"><span class="gh">*</span><span class="gs"> Subtree title</span>
</span></span><span class="line"><span class="cl"><span class="c">:LOGBOOK:
</span></span></span><span class="line"><span class="cl"><span class="c"></span><span class="cs">- Note taken on &lt;current date and time&gt; \\
</span></span></span><span class="line"><span class="cl"><span class="cs">  &lt;note text&gt;
</span></span></span><span class="line"><span class="cl"><span class="cs"></span><span class="c">:END:</span>
</span></span></code></pre></div><div class="src-block-caption">
  <span class="src-block-number"><a href="#code-snippet--logbook-default-format">Code Snippet 3</a>:</span>
  Default format of a <code>:LOGBOOK:</code> note
</div>
<p>As you see, you only type the note text, and the time-stamp is
inserted automatically.</p>

<h2 id="logbook-notes-example"><code>:LOGBOOK:</code> Notes Example&nbsp;<a class="headline-hash no-text-decoration" href="#logbook-notes-example">#</a></h2>


<p>Here are the update notes from one of my posts:</p>
<p><a id="code-snippet--logbook-example"></a></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-org" data-lang="org"><span class="line"><span class="cl"><span class="c">:LOGBOOK:
</span></span></span><span class="line"><span class="cl"><span class="c"></span><span class="cs">- Note taken on &lt;2018-08-26 Sun&gt; \\
</span></span></span><span class="line"><span class="cl"><span class="cs">  Mention =org-babel-demarcate-block=, tweak the =org-meta-return= advice.
</span></span></span><span class="line"><span class="cl"><span class="cs">- Note taken on &lt;2018-08-23 Thu&gt; \\
</span></span></span><span class="line"><span class="cl"><span class="cs">  Use ~M-return~ instead of ~C-return~ for splitting blocks and
</span></span></span><span class="line"><span class="cl"><span class="cs">  support upper-case blocks (though I [[* Converting Org keywords to lower-case][don&#39;t prefer those]]!).
</span></span></span><span class="line"><span class="cl"><span class="cs"></span><span class="c">:END:</span>
</span></span></code></pre></div><div class="src-block-caption">
  <span class="src-block-number"><a href="#code-snippet--logbook-example">Code Snippet 4</a>:</span>
  Examples of post update notes added to the <code>:LOGBOOK:</code> drawer
</div>
<p>You can see how they rendered at the top of the <a href="/splitting-an-org-block-into-two/">Splitting an Org block into two</a> post.</p>
<p>If you are an <code>ox-hugo</code> user following the <em>subtree-based export
flow</em>, and would like to export <code>:LOGBOOK:</code> notes in a similar
fashion, check out the <a href="https://ox-hugo.scripter.co/doc/drawers/"><code>ox-hugo</code> Manual: Drawers</a> page for details.</p>

<h2 id="references">References&nbsp;<a class="headline-hash no-text-decoration" href="#references">#</a></h2>


<ul>
<li><a href="https://orgmode.org/manual/Drawers.html" title="Emacs Lisp: (info &quot;(org) Drawers&quot;)">Org Info: Drawers</a></li>
<li><a href="https://orgmode.org/manual/Tracking-TODO-state-changes.html" title="Emacs Lisp: (info &quot;(org) Tracking TODO state changes&quot;)">Org Info: Tracking TODO state changes</a></li>
</ul>
]]></content><category scheme="https://scripter.co/categories/emacs" term="emacs" label="emacs"/><category scheme="https://scripter.co/categories/org" term="org" label="org"/><category scheme="https://scripter.co/tags/100daystooffload" term="100daystooffload" label="100DaysToOffload"/><category scheme="https://scripter.co/tags/logbook" term="logbook" label="logbook"/></entry></feed>