From 721146e2168d0828d5dfbe33cd6275f84241b38b Mon Sep 17 00:00:00 2001 From: ueno Date: Sun, 31 Dec 2006 08:21:49 +0000 Subject: [PATCH] * epa.el (epa-mail-modes): New user option. (epa--mail-mode-p): New function. (epa-sign): Use it. (epa-encrypt): Use it. --- ChangeLog | 7 +++++++ epa.el | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 88b5e2e..d42ea99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2006-12-31 Daiki Ueno + * epa.el (epa-mail-modes): New user option. + (epa--mail-mode-p): New function. + (epa-sign): Use it. + (epa-encrypt): Use it. + +2006-12-31 Daiki Ueno + * epa.el (epa--derived-mode-p): New alias. (epa-sign): Use it. (epa-encrypt): Use it. diff --git a/epa.el b/epa.el index 3e04508..35b3582 100644 --- a/epa.el +++ b/epa.el @@ -61,6 +61,11 @@ the separate window." :type 'integer :group 'epa) +(defcustom epa-mail-modes '(mail-mode message-mode) + "List of major-modes to compose mails." + :type 'list + :group 'epa) + (defgroup epa-faces nil "Faces for epa-mode." :group 'epa) @@ -918,6 +923,13 @@ Uses the `derived-mode-parent' property of the symbol to trace backwards." (setq parent (get parent 'derived-mode-parent)))) parent))) +(defun epa--mail-mode-p () + (let ((pointer epa-mail-modes)) + (while (and pointer + (epa--derived-mode-p (car pointer))) + (setq pointer (cdr pointer))) + pointer)) + ;;;###autoload (defun epa-sign (start end signers mode) "Sign the current buffer. @@ -926,7 +938,7 @@ Don't use this command in Lisp programs!" (interactive (save-excursion (goto-char (point-min)) - (if (and (epa--derived-mode-p 'mail-mode) + (if (and (epa--mail-mode-p) (search-forward mail-header-separator nil t)) (forward-line)) (setq epa-last-coding-system-specified @@ -997,7 +1009,7 @@ Don't use this command in Lisp programs!" (save-excursion (let (recipients) (goto-char (point-min)) - (when (epa--derived-mode-p 'mail-mode) + (when (epa--mail-mode-p) (save-restriction (narrow-to-region (point) (progn @@ -1011,7 +1023,8 @@ Don't use this command in Lisp programs!" (mail-fetch-field "bcc" nil nil t)) ",")))) (if recipients - (setq recipients (delete "" (split-string recipients "[ \t\n]+")))) + (setq recipients (delete "" + (split-string recipients "[ \t\n]+")))) (goto-char (point-min)) (if (search-forward mail-header-separator nil t) (forward-line))) -- 1.7.10.4