1 ;;; wl-mailto.el -- some mailto support for wanderlust
3 ;;; Copyright (C) 1999 Sen Nagata
5 ;; Author: Sen Nagata <sen@eccosys.com>
8 ;; Warning: not optimized at all
10 ;; This file is not a part of GNU Emacs.
14 ;; required elisp packages:
19 ;; -thingatpt.el or browse-url.el
23 ;; -put this file (and rfc2368.el) in an appropriate directory (so Emacs
29 ;; (add-hook 'wl-init-hook (lambda () (require 'wl-mailto)))
35 ;; this package provides a number of interactive functions
36 ;; (commands) for the user. each of the commands ultimately creates a
37 ;; draft message based on some information. the names of the commands
38 ;; and brief descriptions are:
40 ;; 1) wl-mailto-compose-message-from-mailto-url
41 ;; make a draft message from a user-specified mailto: url
43 ;; 2) wl-mailto-compose-message-from-mailto-url-at-point
44 ;; make a draft message from a mailto: url at point
49 ;; -try out the commands mentioned above in 'details'
55 ;; wl-user-agent functionality merged into wl-draft.el, so removed
60 ;; incorporated a patch from Kenichi OKADA for
61 ;; wl-mailto-compose-message-from-mailto-url-at-point
72 ;; xemacs compatibility
76 ;; rewrote to use rfc2368.el and wl-user-agent.el
79 (defconst wl-mailto-version
"wl-mailto.el 0.5")
81 ;; how should we handle the dependecy on wl?
85 (defun wl-mailto-url-at-point ()))
88 ;; use rfc2368 support -- should be usable for things other than wl too
91 ;; yucky compatibility stuff -- someone help me w/ this, please...
92 (if (and (string-match "^XEmacs \\([0-9.]+\\)" (emacs-version))
93 (< (string-to-number (match-string 1 (emacs-version))) 21))
94 ;; for xemacs versions less than 21, use browse-url.el
97 (fset 'wl-mailto-url-at-point
98 'browse-url-url-at-point
))
99 ;; for everything else, use thingatpt.el
102 (fset 'wl-mailto-url-at-point
104 (thing-at-point 'url
)))))
106 (defun wl-mailto-compose-message-from-mailto-url (url &optional dummy
)
107 "Compose a message from URL (RFC 2368).
108 The optional second argument, DUMMY, exists to match the interface
109 provided by `browse-url-mail' (w3) -- DUMMY does not do anything."
110 (interactive "sURL: ")
111 (if (string-match rfc2368-mailto-regexp url
)
112 (let* ((other-headers (rfc2368-parse-mailto-url url
))
113 (to (cdr (assoc-ignore-case "to" other-headers
)))
114 (subject (cdr (assoc-ignore-case "subject" other-headers
))))
116 (wl-user-agent-compose to subject other-headers
))
117 (message "Not a mailto: url.")))
119 ;; prepare a message from a mailto: url at point
120 (defun wl-mailto-compose-message-from-mailto-url-at-point ()
121 "Draft a new message based on URL (RFC 2368) at point."
123 (let ((url (wl-mailto-url-at-point)))
124 (if (and url
(string-match rfc2368-mailto-regexp url
))
125 (wl-mailto-compose-message-from-mailto-url url
)
126 ;; tell the user that we didn't find a mailto: url at point
127 (message "No mailto: url detected at point."))))
129 ;; since this will be used via 'require'...
132 ;;; wl-mailto.el ends here