I have a list of tasks I need to complete for a project I'm working on in a org file. The thing is that I would like to display the Wercker's status images of my project on that file to know how the unit tests are doing without visiting the Wercker site or the front page of my project's repo.

How can I achieve this?

  • 1
    This does not seem possible without re-writing a good portion of org-display-inline-images. However, you can add an Org Babel source code block that would run curl (or wget, or ...) to download an image and then link to this local copy. – Constantine Dec 14 '14 at 0:15
  • well, that seems to work. There is no way to run that code block automatically every time I switch to that buffer and then call to org-redisplay-inline-images? – shackra Dec 15 '14 at 6:55
  • @shackra does the approach in my answer below work for your? – rekado Mar 15 '15 at 18:16

As Constantine wrote you can run an Org Babel snippet to fetch the image from the remote server with wget and display link the local copy of the image. This leaves you with the problem that the snippet would only be run once unless you force re-evaluation.

An out-of-emacs solution is to set up a cron job or similar to repeatedly fetch the image from the remote and overwrite a well-known file which would be linked in your org file. That too seems ugly to me, though.

A cleaner solution would be to write a function that fetches the image and then redisplays inline images in one go. You could then simply run the function to update the status image on demand.

Something along these lines:

(defun update-my-pic (url filename)
  (shell-command (concat "wget -O " filename " " url))

(update-my-pic "https://www.gravatar.com/avatar/d593a36fb27c41445fade43a1fdd632c" "~/tmp/pic.png")
(update-my-pic "https://www.gravatar.com/avatar/917480313534cf1fd09009e861a2c52d" "~/tmp/pic.png")

This would update a picture link to a file "~/tmp/pic.png".

  • Can you please provide the full solution? As of now, this is more like a comment. – Kaushal Modi Feb 27 '15 at 16:14
  • @kaushalmodi See updated answer. – rekado Feb 28 '15 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.