summaryrefslogtreecommitdiff
path: root/lisp/epg.el
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2016-02-17 16:32:25 +0900
committerDaiki Ueno <ueno@gnu.org>2016-02-17 16:47:24 +0900
commite80c2a7b47d161f00aac096b9d58a18879a122e8 (patch)
tree982974a0196587628a0891ffb19d66339c650fad /lisp/epg.el
parent15a946479c96fdce693c13acfe41a66266ffcadb (diff)
downloademacs-e80c2a7b47d161f00aac096b9d58a18879a122e8.tar.gz
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'.
Diffstat (limited to 'lisp/epg.el')
-rw-r--r--lisp/epg.el10
1 files changed, 5 insertions, 5 deletions
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