Journal Automation with GNU Emacs

March 15, 2025

Today I decided to add some more automation to my journal writing with GNU Emacs and the yasnippet package.

This journal uses markdown format for its posts Wikipedia Markdown Entry . As such there are certain required elements when preparing the journal entry.

This theme also has specific formatting that must be used for supported styles that can be used in the journal entry (e.g. marginfigures, sidenotes, marginnotes).

Prior to this today I was referring back to documentation and past journal entries to get examples formatting I needed. Not really all that efficient, and prone to error. Automation to the rescue!

GNU Emacs & Yasnippet

I use the GNU Emacs editorGNU Emacs when writing this journal. There are a variety of editor options out there, I like Emacs because of the multitude of add-ons that can be used with it to extend the capabilities.

It is an editor that has infuriated and enthralled many and I am by no means an expert, far far from it. The add-on package I am using for my automation is called “yasnippet”Yasnippet Github which is available in the emacs elpa package system or directly on the author’s github site.

With the yasnippet package it is possible to create custom snippets that to add preformatted text to emacs. Yasnippets allows you to configure prompting that allows you to tab trough and replace the prompt text with content you want to use.

Below are the yasnippets that I setup to make my journaling easier.

Custom Yasnippets

<jhead

Yasnippet code for journal header

<mn

Yasnippet code for marginnote

<sn

Yasnippet code for sidenote

<mf

Yasnippet code for marginfigure

<mci

Yasnippet code for maincolumn image

<fwi

Yasnippet code for fullwidth image

<epi

Yasnippet code for epigraph

How does it work

When I start a new journal entry I start with setting up the journal header. With the yasnippet in place, I simply type “<bt” (without the quotes) and press the TAB key on the keyboard.

The “<bt” is replaced by the content of the snippet and anything the is formatted with a “${#:NAME}” is accessed by pressing the TAB key.

I then press TAB to go to the next field and type the text I want to replace the NAME value. Quick, simple and always formatted correctly.

This really saves time and makes quickly adding the different elements so easy. I am honestly kicking myself for not doing this sooner.

So there you have it, everything you ever wanted to know about my journal writing automation.

Journal Automation with GNU Emacs - March 15, 2025 - Stephen Lange