diff options
| author | Eli Zaretskii | 2004-03-07 19:59:15 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2004-03-07 19:59:15 +0000 |
| commit | 1abcd0881985c2228459e51911a752870b106adc (patch) | |
| tree | 473a806905e2ab8c91a4280f2c54e4821ea6fd1b | |
| parent | 81639ac3279b8dc3ec8f4a07be48a554e948c2ab (diff) | |
| download | emacs-1abcd0881985c2228459e51911a752870b106adc.tar.gz emacs-1abcd0881985c2228459e51911a752870b106adc.zip | |
(rfc2368-parse-mailto-url): Autoload.
(browse-url-mail): Use it.
| -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." | |||
| 1301 | 1301 | ||
| 1302 | ;; --- mailto --- | 1302 | ;; --- mailto --- |
| 1303 | 1303 | ||
| 1304 | (autoload 'rfc2368-parse-mailto-url "rfc2368") | ||
| 1305 | |||
| 1304 | ;;;###autoload | 1306 | ;;;###autoload |
| 1305 | (defun browse-url-mail (url &optional new-window) | 1307 | (defun browse-url-mail (url &optional new-window) |
| 1306 | "Open a new mail message buffer within Emacs. | 1308 | "Open a new mail message buffer within Emacs for the RFC 2368 URL. |
| 1307 | Default to using the mailto: URL around or before point as the | 1309 | Default to using the mailto: URL around or before point as the |
| 1308 | recipient's address. Supplying a non-nil interactive prefix argument | 1310 | recipient's address. Supplying a non-nil interactive prefix argument |
| 1309 | will cause the mail to be composed in another window rather than the | 1311 | 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 | |||
| 1318 | used instead of `browse-url-new-window-flag'." | 1320 | used instead of `browse-url-new-window-flag'." |
| 1319 | (interactive (browse-url-interactive-arg "Mailto URL: ")) | 1321 | (interactive (browse-url-interactive-arg "Mailto URL: ")) |
| 1320 | (save-excursion | 1322 | (save-excursion |
| 1321 | (let ((to (if (string-match "^mailto:" url) | 1323 | (let* ((alist (rfc2368-parse-mailto-url url)) |
| 1322 | (substring url 7) | 1324 | (to (assoc "To" alist)) |
| 1323 | url))) | 1325 | (subject (assoc "Subject" alist)) |
| 1326 | (body (assoc "Body" alist)) | ||
| 1327 | (rest (delete to (delete subject (delete body alist)))) | ||
| 1328 | (to (cdr to)) | ||
| 1329 | (subject (cdr subject)) | ||
| 1330 | (body (cdr body)) | ||
| 1331 | (mail-citation-hook (unless body mail-citation-hook))) | ||
| 1324 | (if (browse-url-maybe-new-window new-window) | 1332 | (if (browse-url-maybe-new-window new-window) |
| 1325 | (compose-mail-other-window to nil nil nil | 1333 | (compose-mail-other-window to subject rest nil |
| 1326 | (list 'insert-buffer (current-buffer))) | 1334 | (if body |
| 1327 | (compose-mail to nil nil nil nil | 1335 | (list 'insert body) |
| 1328 | (list 'insert-buffer (current-buffer))))))) | 1336 | (list 'insert-buffer (current-buffer)))) |
| 1337 | (compose-mail to subject rest nil nil | ||
| 1338 | (if body | ||
| 1339 | (list 'insert body) | ||
| 1340 | (list 'insert-buffer (current-buffer)))))))) | ||
| 1329 | 1341 | ||
| 1330 | ;; --- Random browser --- | 1342 | ;; --- Random browser --- |
| 1331 | 1343 | ||