emacsinsert-image

insert image into text buffer


If I place

(insert-image (create-image "/tmp/test.png"))

in a buffer, place the cursor after the last parenthesis and evaluate it with C-x C-e, then the image /tmp/test.png is displayed in the buffer:

enter image description here

Pretty neat. But,

  1. I had to put the final parenthesis on a separate line, so the image is close to the left-hand side of the buffer. Is there a way to hide the (insert-image ...) text altogether?
  2. The text file contains the (insert-image ...) text only, not the image. I'm happy with that, but is there a way to tell emacs to automatically replace all the (insert-image ...) expressions by their corresponding images (after the file is opened) without me having to type C-x C-e after each one?

Solution

  • Take a look at iimage-mode, the inline image minor mode. It's included since Emacs-23, IIRC.

    M-xiimage-mode