From 5ad3e885880fd6f110160f68b55c3d88779bb626 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Wed, 10 Nov 2010 00:02:44 +0000 Subject: [PATCH] net/browse-url.el (browse-url-mail): Insert body part of mailto url in mail buffer; make yank-action always a command that yanks original buffer. --- lisp/ChangeLog | 6 ++++++ lisp/net/browse-url.el | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fa3bdfc3780..a6107edc716 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-11-10 Katsumi Yamaoka + + * net/browse-url.el (browse-url-mail): Insert body part of mailto url + in mail buffer; make yank-action always a command that yanks original + buffer. + 2010-11-09 Glenn Morris * progmodes/tcl.el (tcl-hairy-scan-for-comment): Doc fix. diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 45dde6dba3c..c89d27fbf0c 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -1479,20 +1479,27 @@ used instead of `browse-url-new-window-flag'." (to (assoc "To" alist)) (subject (assoc "Subject" alist)) (body (assoc "Body" alist)) - (rest (delete to (delete subject (delete body alist)))) + (rest (delq to (delq subject (delq body alist)))) (to (cdr to)) (subject (cdr subject)) (body (cdr body)) (mail-citation-hook (unless body mail-citation-hook))) (if (browse-url-maybe-new-window new-window) (compose-mail-other-window to subject rest nil - (if body - (list 'insert body) - (list 'insert-buffer (current-buffer)))) + (list 'insert-buffer (current-buffer))) (compose-mail to subject rest nil nil - (if body - (list 'insert body) - (list 'insert-buffer (current-buffer)))))))) + (list 'insert-buffer (current-buffer)))) + (when body + (goto-char (point-min)) + (unless (or (search-forward (concat "\n" mail-header-separator "\n") + nil 'move) + (bolp)) + (insert "\n")) + (goto-char (prog1 + (point) + (insert (replace-regexp-in-string "\r\n" "\n" body)) + (unless (bolp) + (insert "\n")))))))) ;; --- Random browser --- -- 2.39.5