diff options
author | Eli Zaretskii <eliz@gnu.org> | 2004-03-07 19:59:15 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2004-03-07 19:59:15 +0000 |
commit | 1abcd0881985c2228459e51911a752870b106adc (patch) | |
tree | 473a806905e2ab8c91a4280f2c54e4821ea6fd1b /lisp/net | |
parent | 81639ac3279b8dc3ec8f4a07be48a554e948c2ab (diff) | |
download | emacs-1abcd0881985c2228459e51911a752870b106adc.tar.gz |
(rfc2368-parse-mailto-url): Autoload.
(browse-url-mail): Use it.
Diffstat (limited to 'lisp/net')
-rw-r--r-- | lisp/net/browse-url.el | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index d590e8bb2a4..fa0d7ea7914 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -1301,9 +1301,11 @@ Default to the URL around or before point." ;; --- mailto --- +(autoload 'rfc2368-parse-mailto-url "rfc2368") + ;;;###autoload (defun browse-url-mail (url &optional new-window) - "Open a new mail message buffer within Emacs. + "Open a new mail message buffer within Emacs for the RFC 2368 URL. Default to using the mailto: URL around or before point as the recipient's address. Supplying a non-nil interactive prefix argument will cause the mail to be composed in another window rather than the @@ -1318,14 +1320,24 @@ When called non-interactively, optional second argument NEW-WINDOW is used instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "Mailto URL: ")) (save-excursion - (let ((to (if (string-match "^mailto:" url) - (substring url 7) - url))) + (let* ((alist (rfc2368-parse-mailto-url url)) + (to (assoc "To" alist)) + (subject (assoc "Subject" alist)) + (body (assoc "Body" alist)) + (rest (delete to (delete subject (delete 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 nil nil nil - (list 'insert-buffer (current-buffer))) - (compose-mail to nil nil nil nil - (list 'insert-buffer (current-buffer))))))) + (compose-mail-other-window to subject rest nil + (if body + (list 'insert body) + (list 'insert-buffer (current-buffer)))) + (compose-mail to subject rest nil nil + (if body + (list 'insert body) + (list 'insert-buffer (current-buffer)))))))) ;; --- Random browser --- |