Last active
August 29, 2015 14:16
-
-
Save theanalyst/5e5d263adbacb887c3f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun send-region-as-email (start end) | |
| "A hacky function to send a region as mail | |
| Assumes the region follows the below format | |
| To: <recepient> | |
| Subject: <subject> | |
| <mail body>" | |
| (interactive (if (use-region-p) | |
| (list (region-beginning) (region-end)) | |
| (list nil nil))) | |
| (let* ((selection (buffer-substring-no-properties start end)) | |
| (recepient (s-trim (cadr (s-split ":" (car (s-lines selection)))))) | |
| (subject (s-trim (cadr (s-split-up-to ":" (cadr (s-lines selection)) 1)))) | |
| (body (car (last (s-split-up-to "\n" selection 3))))) | |
| (message-mail recepient subject) | |
| (message-goto-body) | |
| (insert body) | |
| (message-send-and-exit))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍