]> code.delx.au - gnu-emacs/blobdiff - lisp/epg.el
Backport Bug#7931 from trunk.
[gnu-emacs] / lisp / epg.el
index b8eb2b48ea7f646bbcbfa85ed2ed00649d9cd491..673109b20150ad8c9ba2a832c0ab19cb0c5460e8 100644 (file)
@@ -1,6 +1,6 @@
 ;;; epg.el --- the EasyPG Library
 ;; Copyright (C) 1999, 2000, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
@@ -66,7 +66,7 @@
 (defconst epg-digest-algorithm-alist
   '((1 . "MD5")
     (2 . "SHA1")
-    (3 . "RMD160")
+    (3 . "RIPEMD160")
     (8 . "SHA256")
     (9 . "SHA384")
     (10 . "SHA512")
@@ -335,7 +335,13 @@ PASSPHRASE-CALLBACK is either a function, or a cons-cell whose
 car is a function and cdr is a callback data.
 
 The function gets three arguments: the context, the key-id in
-question, and the callback data (if any)."
+question, and the callback data (if any).
+
+The callback may not be called if you use GnuPG 2.x, which relies
+on the external program called `gpg-agent' for passphrase query.
+If you really want to intercept passphrase query, consider
+installing GnuPG 1.x _along with_ GnuPG 2.x, which does passphrase
+query by itself and Emacs can intercept them."
   (unless (eq (car-safe context) 'epg-context)
     (signal 'wrong-type-argument (list 'epg-context-p context)))
   (aset (cdr context) 7 (if (consp passphrase-callback)
@@ -1143,8 +1149,7 @@ This function is for internal use only."
        (goto-char (point-max))
        (insert input)))
   (if (buffer-live-p (process-buffer process))
-      (save-excursion
-       (set-buffer (process-buffer process))
+      (with-current-buffer (process-buffer process)
        (goto-char (point-max))
        (insert input)
        (unless epg-process-filter-running
@@ -1555,14 +1560,14 @@ This function is for internal use only."
 
 (defun epg--status-KEYEXPIRED (context string)
   (epg-context-set-result-for
-   context 'error
+   context 'key
    (cons (list 'key-expired (cons 'expiration-time
                                  (epg--time-from-seconds string)))
         (epg-context-result-for context 'error))))
 
 (defun epg--status-KEYREVOKED (context string)
   (epg-context-set-result-for
-   context 'error
+   context 'key
    (cons '(key-revoked)
         (epg-context-result-for context 'error))))
 
@@ -1927,8 +1932,7 @@ You can then use `write-region' to write new data into the file."
 
 (defun epg-cancel (context)
   (if (buffer-live-p (process-buffer (epg-context-process context)))
-      (save-excursion
-       (set-buffer (process-buffer (epg-context-process context)))
+      (with-current-buffer (process-buffer (epg-context-process context))
        (epg-context-set-result-for
         epg-context 'error
         (cons '(quit)