From: yamaoka Date: Wed, 14 Apr 1999 12:35:10 +0000 (+0000) Subject: * mime-ui-en.texi, mime-ui-ja.texi: Sync up with .sgml files. X-Git-Tag: semi-pgpgpg_10 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=66610ca5e24d5abe13dee302432442aaa5c08417;p=elisp%2Fsemi.git * mime-ui-en.texi, mime-ui-ja.texi: Sync up with .sgml files. * mime-ui-en.sgml, mime-ui-ja.sgml: Modify a description for simplified `pgp-function-alist'. * semi-def.el (pgp-function-alist): Simplify. Use `mime-mc-encrypt-region', `mime-mc-traditional-sign-region', `mime-mc-sign-region' and `mime-mc-fetch-key' for it. * mime-mc.el (mime-mc-insert-public-key, mime-mc-snarf-keys, mime-mc-decrypt, mime-mc-verify): Add doc strings. (mime-mc-encrypt-region, mime-mc-traditional-sign-region, mime-mc-sign-region, mime-mc-fetch-key): New functions. (TopLevel): Add autoloads "mc-gpg", "mc-pgp5" and "mc-pgp" for the functions `mc-gpg-fetch-key', `mc-gpg-sign-region', `mc-pgp50-fetch-key', `mc-pgp50-sign-region', `mc-pgp-fetch-key' and `mc-pgp-sign-region'. * mime-pgp.el (mime-pgp-fetch-key): Kill useless buffers after fetching. (mime-pgp-show-fetched-key-for-pgp50, mime-pgp-show-fetched-key): Show fetched key in the window of `mime-echo-buffer-name' if it is alive, otherwise use `display-buffer'; minimize the window height; return buffer object to be killed. --- diff --git a/ChangeLog b/ChangeLog index d27de64..05f5281 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,31 @@ 1999-04-14 Katsumi Yamaoka + * mime-ui-en.texi, mime-ui-ja.texi: Sync up with .sgml files. + * mime-ui-en.sgml, mime-ui-ja.sgml: Modify a description for + simplified `pgp-function-alist'. + + * semi-def.el (pgp-function-alist): Simplify. Use + `mime-mc-encrypt-region', `mime-mc-traditional-sign-region', + `mime-mc-sign-region' and `mime-mc-fetch-key' for it. + + * mime-mc.el (mime-mc-insert-public-key, mime-mc-snarf-keys, + mime-mc-decrypt, mime-mc-verify): Add doc strings. + (mime-mc-encrypt-region, mime-mc-traditional-sign-region, + mime-mc-sign-region, mime-mc-fetch-key): New functions. + (TopLevel): Add autoloads "mc-gpg", "mc-pgp5" and "mc-pgp" for the + functions `mc-gpg-fetch-key', `mc-gpg-sign-region', + `mc-pgp50-fetch-key', `mc-pgp50-sign-region', `mc-pgp-fetch-key' + and `mc-pgp-sign-region'. + + * mime-pgp.el (mime-pgp-fetch-key): Kill useless buffers after + fetching. + (mime-pgp-show-fetched-key-for-pgp50, mime-pgp-show-fetched-key): + Show fetched key in the window of `mime-echo-buffer-name' if it is + alive, otherwise use `display-buffer'; minimize the window height; + return buffer object to be killed. + +1999-04-14 Katsumi Yamaoka + * mime-pgp.el (mime-pgp-fetch-key, mime-pgp-show-fetched-key-for-pgp, mime-pgp-show-fetched-key-for-pgp50, diff --git a/mime-mc.el b/mime-mc.el index 7835ae2..abcd717 100644 --- a/mime-mc.el +++ b/mime-mc.el @@ -40,12 +40,22 @@ (function (lambda (elem) (apply 'autoload elem))) '( (mc-gpg-debug-print "mc-gpg") + (mc-gpg-encrypt-region "mc-gpg") + (mc-gpg-fetch-key "mc-gpg") (mc-gpg-lookup-key "mc-gpg") + (mc-gpg-sign-region "mc-gpg") + (mc-pgp50-encrypt-region "mc-pgp5") + (mc-pgp50-fetch-key "mc-pgp5") (mc-pgp50-lookup-key "mc-pgp5") + (mc-pgp50-sign-region "mc-pgp5") + (mc-pgp-encrypt-region "mc-pgp") + (mc-pgp-fetch-key "mc-pgp") (mc-pgp-lookup-key "mc-pgp") + (mc-pgp-sign-region "mc-pgp") + (mc-snarf-keys "mc-toplev") ))) @@ -170,7 +180,58 @@ VERSION should be a string or a symbol." ))) (point-max))))) +(defun mime-mc-verify () + "Verify a message in the current buffer. Exact behavior depends on +current major mode." + (let ((mc-default-scheme (intern (format "mc-scheme-%s" pgp-version)))) + (mc-verify) + )) + +(defun mime-mc-decrypt () + "Decrypt a message in the current buffer. Exact behavior depends on +current major mode." + (let ((mc-default-scheme (intern (format "mc-scheme-%s" pgp-version)))) + (mc-decrypt) + )) + +(defun mime-mc-fetch-key (&optional id) + "Attempt to fetch a key for addition to PGP or GnuPG keyring. +Interactively, prompt for string matching key to fetch. + +Non-interactively, ID must be a pair. The CAR must be a bare Email +address and the CDR a keyID (with \"0x\" prefix). Either, but not +both, may be nil. + +Return t if we think we were successful; nil otherwise. Note that nil +is not necessarily an error, since we may have merely fired off an Email +request for the key." + (funcall (intern (format "mc-%s-fetch-key" pgp-version)) id) + ) + +(defun mime-mc-snarf-keys () + "Add all public keys in the buffer to your keyring." + (let ((mc-default-scheme (intern (format "mc-scheme-%s" pgp-version)))) + (mc-snarf-keys) + )) + +(defun mime-mc-sign-region (start end &optional id unclear boundary) + (funcall (intern (format "mime-mc-%s-sign-region" pgp-version)) + start end id unclear boundary) + ) + +(defun mime-mc-traditional-sign-region (start end &optional id unclear) + (funcall (intern (format "mc-%s-sign-region" pgp-version)) + start end id unclear) + ) + +(defun mime-mc-encrypt-region (recipients start end &optional id sign) + (funcall (intern (format "mime-mc-%s-encrypt-region" pgp-version)) + recipients start end id sign) + ) + (defun mime-mc-insert-public-key (&optional userid) + "Insert your public key at point. With one prefix arg, prompts for +user id to use." (let ((not-loaded (not (fboundp (intern (format "mc-%s-insert-public-key" pgp-version))))) (comment (mime-mc-comment)) @@ -200,21 +261,6 @@ VERSION should be a string or a symbol." (mime-mc-replace-comment-field comment) ))) -(defun mime-mc-verify () - (let ((mc-default-scheme (intern (format "mc-scheme-%s" pgp-version)))) - (mc-verify) - )) - -(defun mime-mc-decrypt () - (let ((mc-default-scheme (intern (format "mc-scheme-%s" pgp-version)))) - (mc-decrypt) - )) - -(defun mime-mc-snarf-keys () - (let ((mc-default-scheme (intern (format "mc-scheme-%s" pgp-version)))) - (mc-snarf-keys) - )) - ;;; @ GnuPG functions ;;; diff --git a/mime-pgp.el b/mime-pgp.el index 115e9e7..1ec9487 100644 --- a/mime-pgp.el +++ b/mime-pgp.el @@ -553,7 +553,7 @@ values of this variable and `mime-pgp-http-proxy-server-port' appropriately." (defmacro mime-pgp-show-fetched-key (key scroll &rest args) (` (let ((buffer (get-buffer-create "*fetched keys*")) - start) + start height window shrink) (with-current-buffer buffer (erase-buffer) (insert (, key)) @@ -563,20 +563,34 @@ values of this variable and `mime-pgp-http-proxy-server-port' appropriately." ) (goto-char (point-min)) (forward-line (, scroll)) - (setq start (point)) + (setq height (count-lines (point) (point-max)) + start (point)) ) - (display-buffer buffer) - (set-window-start (get-buffer-window buffer) start) - ))) + (setq window (get-buffer-window mime-echo-buffer-name)) + (if window + (set-window-buffer window buffer) + (let (pop-up-frames) + (display-buffer buffer) + )) + (setq window (get-buffer-window buffer) + shrink (1- (- (window-height window) height))) + (if (> shrink 0) + (let ((window-min-height 1)) + (enlarge-window shrink) + )) + (set-window-start window start) + buffer))) (defun mime-pgp-show-fetched-key-for-gpg (key) + "Extract KEY and show. Returns buffer object to be killed." (mime-pgp-show-fetched-key key 0) ) (defun mime-pgp-show-fetched-key-for-pgp50 (key) + "Extract KEY and show. Returns buffer object to be killed." (let ((buffer (get-buffer-create "*fetched keys*")) (process-environment process-environment) - process-connection-type process start) + process-connection-type process start height window shrink) (setenv "PGPPASSFD" nil) (with-current-buffer buffer (erase-buffer) @@ -597,21 +611,36 @@ values of this variable and `mime-pgp-http-proxy-server-port' appropriately." "^Add these keys to your keyring\\? \\[Y/n\\] " nil t)) )) + (setq start (match-beginning 0)) (delete-process process) + (delete-region start (point-max)) (goto-char (point-min)) (forward-line 10) - (setq start (point)) + (setq height (count-lines (point) start) + start (point)) ) - (display-buffer buffer) - (set-window-start (get-buffer-window buffer) start) - )) + (setq window (get-buffer-window mime-echo-buffer-name)) + (if window + (set-window-buffer window buffer) + (let (pop-up-frames) + (display-buffer buffer) + )) + (setq window (get-buffer-window buffer) + shrink (1- (- (window-height window) height))) + (if (> shrink 0) + (let ((window-min-height 1)) + (enlarge-window shrink) + )) + (set-window-start window start) + buffer)) (defun mime-pgp-show-fetched-key-for-pgp (key) + "Extract KEY and show. Returns buffer object to be killed." (mime-pgp-show-fetched-key key 7 "-f" "+language=en") ) (defun mime-pgp-fetch-key (&optional id) - "Attempt to fetch a key via HTTP for addition to PGP or GnuPG keyring. + "Attempt to fetch a key for addition to PGP or GnuPG keyring. Interactively, prompt for string matching key to fetch. Non-interactively, ID must be a pair. The CAR must be a bare Email @@ -652,7 +681,7 @@ appropriately." pgp-version))) (snarf-function (pgp-function 'snarf-keys)) (window-config (current-window-configuration)) - case-fold-search process-connection-type process) + case-fold-search process-connection-type process show-buffer) (unwind-protect (catch 'mime-pgp-fetch-key-done (cond ((interactive-p) @@ -716,12 +745,17 @@ appropriately." )) (progn (delete-region (1+ (match-end 0)) (point-max)) - (funcall show-function (buffer-string)) + (setq show-buffer + (funcall show-function (buffer-string)) + ) (if (y-or-n-p "Add this key to keyring? ") (funcall snarf-function) - )) + ) + (kill-buffer show-buffer) + t) (message "Key not found.") nil)))) + (kill-buffer buffer) (set-window-configuration window-config) ))) diff --git a/mime-ui-en.sgml b/mime-ui-en.sgml index 446b870..2a08a63 100644 --- a/mime-ui-en.sgml +++ b/mime-ui-en.sgml @@ -622,20 +622,16 @@ The value should be a symbol. Allowed versions are gpg,

Alist of service names vs. corresponding functions and its filenames. -Each element looks like -(SERVICE FUNCTION FILE [PGP5_FUNCTION PGP5_FILE [GPG_FUNCTION GPG_FILE]]). +Each element looks like (SERVICE FUNCTION FILE).

-SERVICE is a symbol of PGP2, PGP5 or GnuPG processing. It allows -`verify', `decrypt', `fetch-key', `snarf-keys', `mime-sign', -`traditional-sign', `encrypt' or `insert-key'. +SERVICE is a symbol of PGP processing. It allows `verify', `decrypt', +`fetch-key', `snarf-keys', `mime-sign', `traditional-sign', `encrypt' +or `insert-key'.

Function is a symbol of function to do specified SERVICE.

FILE is string of filename which has definition of corresponding FUNCTION. -

-PGP5_FUNCTION, PGP5_FILE, GPG_FUNCTION and GPG_FILE are similar to -FUNCTION and FILE, but they will be used for PGP 5.0i or GnuPG. diff --git a/mime-ui-en.texi b/mime-ui-en.texi index 6065525..6ff13ca 100644 --- a/mime-ui-en.texi +++ b/mime-ui-en.texi @@ -695,20 +695,16 @@ The value should be a symbol. Allowed versions are @code{gpg}, @defvar pgp-function-alist Alist of service names vs. corresponding functions and its filenames. -Each element looks like -@code{(SERVICE FUNCTION FILE [PGP5_FUNCTION PGP5_FILE [GPG_FUNCTION GPG_FILE]])}.@refill +Each element looks like @code{(SERVICE FUNCTION FILE)}.@refill -SERVICE is a symbol of PGP2, PGP5 or GnuPG processing. It allows -`verify', `decrypt', `fetch-key', `snarf-keys', `mime-sign', -`traditional-sign', `encrypt' or `insert-key'.@refill +SERVICE is a symbol of PGP processing. It allows `verify', `decrypt', +`fetch-key', `snarf-keys', `mime-sign', `traditional-sign', `encrypt' or +`insert-key'.@refill Function is a symbol of function to do specified SERVICE.@refill + FILE is string of filename which has definition of corresponding FUNCTION. - -PGP5_FUNCTION, PGP5_FILE, GPG_FUNCTION and GPG_FILE are similar to -FUNCTION and FILE, but they will be used for PGP 5.0i or GnuPG.@refill - @end defvar diff --git a/mime-ui-ja.sgml b/mime-ui-ja.sgml index 2c18352..7a9e049 100644 --- a/mime-ui-ja.sgml +++ b/mime-ui-ja.sgml @@ -637,20 +637,16 @@ The value should be a symbol. Allowed versions are gpg,

Alist of service names vs. corresponding functions and its filenames. -Each element looks like -(SERVICE FUNCTION FILE [PGP5_FUNCTION PGP5_FILE [GPG_FUNCTION GPG_FILE]]). +Each element looks like (SERVICE FUNCTION FILE).

-SERVICE is a symbol of PGP2, PGP5 or GnuPG processing. It allows -`verify', `decrypt', `fetch-key', `snarf-keys', `mime-sign', -`traditional-sign', `encrypt' or `insert-key'. +SERVICE is a symbol of PGP processing. It allows `verify', `decrypt', +`fetch-key', `snarf-keys', `mime-sign', `traditional-sign', `encrypt' +or `insert-key'.

Function is a symbol of function to do specified SERVICE.

FILE is string of filename which has definition of corresponding FUNCTION. -

-PGP5_FUNCTION, PGP5_FILE, GPG_FUNCTION and GPG_FILE are similar to -FUNCTION and FILE, but they will be used for PGP 5.0i or GnuPG. diff --git a/mime-ui-ja.texi b/mime-ui-ja.texi index 9ac5a97..b0fe572 100644 --- a/mime-ui-ja.texi +++ b/mime-ui-ja.texi @@ -712,19 +712,16 @@ The value should be a symbol. Allowed versions are @code{gpg}, @defvar pgp-function-alist Alist of service names vs. corresponding functions and its filenames. -@code{(SERVICE FUNCTION FILE [PGP5_FUNCTION PGP5_FILE [GPG_FUNCTION GPG_FILE]])}.@refill +Each element looks like @code{(SERVICE FUNCTION FILE)}.@refill -SERVICE is a symbol of PGP2, PGP5 or GnuPG processing. It allows -`verify', `decrypt', `fetch-key', `snarf-keys', `mime-sign', -`traditional-sign', `encrypt' or `insert-key'.@refill +SERVICE is a symbol of PGP processing. It allows `verify', `decrypt', +`fetch-key', `snarf-keys', `mime-sign', `traditional-sign', `encrypt' or +`insert-key'.@refill Function is a symbol of function to do specified SERVICE.@refill FILE is string of filename which has definition of corresponding FUNCTION. - -PGP5_FUNCTION, PGP5_FILE, GPG_FUNCTION and GPG_FILE are similar to -FUNCTION and FILE, but they will be used for PGP 5.0i or GnuPG.@refill @end defvar diff --git a/semi-def.el b/semi-def.el index 2f432ce..51ff326 100644 --- a/semi-def.el +++ b/semi-def.el @@ -185,62 +185,34 @@ The value should be a symbol. Allowed versions are: ;; for mime-pgp (verify mime-mc-verify "mime-mc") (decrypt mime-mc-decrypt "mime-mc") - (fetch-key mc-pgp-fetch-key "mc-pgp" - mc-pgp50-fetch-key "mc-pgp5" - mc-gpg-fetch-key "mc-gpg") + (fetch-key mime-mc-fetch-key "mime-mc") (snarf-keys mime-mc-snarf-keys "mime-mc") ;; for mime-edit - (mime-sign mime-mc-pgp-sign-region "mime-mc" - mime-mc-pgp50-sign-region "mime-mc" - mime-mc-gpg-sign-region "mime-mc") - (traditional-sign mc-pgp-sign-region "mc-pgp" - mc-pgp50-sign-region "mc-pgp5" - mc-gpg-sign-region "mc-gpg") - (encrypt mime-mc-pgp-encrypt-region "mime-mc" - mime-mc-pgp50-encrypt-region "mime-mc" - mime-mc-gpg-encrypt-region "mime-mc") + (mime-sign mime-mc-sign-region "mime-mc") + (traditional-sign mime-mc-traditional-sign-region "mime-mc") + (encrypt mime-mc-encrypt-region "mime-mc") (insert-key mime-mc-insert-public-key "mime-mc") ) "Alist of service names vs. corresponding functions and its filenames. -Each element looks like: +Each element looks like (SERVICE FUNCTION FILE). -\(SERVICE FUNCTION FILE [PGP5_FUNCTION PGP5_FILE [GPG_FUNCTION GPG_FILE]]). +SERVICE is a symbol of PGP processing. It allows `verify', `decrypt', +`fetch-key', `snarf-keys', `mime-sign', `traditional-sign', `encrypt' +or `insert-key'. -SERVICE is a symbol of PGP2, PGP5 or GnuPG processing. It allows `verify', -`decrypt', `fetch-key', `snarf-keys', `mime-sign', `traditional-sign', -`encrypt' or `insert-key'. - -FUNCTION is a symbol of function to do specified SERVICE. +Function is a symbol of function to do specified SERVICE. FILE is string of filename which has definition of corresponding -FUNCTION. - -PGP5_FUNCTION, PGP5_FILE, GPG_FUNCTION and GPG_FILE are similar to -FUNCTION and FILE, but they will be used for PGP 5.0i or GnuPG.") +FUNCTION.") (defmacro pgp-function (method) "Return function to do service METHOD." - `(let ((elem (assq ,method (symbol-value 'pgp-function-alist)))) - (cond ((eq 'gpg pgp-version) - (if (> (length elem) 3) - (nth 5 elem) - (nth 1 elem)) - ) - ((eq 'pgp50 pgp-version) - (if (> (length elem) 3) - (nth 3 elem) - (nth 1 elem)) - ) - (t - (nth 1 elem) - )))) + `(cadr (assq ,method (symbol-value 'pgp-function-alist)))) (mapcar (function - (lambda (elem) - (setq elem (cdr elem)) - (while elem - (autoload (car elem) (nth 1 elem)) - (setq elem (nthcdr 2 elem))))) + (lambda (method) + (autoload (cadr method)(nth 2 method)) + )) pgp-function-alist)