emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112349: epg.el: support pinentry mod


From: Daiki Ueno
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112349: epg.el: support pinentry mode added in GnuPG 2.1
Date: Mon, 22 Apr 2013 13:53:05 +0900
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112349
committer: Daiki Ueno <address@hidden>
branch nick: trunk
timestamp: Mon 2013-04-22 13:53:05 +0900
message:
  epg.el: support pinentry mode added in GnuPG 2.1
  
  * epg.el (epg-context-pinentry-mode): New function.
  (epg-context-set-pinentry-mode): New function.
  (epg--start): Pass --pinentry-mode option to gpg command.
modified:
  lisp/ChangeLog
  lisp/epg.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-04-22 01:47:58 +0000
+++ b/lisp/ChangeLog    2013-04-22 04:53:05 +0000
@@ -1,3 +1,9 @@
+2013-04-22  Daiki Ueno  <address@hidden>
+
+       * epg.el (epg-context-pinentry-mode): New function.
+       (epg-context-set-pinentry-mode): New function.
+       (epg--start): Pass --pinentry-mode option to gpg command.
+
 2013-04-21  Xue Fuqiao  <address@hidden>
 
        * comint.el: (comint-dynamic-complete-functions, comint-mode-map):

=== modified file 'lisp/epg.el'
--- a/lisp/epg.el       2013-01-04 22:54:08 +0000
+++ b/lisp/epg.el       2013-04-22 04:53:05 +0000
@@ -195,7 +195,7 @@
                cipher-algorithm digest-algorithm compress-algorithm
                (list #'epg-passphrase-callback-function)
                nil
-               nil nil nil nil nil nil)))
+               nil nil nil nil nil nil nil)))
 
 (defun epg-context-protocol (context)
   "Return the protocol used within CONTEXT."
@@ -289,6 +289,12 @@
     (signal 'wrong-type-argument (list 'epg-context-p context)))
   (aref (cdr context) 14))
 
+(defun epg-context-pinentry-mode (context)
+  "Return the mode of pinentry invocation."
+  (unless (eq (car-safe context) 'epg-context)
+    (signal 'wrong-type-argument (list 'epg-context-p context)))
+  (aref (cdr context) 15))
+
 (defun epg-context-set-protocol (context protocol)
   "Set the protocol used within CONTEXT."
   (unless (eq (car-safe context) 'epg-context)
@@ -407,6 +413,14 @@
     (signal 'wrong-type-argument (list 'epg-context-p context)))
   (aset (cdr context) 14 operation))
 
+(defun epg-context-set-pinentry-mode (context mode)
+  "Set the mode of pinentry invocation."
+  (unless (eq (car-safe context) 'epg-context)
+    (signal 'wrong-type-argument (list 'epg-context-p context)))
+  (unless (memq mode '(nil ask cancel error loopback))
+    (signal 'epg-error (list "Unknown pinentry mode" mode)))
+  (aset (cdr context) 15 mode))
+
 (defun epg-make-signature (status &optional key-id)
   "Return a signature object."
   (cons 'epg-signature (vector status key-id nil nil nil nil nil nil nil nil
@@ -1152,6 +1166,10 @@
                       (if (epg-context-textmode context) '("--textmode"))
                       (if (epg-context-output-file context)
                           (list "--output" (epg-context-output-file context)))
+                      (if (epg-context-pinentry-mode context)
+                          (list "--pinentry-mode"
+                                (symbol-name (epg-context-pinentry-mode
+                                              context))))
                       args))
         (coding-system-for-write 'binary)
         (coding-system-for-read 'binary)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]