If I place
(insert-image (create-image \"/tmp/test.png\"))
in a buffer, place the cursor after the last parenthesis and evaluate it with
If you don't want the text (actually lisp code) in the buffer, don't type it into the buffer in the first place. Try M-x eval-expression
and enter your lisp code after the Eval prompt:
(insert-image (create-image "/tmp/test.png"))
Then the image is inserted at point in the buffer. You can define a function like this:
(defun my-insert-image () (interactive) (insert-image (create-image "/tmp/test.png")))
Either type M-x eval-expression
and the above defun or type it into a buffer and C-x C-e
after it. Then you can insert the image using M-x my-insert-image
.