2006-12-31 Daiki Ueno <ueno@unixuser.org>
+ * epa.el (epa--derived-mode-p): New alias.
+ (epa-sign): Use it.
+ (epa-encrypt): Use it.
+
+2006-12-31 Daiki Ueno <ueno@unixuser.org>
+
* epa.el (epa--read-signature-type): New function.
(epa-decrypt): New command.
(epa-verify): New command.
'start-open t
'end-open t)))))
+(if (fboundp 'derived-mode-p)
+ (defalias 'epa--derived-mode-p 'derived-mode-p)
+ (defun epa--derived-mode-p (&rest modes)
+ "Non-nil if the current major mode is derived from one of MODES.
+Uses the `derived-mode-parent' property of the symbol to trace backwards."
+ (let ((parent major-mode))
+ (while (and (not (memq parent modes))
+ (setq parent (get parent 'derived-mode-parent))))
+ parent)))
+
;;;###autoload
(defun epa-sign (start end signers mode)
"Sign the current buffer.
(interactive
(save-excursion
(goto-char (point-min))
- (if (and (or (eq major-mode 'mail-mode)
- (eq (derived-mode-class major-mode) 'mail-mode))
+ (if (and (epa--derived-mode-p 'mail-mode)
(search-forward mail-header-separator nil t))
(forward-line))
(setq epa-last-coding-system-specified
(save-excursion
(let (recipients)
(goto-char (point-min))
- (when (or (eq major-mode 'mail-mode)
- (eq (derived-mode-class major-mode) 'mail-mode))
+ (when (epa--derived-mode-p 'mail-mode)
(save-restriction
(narrow-to-region (point)
(progn