Something like this maybe? It's not 100% to spec. I find regions that
are entire lines easier to work with so the end point would be the
beginning of the first line not in the region (not after the })
For me - triple clicking and dragging selects entire lines which works
well for this.
------------------------------------------------------------------------
(defun my-wrap-src ()
(interactive)
(let ((beg (region-beginning))
(end (region-end))
(src (read-from-minibuffer "Source type: " "java")))
(save-excursion
(goto-char (region-end))
(insert "#+END_SRC\n")
(goto-char (region-beginning))
(insert "#+BEGIN_SRC " src "\n"))))
------------------------------------------------------------------------