MC's journal

Setting Orange, the 16 day of Bureaucracy in the YOLD 3179

Using the pomodoro technique with Emacs

This week I've been trying out the pomodoro technique. It's a time-management technique that looks something like this:

  1. Work for 25 minutes.
  2. Take a short break, typically five minutes.
  3. Work for 25 minutes.
  4. Short break.
  5. Work for 25 minutes.
  6. Short break.
  7. Work for 25 minutes.
  8. Take a longer break, typically 15–30 minutes.

Then repeat the whole thing again and again during the day.

This looks simple enough. So simple, in fact, that there must be something more to the system. There is. The real magic is not in this simple list. The real magic is in scheduling all your work items in sizable 25 minute chunks.

When I have something I'm able to complete in just 25 minutes, I find it's much easier to focus on the task. I'm not allowed to check my e-mail, respond to instant messages or doing something else during those 25 minutes unless it's an emergency.

The original pomodoro is named after the Francesco Cirillo's kitchen timer, which was in the shape of a tomato ("pomodoro" in Italian). He simply set his tomato timer according to the list above.

Unlike Francesco I'm not using a physical timer. I'm using Dave Kerschner's pomodoro.el in Emacs to keep time.

I'm on a Mac these days, so I customized pomodoro-sound-player to the OS X built-in sound player /usr/bin/afplay. I recorded a small sound (a discreet "Hrmph!") with QuickTime to use with the timer.

I found the counter in the mode line counting down the seconds a little hysterical. I changed it to show only minutes left to the next period instead.

The original code just displayed the time for the current period, say "w24:59", but I wanted to see where in the cycle I was, so I changed it to say "w1-24" for 24 minutes left of the the first work period, "w2-09" for 9 minutes left of the second work period, et cetera.

I also added a function I call pomodoro-reset to reset the counters to the beginning of a work set.

Here's a diff:

diff --git a/pomodoro.el b/pomodoro.el
index 85069f1..b3b86dd 100644
--- a/pomodoro.el
+++ b/pomodoro.el
@@ -102,6 +102,12 @@
 (defvar pomodoro-mode-line-string "")
 (defvar pomodoro-end-time) ; the data type should be time instead of integer

+(defun pomodoro-reset ()
+  "Reset counters."
+  (interactive)
+  (setq pomodoro-current-cycle "w")
+  (setq pomodoros 0))
+
 (defun pomodoro-set-end-time (minutes)
   "Set how long the pomodoro timer should run"
   ;; no slave can work 2^16 seconds without rest!
@@ -132,8 +138,9 @@
             (setq pomodoro-current-cycle pomodoro-work-cycle)
             (pomodoro-set-end-time pomodoro-work-time))))
     (setq pomodoro-mode-line-string
-          (format (concat "%s" (format-seconds "%.2m:%.2s " time))
-                  pomodoro-current-cycle))
+          (format (concat "%s%s-" (format-seconds "%.2m " time))
+                  pomodoro-current-cycle 
+                  (+ 1 (mod pomodoros pomodoro-nth-for-longer-break))))
     (force-mode-line-update)))

 ;;;###autoload

Happy pomodoring,
MC


Written by MC using Emacs and friends.