box.matto.nl
Enjoying Open Source Software

Elisping like it is 1998

GNU Emacs has been around for over forty years, and it has evolved tremendously during that period. Additional functionality was added, and new packages were created. Elisp also expanded with additional features.

I maintain a phlog, this is like a blog, but on Gopher. See this explanation on Wikipedia. I write my phlog posts as Denote org files, and use a home-made Elisp script to convert the org-file to my phlog format, add the post to the gophermap, and build the RSS-file.

OS X 10.3.9, the system I use for the 2025 edition of the Old Computer Challenge, runs GNU Emacs 22.2, and is too old for this workflow. In the final preparation for the Challenge, I started working on a solution.

In search of an alternative method to generate and publish posts, I opted to make this a fun learning experience by going back to the oldest GNU Emacs version running in my home network, GNU Emacs 20.3.1, from 1998.

GNU Emacs 20.3.1 on Red Hat 5.2

Earlier I created a virtual machine image with qemu-system-i386 running Red Hat 5.2. It runs GNU Emacs 20.3.1.

Red Hat 5.2 CD

Using this system I build the new Elisp script to write phlog posts, add phlog posts to the gophermap, and assemble the RSS-feed.

Some functionality was added to Elisp that was not available in 1998. While working on the code, I discovered that functions like replace-regexp-in-string, date-to-time, and built-in macro's like dolist and push were added after version 20.3.1, and I had to code around this. Of course I could look into the code of these in a current version of Emacs, but there is no fun in that.

Discovery

Elisp is brilliantly self-documenting, and using the apropos search functionality (M-x apropos) together with the describe-function functionality (C-h f), an awful lot can be discovered and learned.

GNU Emacs 20.3.1 on the Red Hat virtual machine

GNU Emacs 20.3.1. on the virtual machine

With this wonderful self-documenting system I was able to create the functionality I needed. My aim was to automate as much as possible, to prevent having to manually enter tedious error prone elements, and lower the friction to write posts.

The first function is to start a new phlog post. This prompts for a title, and generates a slug from this title, which becomes the file name of the post. It opens a buffer with this file, adds the current date in a fancy formatted topline, and adds the double underlined title. At the bottom of the file it adds a line "Last edited:" with the date and time in the RCS-timestamp format. Whenever changes to the file are committed, RCS automatically updates this timestamp. The empty space between the underlined title and this timestamp is to be filled with the contents of the phlog post.

Another function creates a line in the required format with the title and a link to the phlog post, and inserts that in the gophermap. A third function generates the RSS-feed.

This is now fully functional. As always, what follows is refactoring. Every day use will expose where it shines and where it needs improvement.

The remaining problem is that the PowerMac G4 that I use for this years Old Computer Challenge lacks RCS.

Joyful discovery and learning process

A learned a lot from coding on this old GNU Emacs version, and gained more insight, like the advantages of mapcar which I haven't used much before. And I had a lot of fun!

A key take-away is that I must critically review my docstrings, and expect that several of them require a smarter rewrite.

The Elisp script on its final destination

The script on its final destination

Tags:

⇽ My-Mind: a wonderful self-hosted mindmap web application


Made with ♥ by a human — no cookies, no trackers.
Proud member of the 250kb.club, the no-JS.club, the Blogroll.Club, and the Bukmark.Club.
Don’t let a billionaire’s algorithm control what you read — use an RSS feed reader.