--- /dev/null
+;;; epg-config.el --- configuration of the EasyPG Library
+;; Copyright (C) 2006 Daiki Ueno
+
+;; Author: Daiki Ueno <ueno@unixuser.org>
+;; Keywords: PGP, GnuPG
+
+;; This file is part of EasyPG.
+
+;; This program 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 2, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; 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.
+
+;;; Code:
+
+(defgroup epg ()
+ "The EasyPG Library"
+ :group 'emacs)
+
+(defcustom epg-gpg-program "gpg"
+ "The `gpg' executable."
+ :group 'epg
+ :type 'string)
+
+(defcustom epg-gpgsm-program "gpgsm"
+ "The `gpgsm' executable."
+ :group 'epg
+ :type 'string)
+
+(defcustom epg-gpg-home-directory nil
+ "The directory which contains the `gpg' configuration files."
+ :group 'epg
+ :type '(choice (const :tag "Default" nil) directory))
+
+(defconst epg-version-number "0.0.4")
+
+;;;###autoload
+(defun epg-configuration ()
+ "Return a list of internal configuration parameters of `epg-gpg-program'."
+ (let (config type)
+ (with-temp-buffer
+ (apply #'call-process epg-gpg-program nil (list t nil) nil
+ '("--with-colons" "--list-config"))
+ (goto-char (point-min))
+ (while (re-search-forward "^cfg:\\([^:]+\\):\\(.*\\)" nil t)
+ (setq type (intern (match-string 1))
+ config (cons (cons type
+ (if (memq type
+ '(pubkey cipher digest compress))
+ (mapcar #'string-to-number
+ (delete "" (split-string
+ (match-string 2)
+ ";")))
+ (match-string 2)))
+ config))))
+ config))
+
+;;;###autoload
+(defun epg-check-configuration (config)
+ "Verify that CONFIGURATION is sufficient."
+ (let ((entry (assq 'version config))
+ major minor teeny)
+ (unless (and entry
+ (stringp (cdr entry))
+ (string-match "\\`\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)"
+ (cdr entry)))
+ (error "Undetermined version: %S" entry))
+ (setq major (string-to-number (match-string 1 (cdr entry)))
+ minor (string-to-number (match-string 2 (cdr entry)))
+ teeny (string-to-number (match-string 3 (cdr entry))))
+ (unless (or (> major 1)
+ (and (= major 1)
+ (or (> minor 4)
+ (and (= minor 4)
+ (>= teeny 3)))))
+ (error "Unsupported version: %s" (cdr entry)))))
+
+(provide 'epg-config)
+
+;;; epg-config.el ends here
;;; Code:
-(defgroup epg ()
- "The EasyPG Library"
- :group 'emacs)
-
-(defcustom epg-gpg-program "gpg"
- "The `gpg' executable."
- :group 'epg
- :type 'string)
-
-(defcustom epg-gpgsm-program "gpgsm"
- "The `gpgsm' executable."
- :group 'epg
- :type 'string)
-
-(defcustom epg-gpg-home-directory nil
- "The directory which contains the `gpg' configuration files."
- :group 'epg
- :type '(choice (const :tag "Default" nil) directory))
-
-(defconst epg-version-number "0.0.4")
+(require 'epg-config)
(defvar epg-user-id nil
"GnuPG ID of your default identity.")
handback)
(message "%s: %d%%/%d%%" what current total))
-;;;###autoload
-(defun epg-configuration ()
- "Return a list of internal configuration parameters of `epg-gpg-program'."
- (let (config type)
- (with-temp-buffer
- (apply #'call-process epg-gpg-program nil (list t nil) nil
- '("--with-colons" "--list-config"))
- (goto-char (point-min))
- (while (re-search-forward "^cfg:\\([^:]+\\):\\(.*\\)" nil t)
- (setq type (intern (match-string 1))
- config (cons (cons type
- (if (memq type
- '(pubkey cipher digest compress))
- (mapcar #'string-to-number
- (delete "" (split-string
- (match-string 2)
- ";")))
- (match-string 2)))
- config))))
- config))
-
-;;;###autoload
-(defun epg-check-configuration (config)
- "Verify that CONFIGURATION is sufficient."
- (let ((entry (assq 'version config))
- major minor teeny)
- (unless (and entry
- (stringp (cdr entry))
- (string-match "\\`\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)"
- (cdr entry)))
- (error "Undetermined version: %S" entry))
- (setq major (string-to-number (match-string 1 (cdr entry)))
- minor (string-to-number (match-string 2 (cdr entry)))
- teeny (string-to-number (match-string 3 (cdr entry))))
- (unless (or (> major 1)
- (and (= major 1)
- (or (> minor 4)
- (and (= minor 4)
- (>= teeny 3)))))
- (error "Unsupported version: %s" (cdr entry)))))
-
(defun epg--list-keys-1 (context name mode)
(let ((args (append (list "--with-colons" "--no-greeting" "--batch"
"--with-fingerprint"