From: yoichi Date: Mon, 27 Jan 2003 05:20:06 +0000 (+0000) Subject: * wl-draft.el (wl-draft-insert-from-field): Use wl-from. X-Git-Tag: merged-trunk-to-elmo-mark-14~10 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=0221672d47aed2718e31eb84cd39b93f346743a0;p=elisp%2Fwanderlust.git * wl-draft.el (wl-draft-insert-from-field): Use wl-from. (wl-draft-check-wl-from): New function. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index 8e06ac7..5f16423 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,8 @@ +2003-01-27 Yoichi NAKAYAMA + + * wl-draft.el (wl-draft-insert-from-field): Use wl-from. + (wl-draft-check-wl-from): New function. + 2003-01-21 Kenichi OKADA * wl-vars.el (wl-message-id-use-wl-from): Change defalut to t. diff --git a/wl/wl-draft.el b/wl/wl-draft.el index c62b622..f8b2c92 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -150,52 +150,18 @@ e.g. "Insert Date field." (insert "Date: " (wl-make-date-string) "\n")) +(defun wl-draft-check-wl-from () + (or wl-from (error "Please set `wl-from' to your mail address")) + (condition-case err + (wl-draft-eword-encode-address-list wl-from) + (error (error "Please look at `wl-from' again")))) + (defun wl-draft-insert-from-field () "Insert From field." ;; Put the "From:" field in unless for some odd reason ;; they put one in themselves. - (let* ((login (or user-mail-address (user-login-name))) - (fullname (user-full-name))) - (cond ((eq mail-from-style 'angles) - (insert "From: " fullname) - (let ((fullname-start (+ (point-min) (length "From: "))) - (fullname-end (point-marker))) - (goto-char fullname-start) - ;; Look for a character that cannot appear unquoted - ;; according to RFC 822. - (if (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" - fullname-end 1) - (progn - ;; Quote fullname, escaping specials. - (goto-char fullname-start) - (insert "\"") - (while (re-search-forward "[\"\\]" - fullname-end 1) - (replace-match "\\\\\\&" t)) - (insert "\"")))) - (insert " <" login ">\n")) - ((eq mail-from-style 'parens) - (insert "From: " login " (") - (let ((fullname-start (point))) - (insert fullname) - (let ((fullname-end (point-marker))) - (goto-char fullname-start) - ;; RFC 822 says \ and nonmatching parentheses - ;; must be escaped in comments. - ;; Escape every instance of ()\ ... - (while (re-search-forward "[()\\]" fullname-end 1) - (replace-match "\\\\\\&" t)) - ;; ... then undo escaping of matching parentheses, - ;; including matching nested parentheses. - (goto-char fullname-start) - (while (re-search-forward - "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)" - fullname-end 1) - (replace-match "\\1(\\3)" t) - (goto-char fullname-start)))) - (insert ")\n")) - ((not mail-from-style) - (insert "From: " login "\n"))))) + (wl-draft-check-wl-from) + (insert "From: " wl-from "\n")) (defun wl-draft-insert-x-face-field () "Insert X-Face header."