summaryrefslogtreecommitdiff
path: root/lisp/epa-mail.el
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@unixuser.org>2010-10-26 10:31:27 +0900
committerDaiki Ueno <ueno@unixuser.org>2010-10-26 10:31:27 +0900
commit6ee7927589ecc3e7fa058e1d2d9e3ae299ea068b (patch)
tree7d29c27e8343878661fa319e105d4584aeebfbe8 /lisp/epa-mail.el
parent77ec02d8fdf1da79e1774dc6e20dedabd065bbe9 (diff)
downloademacs-6ee7927589ecc3e7fa058e1d2d9e3ae299ea068b.tar.gz
Make epa-mail-encrypt expand mail aliases.
Diffstat (limited to 'lisp/epa-mail.el')
-rw-r--r--lisp/epa-mail.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/lisp/epa-mail.el b/lisp/epa-mail.el
index 2b29e80daa5..ab47cbf60bc 100644
--- a/lisp/epa-mail.el
+++ b/lisp/epa-mail.el
@@ -117,23 +117,29 @@ Don't use this command in Lisp programs!"
(save-excursion
(let ((verbose current-prefix-arg)
(context (epg-make-context epa-protocol))
- recipients recipient-key)
+ recipients-string recipients recipient-key)
(goto-char (point-min))
(save-restriction
(narrow-to-region (point)
(if (search-forward mail-header-separator nil 0)
(match-beginning 0)
(point)))
+ (setq recipients-string
+ (mapconcat #'identity
+ (nconc (mail-fetch-field "to" nil nil t)
+ (mail-fetch-field "cc" nil nil t)
+ (mail-fetch-field "bcc" nil nil t))
+ ","))
(setq recipients
(mail-strip-quoted-names
- (mapconcat #'identity
- (nconc (mail-fetch-field "to" nil nil t)
- (mail-fetch-field "cc" nil nil t)
- (mail-fetch-field "bcc" nil nil t))
- ","))))
+ (with-temp-buffer
+ (insert "to: " recipients-string "\n")
+ (expand-mail-aliases (point-min) (point-max))
+ (car (mail-fetch-field "to" nil nil t))))))
(if recipients
(setq recipients (delete ""
- (split-string recipients "[ \t\n]+"))))
+ (split-string recipients
+ "[ \t\n]*,[ \t\n]*"))))
(goto-char (point-min))
(if (search-forward mail-header-separator nil t)
(forward-line))