Parsing Emacs OrgMode files, EU patent debate, and vacation!

After starting the year with two rather busy months, I planned to take it easy a bit. Such an optimistic plan of course never works out as intended… In times like these, it really helps that I love my job(s). It included a trip to Brussels to present the Open Source perspective on the role of patents at the European Commission Joint Research Center. Between office hunting and strategy workshops, there was also some time to hack on the OrgModeParser! See below.

I already mentioned earlier the plans to present about the situation of the Open Source community as a consumer of the patent system at the conference on “Innovation in a European Digital Single Market – The Role of Patents” in Brussels on March 17. FSFE, OpenForum Europe, colleagues at OIN and fellow Open Source supporters provided great feedback for the presentation. Many thanks to everybody who contributed! In the end, the concept for the presentation (which was a short introduction to a following panel discussion) was to explain five concrete difficulties the patent system causes in a collaborative production environment. The slides are available on the conference site. I hope to find some time to write up the presentation in a future blog post.

Sage joined the Open Invention Network. OIN is the world’s largest patent non-aggression community with the mission to protect Linux and Open Source. It speaks for the credibility that patent non-aggression has achieved and for how OIN represents that idea in the Open Source space when a publicly listed company that grew to success long before Linux really took off subscribes to it. Thanks, Sage! More large and small companies are considering this step. Your company should do so, too. If you have any questions, feel free to contact me.

The Endocode office hunt continues. We visited quite a number of available spaces, but the market is contested and suitable space is hard to come by. We are trying to have everybody involved have a say in the choice, too. This naturally leads to some quite lively discussions. An essential goal is to create a space that serves well as the home of the creative productivity our team enjoys. This includes flexible ways of working together, a mix of functional and motivational (read: fun) requirements, and generally an inviting atmosphere that one can look forward to when getting up in the morning. I think it is worth it to be picky. Hopefully we can invite for an office warming party soon…

We also continued with our series of Endocode strategy workshops. Our work revolves around Open Source form different angles – software engineering, DevOps and contributor relations. Analysing these different fields to identify a value chain that ties them all together is in a way intuitive for us that “grew up” in communities, but there is a significant gap in understandings and values from a business strategy perspective. But there must be a way, considering that Open Source is in essence a coordination mechanism for collaborative production, which is in turn a purely economic concept. We are making good progress, but I do expect it to still take significantly more effort. Still, such thought experiments are rather engaging and a great challenge to be part of.

Then, finally, I found some time to hack on a fun project of mine (woohoo!) A while ago I came up with the completely insane idea to access the content of Emacs OrgMode files from independent programs. Emacs OrgMode is hands-down about the best tool for the collection of notes, ideas, tasks, for tracking time, for writing content, and so much more. Nobody would ever argue about that :-) I wanted to be able to read OrgMode files in the programs I write, which are usually implemented in C++ and Qt. The code of OrgModeParser is on Github and LPGL 3 licensed. This week, this yielded a first working version and a demo program that integrates clocked work time data into the bash prompt:

The yellow line in the screenshot is the output of the OrgModeParser clock time demo, embedded into the bash prompt. It shows the currently clocked task, the running time of the current session, and on the right side of the screen the time clocked today and this week. One curiosity that triggered this was the inclusion of lambda functions into C++ with the recent updates of the language standard. There were quite a number of discussions of how the new C++ better supports functional programming approaches and is closer to some concepts of scripting languages, which I wanted to try out. It leads to some really interesting code:


//Find all clocklines that are incomplete (not closed):
auto const notCompleted = [](const ClockLine::Pointer& element) {
    return element.dynamicCast<CompletedClockLine>() == 0;
auto clocklines = findElements<ClockLine>(toplevel_, -1, notCompleted);
//Sort by start time, to determine the latest task that was started:
auto const startedLater = [](const ClockLine::Pointer& left, const ClockLine::Pointer& right) {
    return left->startTime() > right->startTime();
sort(clocklines.begin(), clocklines.end(), startedLater);

This finds all started, but not completed clock lines in an OrgMode file and sorts them by the start time with the last clocked-in task first in the list. Lambdas and automatic typing are a huge step forward in readability, and also from a practical point of view: The compiler prevents many mistakes, and of course a breakpoint can be set in the body of a lambda function. Good stuff, and the parser is fast enough to process a 100kByte TODO list in mere milliseconds, so it can be integrated into a typical bash prompt like this:


PS1="$PS1\$(OrgModeParser_ClockTimeDemo -p -c\${COLUMNS} ~/Org/\n"

The code builds and install with CMake and should compile on any recent Linux distribution or OSX installation. It requires Qt 5. I haven’t tried building it on Windows. If you are like me and occasionally (ahem :-) ) forget to clock into the task you currently work on, this may be of help. It is however meant to be a demo of what the parser can do: load an OrgMode file into a data structure that can be queried or filtered, updated and saved out again. Potential applications include embedding OrgMode data into GUI applications, or creating or reading TODO or CLOCK entries from other external tools like time trackers. Or even, which is one of the main long term motivations, enable integration with online project management tools like Redmine.

Next week I will be on a family vacation, which includes being offline. Offline as in no internet, no power outlets, and most of the time not even a hint of phone reception. I am so looking forward to it. I will check back in on April 13. Happy Easter holidays!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s