From: ueno Date: Sun, 3 Sep 2006 02:29:13 +0000 (+0000) Subject: * COMPILE (epg-modules): Add epg-config. X-Git-Tag: epg-0_0_5~17 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4310c626411ddec85f1ba4b84309722348a04f3b;p=elisp%2Fepg.git * COMPILE (epg-modules): Add epg-config. * Makefile.am (EXTRA_DIST): Add epg-config.el. * epg-config.el: New file. --- diff --git a/COMPILE b/COMPILE index 6c6fd67..4e068b7 100644 --- a/COMPILE +++ b/COMPILE @@ -1,7 +1,7 @@ ;;; -*- Emacs-Lisp -*- (defvar epg-modules - '(epg epa epa-dired epa-file epa-setup)) + '(epg-config epg epa epa-dired epa-file epa-setup)) (defun epg-compile-modules (modules) (let ((load-path (cons nil load-path)) diff --git a/ChangeLog b/ChangeLog index 2007fe4..74b5f47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-09-03 Daiki Ueno + + * COMPILE (epg-modules): Add epg-config. + * Makefile.am (EXTRA_DIST): Add epg-config.el. + * epg-config.el: New file. + 2006-09-02 Daiki Ueno * epg.el (epg-check-configuration): New function. diff --git a/Makefile.am b/Makefile.am index 73fcec7..4c60b68 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,7 @@ AUTOMAKE_OPTIONS = no-dependencies -EXTRA_DIST = COMPILE epg.el epa.el epa-dired.el epa-file.el epa-setup.el +EXTRA_DIST = COMPILE epg-config.el epg.el epa.el epa-dired.el \ +epa-file.el epa-setup.el CLEANFILES = auto-autoloads.el* custom-load.el *.elc FLAGS ?= -batch -q -no-site-file diff --git a/epg-config.el b/epg-config.el new file mode 100644 index 0000000..0da6ea1 --- /dev/null +++ b/epg-config.el @@ -0,0 +1,90 @@ +;;; epg-config.el --- configuration of the EasyPG Library +;; Copyright (C) 2006 Daiki Ueno + +;; Author: Daiki Ueno +;; 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 diff --git a/epg.el b/epg.el index cd66283..3615cb1 100644 --- a/epg.el +++ b/epg.el @@ -25,26 +25,7 @@ ;;; 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.") @@ -1312,47 +1293,6 @@ This function is for internal use only." 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"