Remove unused variable temp-buffer-show-specifiers.
[bpt/emacs.git] / lisp / epa-mail.el
index ab47cbf..9d7542b 100644 (file)
@@ -1,5 +1,5 @@
-;;; epa-mail.el --- the EasyPG Assistant, minor-mode for mail composer
-;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;; epa-mail.el --- the EasyPG Assistant, minor-mode for mail composer -*- lexical-binding: t -*-
+;; Copyright (C) 2006-2011 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG, mail, message
@@ -51,7 +51,8 @@
   nil " epa-mail" epa-mail-mode-map)
 
 (defun epa-mail--find-usable-key (keys usage)
-  "Find a usable key from KEYS for USAGE."
+  "Find a usable key from KEYS for USAGE.
+USAGE would be `sign' or `encrypt'."
   (catch 'found
     (while keys
       (let ((pointer (epg-key-sub-key-list (car keys))))
@@ -116,8 +117,9 @@ Don't use this command in Lisp programs!"
   (interactive
    (save-excursion
      (let ((verbose current-prefix-arg)
+          (config (epg-configuration))
           (context (epg-make-context epa-protocol))
-          recipients-string recipients recipient-key)
+          recipients-string recipients recipient-key sign)
        (goto-char (point-min))
        (save-restriction
         (narrow-to-region (point)
@@ -140,6 +142,17 @@ Don't use this command in Lisp programs!"
           (setq recipients (delete ""
                                    (split-string recipients
                                                  "[ \t\n]*,[ \t\n]*"))))
+
+       ;; Process all the recipients thru the list of GnuPG groups.
+       ;; Expand GnuPG group names to what they stand for.
+       (setq recipients
+            (apply #'nconc
+                   (mapcar
+                    (lambda (recipient)
+                      (or (epg-expand-group config recipient)
+                          (list recipient)))
+                    recipients)))
+
        (goto-char (point-min))
        (if (search-forward mail-header-separator nil t)
           (forward-line))
@@ -197,5 +210,4 @@ Don't use this command in Lisp programs!"
 
 (provide 'epa-mail)
 
-;; arch-tag: a6f82b3f-d177-4a11-af95-040da55927d2
 ;;; epa-mail.el ends here