10 Jun 2016
Manipulate regions
A useful code snippet to manipulate regions.
(defun my/org-convert-region-quote ()
"Converts selection in a QUOTE block"
(interactive)
(progn (insert "#+END_QUOTE\n")
(exchange-point-and-mark)
(insert "#+BEGIN_QUOTE\n")))
Knowing about point and mark is useful to understand the code. One defect of this code is that it doesn't work if you select a region starting from the end.
Tags: