Annotating a Text File

Chewxy had a need to annotate a text file. He wanted to mark a rectangle of text, capture a classification type, and write the results to a JSON file. He thought about writing a Web app to do it but realized that as an Emacser, it would quicker and easier to write a little Elisp instead.

The result was a minor mode to annotate a text file. To make an annotation, he just highlights the text, captures the resulting rectangle and the annotation, and writes it to the JSON file. That’s all pretty straightforward but there are a few subtleties mostly involving writing the JSON file, and using the mouse to mark the region.

One thing that was not hard was turning his functions into a minor mode. It’s just a matter of adding a bit of boiler plate and a couple of functions to turn the mode on and off.

The source code for the project is here. Note that the link in Chewxy’s post is broken.

This entry was posted in General and tagged . Bookmark the permalink.