* epg.el (epg-make-context): Don't set progress-callback by
authorueno <ueno>
Sat, 23 Sep 2006 06:17:14 +0000 (06:17 +0000)
committerueno <ueno>
Sat, 23 Sep 2006 06:17:14 +0000 (06:17 +0000)
default.
(epg--start): Don't specify --enable-progress-filter if
progress-callback is not set.
(epg--status-GET_HIDDEN): Signal an error if passphrase-callback
is not set.

ChangeLog
epg.el

index 0ed7094..bc42389 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-09-23  Daiki Ueno  <ueno@unixuser.org>
+
+       * epg.el (epg-make-context): Don't set progress-callback by
+       default.
+       (epg--start): Don't specify --enable-progress-filter if
+       progress-callback is not set.
+       (epg--status-GET_HIDDEN): Signal an error if passphrase-callback
+       is not set.
+
 2006-09-15  Daiki Ueno  <ueno@unixuser.org>
 
        * epg.el (epg-progress-callback-function): Show the percentage.
diff --git a/epg.el b/epg.el
index 23707de..4e51c94 100644 (file)
--- a/epg.el
+++ b/epg.el
        (vector (or protocol 'OpenPGP) armor textmode include-certs
                cipher-algorithm digest-algorithm compress-algorithm
                #'epg-passphrase-callback-function
-               #'epg-progress-callback-function
+               nil
                nil nil nil nil nil)))
 
 (defun epg-context-protocol (context)
@@ -787,8 +787,9 @@ This function is for internal use only."
               epg-gpg-program)))
   (let* ((args (append (list "--no-tty"
                             "--status-fd" "1"
-                            "--yes"
-                            "--enable-progress-filter")
+                            "--yes")
+                      (if (epg-context-progress-callback context)
+                          (list "--enable-progress-filter"))
                       (if epg-gpg-home-directory
                           (list "--homedir" epg-gpg-home-directory))
                       (unless (eq (epg-context-protocol context) 'CMS)
@@ -929,53 +930,55 @@ This function is for internal use only."
   (setq epg-key-id 'PIN))
 
 (defun epg--status-GET_HIDDEN (context string)
-  (if (and epg-key-id
-          (string-match "\\`passphrase\\." string))
-      (let (inhibit-quit
-           passphrase
-           passphrase-with-new-line
-           encoded-passphrase-with-new-line)
-       (unwind-protect
-           (condition-case nil
-               (progn
-                 (setq passphrase
-                       (funcall
-                        (if (consp (epg-context-passphrase-callback context))
-                            (car (epg-context-passphrase-callback context))
-                          (epg-context-passphrase-callback context))
-                        context
-                        epg-key-id
-                        (if (consp (epg-context-passphrase-callback context))
-                            (cdr (epg-context-passphrase-callback context)))))
-                 (when passphrase
-                   (setq passphrase-with-new-line (concat passphrase "\n"))
-                   (epg--clear-string passphrase)
-                   (setq passphrase nil)
-                   (if epg-passphrase-coding-system
-                       (progn
-                         (setq encoded-passphrase-with-new-line
-                               (encode-coding-string
-                                passphrase-with-new-line
-                                epg-passphrase-coding-system))
-                         (epg--clear-string passphrase-with-new-line)
-                         (setq passphrase-with-new-line nil))
-                     (setq encoded-passphrase-with-new-line
-                           passphrase-with-new-line
-                           passphrase-with-new-line nil))
-                   (process-send-string (epg-context-process context)
-                                        encoded-passphrase-with-new-line)))
-             (quit
-              (epg-context-set-result-for
-               context 'error
-               (cons '(quit)
-                     (epg-context-result-for context 'error)))
-              (delete-process (epg-context-process context))))
-         (if passphrase
-             (epg--clear-string passphrase))
-         (if passphrase-with-new-line
-             (epg--clear-string passphrase-with-new-line))
-         (if encoded-passphrase-with-new-line
-             (epg--clear-string encoded-passphrase-with-new-line))))))
+  (when (and epg-key-id
+            (string-match "\\`passphrase\\." string))
+    (unless (epg-context-passphrase-callback context)
+      (error "passphrase-callback not set"))
+    (let (inhibit-quit
+         passphrase
+         passphrase-with-new-line
+         encoded-passphrase-with-new-line)
+      (unwind-protect
+         (condition-case nil
+             (progn
+               (setq passphrase
+                     (funcall
+                      (if (consp (epg-context-passphrase-callback context))
+                          (car (epg-context-passphrase-callback context))
+                        (epg-context-passphrase-callback context))
+                      context
+                      epg-key-id
+                      (if (consp (epg-context-passphrase-callback context))
+                          (cdr (epg-context-passphrase-callback context)))))
+               (when passphrase
+                 (setq passphrase-with-new-line (concat passphrase "\n"))
+                 (epg--clear-string passphrase)
+                 (setq passphrase nil)
+                 (if epg-passphrase-coding-system
+                     (progn
+                       (setq encoded-passphrase-with-new-line
+                             (encode-coding-string
+                              passphrase-with-new-line
+                              epg-passphrase-coding-system))
+                       (epg--clear-string passphrase-with-new-line)
+                       (setq passphrase-with-new-line nil))
+                   (setq encoded-passphrase-with-new-line
+                         passphrase-with-new-line
+                         passphrase-with-new-line nil))
+                 (process-send-string (epg-context-process context)
+                                      encoded-passphrase-with-new-line)))
+           (quit
+            (epg-context-set-result-for
+             context 'error
+             (cons '(quit)
+                   (epg-context-result-for context 'error)))
+            (delete-process (epg-context-process context))))
+       (if passphrase
+           (epg--clear-string passphrase))
+       (if passphrase-with-new-line
+           (epg--clear-string passphrase-with-new-line))
+       (if encoded-passphrase-with-new-line
+           (epg--clear-string encoded-passphrase-with-new-line))))))
 
 (defun epg--status-GET_BOOL (context string)
   (let ((entry (assoc string epg-prompt-alist))