From: ueno Date: Sun, 31 Dec 2006 08:21:49 +0000 (+0000) Subject: * epa.el (epa-mail-modes): New user option. X-Git-Tag: epg-0_0_10~48 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=721146e2168d0828d5dfbe33cd6275f84241b38b;p=elisp%2Fepg.git * epa.el (epa-mail-modes): New user option. (epa--mail-mode-p): New function. (epa-sign): Use it. (epa-encrypt): Use it. --- 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)))