Walter Manger | To The Triforce
Quests for Knowledge

My first contribution to an Emacs package

This week I was experimenting with tracking time for work. The goal was to not leave Emacs (as it always is) and be able to adhere to the time tracking software that the company that I work for uses, Harvest.

A quick search produced harvest.el, which was exactly what I needed. After experimenting by tracking a few tasks I noticed that the clock out function was not working properly. What the function was documented to do was clock out of any running clocked entry. Luckily, I had a little bit of downtime at work and I, forked the repo, opened up the source and began to debug Elisp the only way I know how:

(message "What is this doing? %s" something)

Surprisingly, I was able to figure out the issue pretty quickly (about 15 minutes of hacking). There was what looked like a new variable to keep cached task entries that was not properly being referenced. Basically, there is an operator in Elisp that creates a list, it looks something like this:

'(1 2 3) ;; produces a list with elements 1 2 3 ;; => (1 2 3)

The function that was causing the problem in my case was taking a variable, that had previously been set to a list of elements and using the /’/ operator on that list. Which produces entirely different results. Using my example above:

'('(1 2 3)) ;; => (quote (1 2 3))

This produced entirely different results and in the context of the function, was unusable. All that needed to be done here was removing the list operator wrapping /’()/. Here’s a peek at my pull request: PR #15

The moral of this story: Contribute when you can

This fix took me about 30 minutes of total time. That included getting the Pull Request ready for the author. The author appreciated the help and perhaps many of the package users will appreciate it too. We should all help when we can. I learned a little more about Elisp along the way, so it wasn’t all giving and not receiving.