comparison lisp/epa-mail.el @ 111182:d6dad5b04eb8

Make epa-mail-encrypt expand mail aliases.
author Daiki Ueno <ueno@unixuser.org>
date Tue, 26 Oct 2010 10:31:27 +0900
parents 6585f38b9f1d
children 417b1e4d63cd
comparison
equal deleted inserted replaced
111181:6585f38b9f1d 111182:d6dad5b04eb8
115 Don't use this command in Lisp programs!" 115 Don't use this command in Lisp programs!"
116 (interactive 116 (interactive
117 (save-excursion 117 (save-excursion
118 (let ((verbose current-prefix-arg) 118 (let ((verbose current-prefix-arg)
119 (context (epg-make-context epa-protocol)) 119 (context (epg-make-context epa-protocol))
120 recipients recipient-key) 120 recipients-string recipients recipient-key)
121 (goto-char (point-min)) 121 (goto-char (point-min))
122 (save-restriction 122 (save-restriction
123 (narrow-to-region (point) 123 (narrow-to-region (point)
124 (if (search-forward mail-header-separator nil 0) 124 (if (search-forward mail-header-separator nil 0)
125 (match-beginning 0) 125 (match-beginning 0)
126 (point))) 126 (point)))
127 (setq recipients-string
128 (mapconcat #'identity
129 (nconc (mail-fetch-field "to" nil nil t)
130 (mail-fetch-field "cc" nil nil t)
131 (mail-fetch-field "bcc" nil nil t))
132 ","))
127 (setq recipients 133 (setq recipients
128 (mail-strip-quoted-names 134 (mail-strip-quoted-names
129 (mapconcat #'identity 135 (with-temp-buffer
130 (nconc (mail-fetch-field "to" nil nil t) 136 (insert "to: " recipients-string "\n")
131 (mail-fetch-field "cc" nil nil t) 137 (expand-mail-aliases (point-min) (point-max))
132 (mail-fetch-field "bcc" nil nil t)) 138 (car (mail-fetch-field "to" nil nil t))))))
133 ","))))
134 (if recipients 139 (if recipients
135 (setq recipients (delete "" 140 (setq recipients (delete ""
136 (split-string recipients "[ \t\n]+")))) 141 (split-string recipients
142 "[ \t\n]*,[ \t\n]*"))))
137 (goto-char (point-min)) 143 (goto-char (point-min))
138 (if (search-forward mail-header-separator nil t) 144 (if (search-forward mail-header-separator nil t)
139 (forward-line)) 145 (forward-line))
140 (setq epa-last-coding-system-specified 146 (setq epa-last-coding-system-specified
141 (or coding-system-for-write 147 (or coding-system-for-write