(require 'font-lock)
(require 'widget)
(eval-when-compile (require 'wid-edit))
-(require 'mail-utils)
(require 'derived)
(defgroup epa nil
: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)
(error "No armor tail"))
(epa-verify-region armor-start armor-end))))))
+(if (fboundp 'select-safe-coding-system)
+ (defalias 'epa--select-safe-coding-system 'select-safe-coding-system)
+ (defun epa--select-safe-coding-system (from to)
+ buffer-file-coding-system))
+
;;;###autoload
(defun epa-sign-region (start end signers mode)
"Sign the current region between START and END by SIGNERS keys selected.
(message "Signing keys...done")))
(make-obsolete 'epa-sign-keys "Do not use.")
-;;;###autoload
-(defun epa-decrypt-mail ()
- "Decrypt OpenPGP armors in the current buffer.
-The buffer is expected to contain a mail message.
-
-Don't use this command in Lisp programs!"
- (interactive)
- (epa-decrypt-armor-in-region (point-min) (point-max)))
-
-(if (fboundp 'select-safe-coding-system)
- (defalias 'epa--select-safe-coding-system 'select-safe-coding-system)
- (defun epa--select-safe-coding-system (from to)
- buffer-file-coding-system))
-
-;;;###autoload
-(defun epa-verify-mail ()
- "Verify OpenPGP cleartext signed messages in the current buffer.
-The buffer is expected to contain a mail message.
-
-Don't use this command in Lisp programs!"
- (interactive)
- (epa-verify-cleartext-in-region (point-min) (point-max)))
-
-(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-mail (start end signers mode)
- "Sign the current buffer.
-The buffer is expected to contain a mail message.
-
-Don't use this command in Lisp programs!"
- (interactive
- (save-excursion
- (goto-char (point-min))
- (if (and (epa--mail-mode-p)
- (search-forward mail-header-separator nil t))
- (forward-line))
- (setq epa-last-coding-system-specified
- (or coding-system-for-write
- (epa--select-safe-coding-system (point) (point-max))))
- (let ((verbose current-prefix-arg))
- (list (point) (point-max)
- (if verbose
- (epa-select-keys (epg-make-context epa-protocol)
- "Select keys for signing.
-If no one is selected, default secret key is used. "
- nil t))
- (if verbose
- (epa--read-signature-type)
- 'clear)))))
- (epa-sign-region start end signers mode))
-
-;;;###autoload
-(defun epa-encrypt-mail (start end recipients sign signers)
- "Encrypt the current buffer.
-The buffer is expected to contain a mail message.
-
-Don't use this command in Lisp programs!"
- (interactive
- (save-excursion
- (let ((verbose current-prefix-arg)
- (context (epg-make-context epa-protocol))
- recipients recipient-keys)
- (goto-char (point-min))
- (when (epa--mail-mode-p)
- (save-restriction
- (narrow-to-region (point)
- (if (search-forward mail-header-separator nil 0)
- (match-beginning 0)
- (point)))
- (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))
- ","))))
- (if recipients
- (setq recipients (delete ""
- (split-string recipients "[ \t\n]+"))))
- (goto-char (point-min))
- (if (search-forward mail-header-separator nil t)
- (forward-line)))
- (setq epa-last-coding-system-specified
- (or coding-system-for-write
- (epa--select-safe-coding-system (point) (point-max))))
- (list (point) (point-max)
- (if verbose
- (epa-select-keys
- context
- "Select recipients for encryption.
-If no one is selected, symmetric encryption will be performed. "
- recipients)
- (if recipients
- (apply #'nconc
- (mapcar
- (lambda (recipient)
- (setq recipient-keys
- (epg-list-keys
- (epg-make-context epa-protocol)
- (concat "<" recipient ">")))
- (unless (or recipient-keys
- (y-or-n-p
- (format
- "No public key for %s; skip it? "
- recipient)))
- (error "No public key for %s" recipient))
- recipient-keys)
- recipients))))
- (setq sign (if verbose (y-or-n-p "Sign? ")))
- (if sign
- (epa-select-keys context
- "Select keys for signing. "))))))
- (epa-encrypt-region start end recipients sign signers))
-
-;;;###autoload
-(defun epa-import-mail ()
- "Import keys in the OpenPGP armor format in the current buffer.
-The buffer is expected to contain a mail message.
-
-Don't use this command in Lisp programs!"
- (interactive)
- (epa-import-armor-in-region (point-min) (point-max)))
-
(provide 'epa)
;;; epa.el ends here