Hi Klaus,
I found the function very useful so I expanded it a little to have more flexible image file names. First, I use the base name of the file in the current buffer as a prefix to the image file name. Then I added an integer buffer-local variable to be the image file name's suffix (preceded by an underscore) which is incremented every time new image is pasted:
#+begin_src emacs-lisp
(defvar org-clipboard-image-suffix 0)
(make-variable-buffer-local 'org-clipboard-image-suffix)
(setq-default org-clipboard-image-suffix 0)
(defun org-insert-clipboard-image ()
(interactive)
(incf org-clipboard-image-suffix)
(let* ((image-file
(concat (file-name-base (buffer-file-name))
"_"
(format "%d" org-clipboard-image-suffix)
".png"))
(exit-status
(call-process "convert" nil nil nil
"clipboard:" image-file)))
(org-insert-link nil (concat "file:" image-file) "")))
#+end_src
It would be very convenient if there were a way to determine if the clipboard contains an image, then use defadvice to call this function with, say, org-yank. Unfortunately I couldn't find any emacs functions to query properties of the content of the (Windows) clipboard. I only see w32-get-clipboard-data which returns only text.
Regards,
Alex