email-eww

Emacs library to send region or eww buffer by email
git clone https://logand.com/git/email-eww.git/
Log | Files | Refs

commit fa340cea6e32f5b44ab0e869a2fb3fef9421a4dc
parent ca69dcb36933c47f8d5d8bf3fb674a79be922669
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun, 31 Dec 2023 21:11:19 +0100

factor out email-string

Diffstat:
Memail-eww.el | 33++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/email-eww.el b/email-eww.el @@ -23,20 +23,31 @@ :group 'email-eww :type 'string) +(defun email-string (string &optional url title in-reply-to) + (compose-mail email-eww-to + (or title + (with-temp-buffer + (insert string) + (goto-char (point-min)) + (end-of-line) + (buffer-substring (point-min) (point)))) + `(("From" . ,email-eww-from) + ("In-Reply-To" . ,in-reply-to))) + (message-goto-body) + (when url + (insert url) + (insert "\n\n")) + (insert string) + (message-goto-to)) + (defun email-region (start end) "Send region as the body of an email." (interactive "r") - (let ((content (buffer-substring start end)) - (title (or (plist-get eww-data :title) - (buffer-name (current-buffer)))) - (url (plist-get eww-data :url))) - (compose-mail email-eww-to title `(("From" . ,email-eww-from))) - (message-goto-body) - (when url - (insert url) - (insert "\n\n")) - (insert content) - (message-goto-to))) + (let ((string (buffer-substring start end))) + (email-string string + (or (plist-get eww-data :url) + (buffer-name (current-buffer))) + (plist-get eww-data :title)))) (defun clean-up-ycombinator () (forward-line)