Displaying a Productivity Chart in Emacs

I have created the following bit of Emacs Lisp that generates my daily productivity graph and displays it in it’s very own emacs buffer. You can kill the buffer by pressing the ‘q’ key.

(defun bh-kill-productivity-buffer()
  (kill-buffer "*Productivity*")
(defun bh-display-productivity ()
  (shell-command-to-string (expand-file-name     "~/my/bin/pomodoro_daily_chart.py -o ~/tmp/pomodoro_daily_chart.png"))
  (let ((bf (get-buffer-create "*Productivity*")))
    (switch-to-buffer bf)
    (setq buffer-read-only nil)
    (insert-image (create-image (expand-file-name     "~/tmp/pomodoro_daily_chart.png")))
    (setq buffer-read-only t)
    (set-buffer-modified-p nil)
    (local-set-key (kbd "q") 'bh-kill-productivity-buffer )

Leave a Reply