A progress indicator for code blocks in org-mode

A progress indicator for code blocks in org-mode courtesy
of John Kitchin:

;; give us some hint we are running
(defadvice org-babel-execute-src-block (around progress nil activate)
  (set-face-attribute
   'org-block-background nil :background "LightSteelBlue")
  (message "Running your code block")
  ad-do-it
  (set-face-attribute 'org-block-background nil :background "gray")
  (message "Done with code block"))

7 thoughts on “A progress indicator for code blocks in org-mode”

  1. Cool. I think it’d be nicer if it used text-properties to highlight only the currently evaluating block, instead of changing the face, which affects all blocks not only in this buffer but all buffers. I don’t know how to actually do this though :)

  2. This is what I have so far: http://pastebin.com/RPfyePgS

    It adds a text overlay on the current code block, sets the background to yellow, then creates a timer to delete the overlay 0.5 seconds after the block has finished evaluating. That way if it’s instantaneous you still get feedback. (0.1 seconds might be better)

    With timers there’s the possibility that you start evaluating another block before the timer has fired. I haven’t tested this.

Leave a Reply

Your email address will not be published. Required fields are marked *