(epg--status-NOTATION_NAME): New function.
[elisp/epg.git] / epa.el
diff --git a/epa.el b/epa.el
index d5c1601..e3d0824 100644 (file)
--- a/epa.el
+++ b/epa.el
@@ -566,6 +566,8 @@ If SECRET is non-nil, list secret keys instead of public keys."
         (context (epg-make-context)))
     (epg-context-set-passphrase-callback context
                                         #'epa-passphrase-callback-function)
+    (epg-context-set-progress-callback context
+                                      #'epa-progress-callback-function)
     (message "Decrypting %s..." (file-name-nondirectory file))
     (epg-decrypt-file context file plain)
     (message "Decrypting %s...done" (file-name-nondirectory file))
@@ -579,6 +581,8 @@ If SECRET is non-nil, list secret keys instead of public keys."
   (let* ((context (epg-make-context))
         (plain (if (equal (file-name-extension file) "sig")
                    (file-name-sans-extension file))))
+    (epg-context-set-progress-callback context
+                                      #'epa-progress-callback-function)
     (message "Verifying %s..." (file-name-nondirectory file))
     (epg-verify-file context file plain)
     (message "Verifying %s...done" (file-name-nondirectory file))
@@ -610,6 +614,8 @@ If no one is selected, default secret key is used.  "
     (epg-context-set-signers context signers)
     (epg-context-set-passphrase-callback context
                                         #'epa-passphrase-callback-function)
+    (epg-context-set-progress-callback context
+                                      #'epa-progress-callback-function)
     (message "Signing %s..." (file-name-nondirectory file))
     (epg-sign-file context file signature mode)
     (message "Signing %s...done" (file-name-nondirectory file))))
@@ -627,6 +633,8 @@ If no one is selected, symmetric encryption will be performed.  ")))
     (epg-context-set-textmode context epa-textmode)
     (epg-context-set-passphrase-callback context
                                         #'epa-passphrase-callback-function)
+    (epg-context-set-progress-callback context
+                                      #'epa-progress-callback-function)
     (message "Encrypting %s..." (file-name-nondirectory file))
     (epg-encrypt-file context file recipients cipher)
     (message "Encrypting %s...done" (file-name-nondirectory file))))
@@ -642,6 +650,8 @@ Don't use this command in Lisp programs!"
          plain)
       (epg-context-set-passphrase-callback context
                                           #'epa-passphrase-callback-function)
+      (epg-context-set-progress-callback context
+                                        #'epa-progress-callback-function)
       (message "Decrypting...")
       (setq plain (epg-decrypt-string context (buffer-substring start end)))
       (message "Decrypting...done")
@@ -686,6 +696,8 @@ Don't use this command in Lisp programs!"
 Don't use this command in Lisp programs!"
   (interactive "r")
   (let ((context (epg-make-context)))
+    (epg-context-set-progress-callback context
+                                      #'epa-progress-callback-function)
     (epg-verify-string context
                       (encode-coding-string
                        (buffer-substring start end)
@@ -694,8 +706,9 @@ Don't use this command in Lisp programs!"
        (epa-display-verify-result (epg-context-result-for context 'verify)))))
 
 ;;;###autoload
-(defun epa-verify-armor-in-region (start end)
-  "Verify OpenPGP armors in the current region between START and END.
+(defun epa-verify-cleartext-in-region (start end)
+  "Verify OpenPGP cleartext signed messages in the current region
+between START and END.
 
 Don't use this command in Lisp programs!"
   (interactive "r")
@@ -704,20 +717,15 @@ Don't use this command in Lisp programs!"
       (narrow-to-region start end)
       (goto-char start)
       (let (armor-start armor-end)
-       (while (re-search-forward "-----BEGIN PGP\\( SIGNED\\)? MESSAGE-----$"
+       (while (re-search-forward "-----BEGIN PGP SIGNED MESSAGE-----$"
                                  nil t)
          (setq armor-start (match-beginning 0))
-         (if (match-beginning 1)       ;cleartext signed message
-             (progn
-               (unless (re-search-forward "^-----BEGIN PGP SIGNATURE-----$"
+         (unless (re-search-forward "^-----BEGIN PGP SIGNATURE-----$"
                                           nil t)
-                 (error "Invalid cleartext signed message"))
-               (setq armor-end (re-search-forward
-                                "^-----END PGP SIGNATURE-----$"
-                                nil t)))
-           (setq armor-end (re-search-forward
-                            "^-----END PGP MESSAGE-----$"
-                            nil t)))
+           (error "Invalid cleartext signed message"))
+         (setq armor-end (re-search-forward
+                          "^-----END PGP SIGNATURE-----$"
+                          nil t))
          (unless armor-end
            (error "No armor tail"))
          (epa-verify-region armor-start armor-end))))))
@@ -744,6 +752,8 @@ If no one is selected, default secret key is used.  "
       (epg-context-set-signers context signers)
       (epg-context-set-passphrase-callback context
                                           #'epa-passphrase-callback-function)
+      (epg-context-set-progress-callback context
+                                        #'epa-progress-callback-function)
       (message "Signing...")
       (setq signature (epg-sign-string context
                                       (encode-coding-string
@@ -770,6 +780,8 @@ If no one is selected, symmetric encryption will be performed.  ")))
       (epg-context-set-textmode context epa-textmode)
       (epg-context-set-passphrase-callback context
                                           #'epa-passphrase-callback-function)
+      (epg-context-set-progress-callback context
+                                        #'epa-progress-callback-function)
       (message "Encrypting...")
       (setq cipher (epg-encrypt-string context
                                       (encode-coding-string
@@ -782,7 +794,9 @@ If no one is selected, symmetric encryption will be performed.  ")))
 
 ;;;###autoload
 (defun epa-delete-keys (keys &optional allow-secret)
-  "Delete selected KEYS."
+  "Delete selected KEYS.
+
+Don't use this command in Lisp programs!"
   (interactive
    (let ((keys (epa--marked-keys)))
      (unless keys
@@ -797,7 +811,9 @@ If no one is selected, symmetric encryption will be performed.  ")))
 
 ;;;###autoload
 (defun epa-import-keys (file)
-  "Import keys from FILE."
+  "Import keys from FILE.
+
+Don't use this command in Lisp programs!"
   (interactive "fFile: ")
   (let ((context (epg-make-context)))
     (message "Importing %s..." (file-name-nondirectory file))
@@ -807,7 +823,9 @@ If no one is selected, symmetric encryption will be performed.  ")))
 
 ;;;###autoload
 (defun epa-export-keys (keys file)
-  "Export selected KEYS to FILE."
+  "Export selected KEYS to FILE.
+
+Don't use this command in Lisp programs!"
   (interactive
    (let ((keys (epa--marked-keys))
         default-name)
@@ -835,7 +853,9 @@ If no one is selected, symmetric encryption will be performed.  ")))
 ;;;###autoload
 (defun epa-sign-keys (keys &optional local)
   "Sign selected KEYS.
-If LOCAL is non-nil, the signature is marked as non exportable."
+If a prefix-arg is specified, the signature is marked as non exportable.
+
+Don't use this command in Lisp programs!"
   (interactive
    (let ((keys (epa--marked-keys)))
      (unless keys
@@ -844,6 +864,8 @@ If LOCAL is non-nil, the signature is marked as non exportable."
   (let ((context (epg-make-context)))
     (epg-context-set-passphrase-callback context
                                         #'epa-passphrase-callback-function)
+    (epg-context-set-progress-callback context
+                                      #'epa-progress-callback-function)
     (message "Signing keys...")
     (epg-sign-keys context keys local)
     (message "Signing keys...done")))