[PATCH] [EMACS] Adjust notmuch-crypto gpg call-process function

Tomi Ollila tomi.ollila at iki.fi
Wed Jan 25 12:13:59 PST 2017


On Wed, Jan 04 2017, John Byrnes <john at johnbyrnes.info> wrote:

> Hey Notmuchers,
>
> I'm running the latest NixOS and noticed that the system does not
> install gpgv1 by default. This means that the only gpg binary available
> is the gpg2 binary.
>
> I found that notmuch-crypto.el hardcodes the GnuPG binary as gpg.  I
> thought it might make more sense to rely on the setting provided by 
> EasyPG to locate the correct GnuPG binary.
>
> The patch is quite simple - it just replaces "gpg" with the
> epg-gpg-program variable in each place it's used.
>
> -	(call-process "gpg" nil t t "--list-keys" fingerprint))
> +	(call-process epg-gpg-program nil t t "--list-keys" fingerprint))
>
> I tested the changes locally and it seems to work OK. 

epg-gpg-program seems to be available "everywhere" (*) -- just that
(requre 'epg-config) should probably be added.

(*) On Scientific Linux 6.2:
  
  $ rpm -q -f /usr/share/emacs/23.1/lisp/epg-config.elc
  emacs-common-23.1-21.el6.x86_64

So, one should expect it to exist in all newer emacses too...

Tomi

>
> Happy New Year!
> John
>
> From 88097c2618335bb82b1e1fa197a51f280b5bc15f Mon Sep 17 00:00:00 2001
> From: John Byrnes <john at johnbyrnes.info>
> Date: Tue, 3 Jan 2017 21:37:49 -0500
> Subject: [PATCH] Adjusted notmuch-crypto gpg call-process function to respect
>  the GPG program set by the EasyPG epg-gpg-program variable.
>
> This is to correct a problem observed on NixOS where only gpg2 is
> installed by default. The Notmuch Emacs frontend fails when trying to
> access someone's key to verify their signature when it cannot find the
> GPG binary.
> ---
>  emacs/notmuch-crypto.el | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
> index 68a7e9f..c5111fd 100644
> --- a/emacs/notmuch-crypto.el
> +++ b/emacs/notmuch-crypto.el
> @@ -140,7 +140,7 @@ mode."
>      (with-selected-window window
>        (with-current-buffer buffer
>  	(goto-char (point-max))
> -	(call-process "gpg" nil t t "--list-keys" fingerprint))
> +	(call-process epg-gpg-program nil t t "--list-keys" fingerprint))
>        (recenter -1))))
>  
>  (defun notmuch-crypto-sigstatus-error-callback (button)
> @@ -151,9 +151,9 @@ mode."
>      (with-selected-window window
>        (with-current-buffer buffer
>  	(goto-char (point-max))
> -	(call-process "gpg" nil t t "--recv-keys" keyid)
> +	(call-process epg-gpg-program nil t t "--recv-keys" keyid)
>  	(insert "\n")
> -	(call-process "gpg" nil t t "--list-keys" keyid))
> +	(call-process epg-gpg-program nil t t "--list-keys" keyid))
>        (recenter -1))
>      (notmuch-show-refresh-view)))
>  
> -- 
> 2.10.0
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list