From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id F34526DE0941 for ; Mon, 14 Jan 2019 18:08:22 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.002 X-Spam-Level: X-Spam-Status: No, score=-0.002 tagged_above=-999 required=5 tests=[AWL=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id her1pP32n8Dg for ; Mon, 14 Jan 2019 18:08:21 -0800 (PST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 391D16DE0286 for ; Mon, 14 Jan 2019 18:08:21 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1gjE9H-0003Jy-SS; Mon, 14 Jan 2019 21:08:15 -0500 Received: (nullmailer pid 4274 invoked by uid 1000); Tue, 15 Jan 2019 02:08:14 -0000 From: David Bremner To: David Edmondson , notmuch@notmuchmail.org Subject: Re: [PATCH v3 1/4] emacs: Asynchronous retrieval of GPG keys In-Reply-To: <20181001160633.26775-2-dme@dme.org> References: <20181001160633.26775-1-dme@dme.org> <20181001160633.26775-2-dme@dme.org> Date: Mon, 14 Jan 2019 22:08:14 -0400 Message-ID: <87y37msmep.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2019 02:08:23 -0000 David Edmondson writes: > Rather than blocking emacs while gpg does its' thing, by default run > key retrieval asynchronously, possibly updating the display of the > message on successful completion. > --- > emacs/notmuch-crypto.el | 85 +++++++++++++++++++++++++++++++++++------ > 1 file changed, 74 insertions(+), 11 deletions(-) > > diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el > index fc2b5301..c20fd4f8 100644 > --- a/emacs/notmuch-crypto.el > +++ b/emacs/notmuch-crypto.el > @@ -43,6 +43,11 @@ mode." > :package-version '(notmuch . "0.25") > :group 'notmuch-crypto) > > +(defcustom notmuch-crypto-get-keys-asynchronously t > + "Retrieve gpg keys asynchronously." > + :type 'boolean > + :group 'notmuch-crypto) > + Sorry for the long delay. Should this have a :package-version key like the defcustom right about it? > + (buffer (get-buffer-create "*notmuch-crypto-gpg-out*"))) > + (if notmuch-crypto-get-keys-asynchronously > + (progn > + (notmuch-crypto--set-button-label > + button (format "Retrieving key %s asynchronously..." keyid)) > + (let ((p (make-process :name "notmuch GPG key retrieval" > + :buffer buffer > + :command (list epg-gpg-program "--recv-keys" keyid) > + :connection-type 'pipe > + :sentinel #'notmuch-crypto--async-key-sentinel > + ;; Create the process stopped so that > + ;; we have time to store the key id, > + ;; etc. on it. > + :stop t))) Using make-process unconditionally seems to require emacs 25. I think we're still trying to support Emacs 24. That can always change, but I still haven't merged Tomi's patch officially deprecating emacs 23.