From e80c2a7b47d161f00aac096b9d58a18879a122e8 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 17 Feb 2016 16:32:25 +0900 Subject: Make GnuPG version check robuster We changed the default gpg program to "gpg2" from "gpg" in the commit f93d669a16bd3cb3f43f0c8cfd22fe18b627a6a1. However, there are two maintained branches (2.0 and 2.1) and Emacs doesn't work well with 2.0 series. Check the actual version of "gpg2" at run time, and properly divert to "gpg" if necessary. * lisp/epg-config.el: Require 'cl-lib for `cl-destructuring-bind'. (epg-config--program-alist): New variable. (epg--configurations): New variable. (epg-configuration-find): New function. (epg-config--make-gpg-configuration): New function. (epg-config--make-gpgsm-configuration): New function. (epg-configuration): Mark as obsolete. * lisp/epg.el (epg-context): Use `epg-configuration-find'. --- lisp/epg.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lisp/epg.el') diff --git a/lisp/epg.el b/lisp/epg.el index 1f9db23478c..1a18ab2a52a 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -186,11 +186,11 @@ compress-algorithm &aux (program - (pcase protocol - (`OpenPGP epg-gpg-program) - (`CMS epg-gpgsm-program) - (_ (signal 'epg-error - (list "unknown protocol" protocol))))))) + (let ((configuration (epg-configuration-find protocol))) + (unless configuration + (signal 'epg-error + (list "no usable configuration" protocol))) + (alist-get 'program configuration))))) (:copier nil) (:predicate nil)) protocol -- cgit v1.2.1