Export an Org region to RTF and copy it to the clipboard. Ideal for copying source code blocks to Google Docs and preserve syntax highlighting and indentation.
|(defun dm/copy-as-rtf ()|
|"Export region to RTF and copy it to the clipboard."|
|(let* ((buf (org-export-to-buffer 'html "*Formatted Copy*" nil nil t t))|
|(html (with-current-buffer buf (buffer-string))))|
|"textutil -stdin -format html -convert rtf -stdout | pbcopy"))|