From 6ee7927589ecc3e7fa058e1d2d9e3ae299ea068b Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 26 Oct 2010 10:31:27 +0900 Subject: [PATCH] Make epa-mail-encrypt expand mail aliases. --- lisp/ChangeLog | 2 +- lisp/epa-mail.el | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 723bb8d5c1b..4e9b62ed200 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,7 @@ 2010-10-26 Daiki Ueno * epa-mail.el (epa-mail-encrypt): Handle local-part only - recipients (Bug#7280). + recipients; expand mail aliases (Bug#7280). 2010-10-25 Glenn Morris 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)) -- 2.39.5