comparison lisp/net/browse-url.el @ 54305:c53b285fdf88

(rfc2368-parse-mailto-url): Autoload. (browse-url-mail): Use it.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 07 Mar 2004 19:59:15 +0000
parents c29ef88b691f
children 8e0abac00108
comparison
equal deleted inserted replaced
54304:d61b01de8cdf 54305:c53b285fdf88
1299 (call-process "mmm" nil 0 nil "-external" url)) 1299 (call-process "mmm" nil 0 nil "-external" url))
1300 (message "Sending URL to MMM... done"))) 1300 (message "Sending URL to MMM... done")))
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
1310 current one. 1312 current one.
1311 1313
1316 1318
1317 When called non-interactively, optional second argument NEW-WINDOW is 1319 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
1332 ;;;###autoload 1344 ;;;###autoload
1333 (defun browse-url-generic (url &optional new-window) 1345 (defun browse-url-generic (url &optional new-window)