mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-30 19:53:09 +00:00
(rfc2368-parse-mailto-url): Autoload.
(browse-url-mail): Use it.
This commit is contained in:
parent
81639ac327
commit
1abcd08819
@ -1301,9 +1301,11 @@ Default to the URL around or before point."
|
|||||||
|
|
||||||
;; --- mailto ---
|
;; --- mailto ---
|
||||||
|
|
||||||
|
(autoload 'rfc2368-parse-mailto-url "rfc2368")
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun browse-url-mail (url &optional new-window)
|
(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
|
Default to using the mailto: URL around or before point as the
|
||||||
recipient's address. Supplying a non-nil interactive prefix argument
|
recipient's address. Supplying a non-nil interactive prefix argument
|
||||||
will cause the mail to be composed in another window rather than the
|
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'."
|
used instead of `browse-url-new-window-flag'."
|
||||||
(interactive (browse-url-interactive-arg "Mailto URL: "))
|
(interactive (browse-url-interactive-arg "Mailto URL: "))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((to (if (string-match "^mailto:" url)
|
(let* ((alist (rfc2368-parse-mailto-url url))
|
||||||
(substring url 7)
|
(to (assoc "To" alist))
|
||||||
url)))
|
(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)
|
(if (browse-url-maybe-new-window new-window)
|
||||||
(compose-mail-other-window to nil nil nil
|
(compose-mail-other-window to subject rest nil
|
||||||
(list 'insert-buffer (current-buffer)))
|
(if body
|
||||||
(compose-mail to nil nil nil nil
|
(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))))))))
|
||||||
|
|
||||||
;; --- Random browser ---
|
;; --- Random browser ---
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user