2018-04-15 counsel-org-clock

Some time ago I blogged about my Org-mode hydra. It turned out that that a link to that short article was posted to Reddit, and one of the commenters pointed out his counsel-org-clock package.

I’ve been blogging about Oleh Krehel’s Emacs-related stuff many times. This time we have a package not authored by him, but based on counsel. (Unfortunately, counsel-org-clock is apparently not in Melpa, so you have to download it directly from Github.)

It is basically a org-clock-in with a prefix argument of C-u, i.e., clocking in a task from history, on steroids. The main entry point is the command counsel-org-clock-context. When a clock is on, it just displays the path to the currently clocked entry, so that you can easily jump to it or any of its ancestors. The interesting part is what happens when there is no clocking at the moment: it displays the clock history using Ivy instead of the default Org-mode interface (which I strongly dislike), so you can just type a few characters to narrow down and select the thing to clock.

Even better, in either case you can press M-o to get a menu of possible actions to perform of the currently highlighted entry. You can clock in (the default action being jumping to the selected entry), change the todo state, or narrow to the selected entry, or set a tag or property on it, and do a few other things.

One drawback was that it turned out that you can’t change the default action to clocking in. I rolled up my sleeves and implemented a proof-of-concept solution to this and submitted a PR. Within a few hours the author fleshed my solution out and it is now available in the package.

One caveat: it didn’t work for me out of the box, somehow triggering an error. A simple M-: (setq org-clock-history nil) helped, and now I’m building my clock history from scratch (which is not a big deal, of course).

I have now added counsel-org-clock-context to my Org-mode hydra, just to see how useful it’s going to be for me. (Postscript after a few days: I’m more and more in love with this, although it didn’t replace my Org hydra – I still use org-clock-in-last a lot, for instance. But I’m not coming back to plain Org clock history at all.)

CategoryEnglish, CategoryBlog, CategoryEmacs