X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/341dd15a7bd9d0b4adff846e94289b3e1877eed1..a3dae87a1b5405d2bffde7c2d829a5dbfc7ff274:/lisp/epa-mail.el diff --git a/lisp/epa-mail.el b/lisp/epa-mail.el index b18fca06e8..a3f11f7867 100644 --- a/lisp/epa-mail.el +++ b/lisp/epa-mail.el @@ -1,15 +1,16 @@ -;;; epa-mail.el --- the EasyPG Assistant, minor-mode for mail composer -;; Copyright (C) 2006, 2007, 2008 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 ;; Keywords: PGP, GnuPG, mail, message +;; Package: epa ;; This file is part of GNU Emacs. -;; GNU Emacs is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,9 +18,7 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Code: @@ -34,6 +33,12 @@ (define-key keymap "\C-c\C-ee" 'epa-mail-encrypt) (define-key keymap "\C-c\C-ei" 'epa-mail-import-keys) (define-key keymap "\C-c\C-eo" 'epa-insert-keys) + (define-key keymap "\C-c\C-e\C-d" 'epa-mail-decrypt) + (define-key keymap "\C-c\C-e\C-v" 'epa-mail-verify) + (define-key keymap "\C-c\C-e\C-s" 'epa-mail-sign) + (define-key keymap "\C-c\C-e\C-e" 'epa-mail-encrypt) + (define-key keymap "\C-c\C-e\C-i" 'epa-mail-import-keys) + (define-key keymap "\C-c\C-e\C-o" 'epa-insert-keys) keymap)) (defvar epa-mail-mode-hook nil) @@ -112,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 sign) (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)) @@ -149,7 +160,9 @@ If no one is selected, symmetric encryption will be performed. " (epa-mail--find-usable-key (epg-list-keys (epg-make-context epa-protocol) - (concat "<" recipient ">")) + (if (string-match "@" recipient) + (concat "<" recipient ">") + recipient)) 'encrypt)) (unless (or recipient-key (y-or-n-p @@ -184,5 +197,4 @@ Don't use this command in Lisp programs!" (provide 'epa-mail) -;; arch-tag: a6f82b3f-d177-4a11-af95-040da55927d2 ;;; epa-mail.el ends here