emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] [emacs] 02/02: epg: Fix callback argument type check


From: Daiki Ueno
Subject: [Emacs-diffs] [emacs] 02/02: epg: Fix callback argument type check
Date: Tue, 18 Nov 2014 05:54:35 +0000

branch: master
commit 5c249e2a0470b1bc53d10b5f4cf303922933e280
Author: Daiki Ueno <address@hidden>
Date:   Tue Nov 18 14:52:45 2014 +0900

    epg: Fix callback argument type check
    
    * epg.el (epg-context-set-passphrase-callback)
    (epg-context-set-progress-callback): Check if the CALLBACK
    argument is a function, instead of a cons.
---
 lisp/ChangeLog |    6 ++++++
 lisp/epg.el    |   12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 928c89c..2670a66 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
 2014-11-18  Daiki Ueno  <address@hidden>
 
+       * epg.el (epg-context-set-passphrase-callback)
+       (epg-context-set-progress-callback): Check if the CALLBACK
+       argument is a function, instead of a cons.
+
+2014-11-18  Daiki Ueno  <address@hidden>
+
        * epa-file.el (epa-file-insert-file-contents)
        (epa-file-write-region): Remove redundant check of
        epa-pinentry-mode.
diff --git a/lisp/epg.el b/lisp/epg.el
index e4d8c1e..20e6785 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -252,9 +252,9 @@ installing GnuPG 1.x _along with_ GnuPG 2.x, which does 
passphrase
 query by itself and Emacs can intercept them."
   ;; (declare (obsolete setf "25.1"))
   (setf (epg-context-passphrase-callback context)
-        (if (consp passphrase-callback) ;FIXME: functions can also be consp!
-            passphrase-callback
-          (list passphrase-callback))))
+        (if (functionp passphrase-callback)
+           (list passphrase-callback)
+         passphrase-callback)))
 
 (defun epg-context-set-progress-callback (context
                                          progress-callback)
@@ -268,9 +268,9 @@ description, the character to display a progress unit, the
 current amount done, the total amount to be done, and the
 callback data (if any)."
   (setf (epg-context-progress-callback context)
-        (if (consp progress-callback) ;FIXME: could be a function!
-            progress-callback
-          (list progress-callback))))
+        (if (functionp progress-callback)
+            (list progress-callback)
+          progress-callback)))
 
 (defun epg-context-set-signers (context signers)
   "Set the list of key-id for signing."



reply via email to

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