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 3AD546DE0927 for ; Mon, 3 Sep 2018 10:23:54 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.314 X-Spam-Level: X-Spam-Status: No, score=0.314 tagged_above=-999 required=5 tests=[AWL=-0.128, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.211, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=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 zYPYJe-DTBFK for ; Mon, 3 Sep 2018 10:23:52 -0700 (PDT) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by arlo.cworth.org (Postfix) with ESMTPS id 874676DE035A for ; Mon, 3 Sep 2018 10:23:52 -0700 (PDT) Received: by mail-wr1-f67.google.com with SMTP id j26-v6so1391963wre.2 for ; Mon, 03 Sep 2018 10:23:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:subject:in-reply-to:references:from:date:message-id:mime-version :content-transfer-encoding; bh=yGxZDFDigiQjaa3rxTGCz4e6A/z9L95UCv8mBXYGF1U=; b=GMqXZLdVUB9s2EB/6PwHLHkunHC0ExW+Ikc15NTRaOcp8wEDQSY+sEPAK9YlZM8o66 NqHU4pseHDeCN+wi+BA9EtVJPWVTAWYNrHtUBPSFqFUQWpITvUscdoZ+Lvo5zenUDlYc S9/1gIvBF42N5Pp+Uk7U/C+v0Zb2tAcc+I96FaPsKBqCBGdZR7iPWlcuwihJeE6798zd nmFYr0B59KssoA2ONPrTmlbeq3KL21wIY407ypQhWJSSX1ifHOT/uITai/rTX0DrPfYi D6hOGQF7XKBWsCGBkj9z5/CjHUdeY3Tr+tbR5N3YqCx1tfwrn/L4MKA9idif5r0vliFa /05Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:subject:in-reply-to:references:from:date :message-id:mime-version:content-transfer-encoding; bh=yGxZDFDigiQjaa3rxTGCz4e6A/z9L95UCv8mBXYGF1U=; b=bWN0/lmX4W/XxRORbv++oX9HMCfHg0WfzEJlivL4zAsb5y2gXBLozfSkX+CJ3PuoqA 7jznDqzbrtgF3BEmzfd1FAKPjAUDHDwx//Z70uqNoWSJcy3QXpTWuXG22JvimKFmBSCg E5vX6devKdpm+fnDhYA9r0BgAOGqt+JEsWnL1My6Hc+Jfim8XzXYlAqsk/Zp0ISK+6/S HeQYEeooWDHSQ9wZ++JmEcdV3ePc6ga1AHPmBUxbfla7YHhai42PPXO9Ec+gxSzVQkhp SuVPLqPMG9k8rW3E5dWPxItzqYdaDM06ezfDixvY0YiDs5PbDV3yVKWXbs3cgafeVpZt MaAA== X-Gm-Message-State: APzg51BCTyurEmFYoqsNBLCzOftGm7carD+l6K/a9tWkpYn1jMJjYNzL cSoqSOtIWX4Rn/4lU19LekBYCw== X-Google-Smtp-Source: ANB0VdaiFL6R9skSrIozj/9ckRHnUiMmzW5njHAG3cxE3nQUkxWzSdM+wrGbeijsD/titBamF30yXg== X-Received: by 2002:a5d:490b:: with SMTP id x11-v6mr18786634wrq.114.1535995431031; Mon, 03 Sep 2018 10:23:51 -0700 (PDT) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [81.149.164.25]) by smtp.gmail.com with ESMTPSA id q135-v6sm24759738wmd.4.2018.09.03.10.23.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 10:23:50 -0700 (PDT) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 0aa2fdbd; Mon, 3 Sep 2018 17:23:49 +0000 (UTC) To: Antoine =?utf-8?Q?Beaupr=C3=A9?= , notmuch@notmuchmail.org Subject: Re: feature request: fetch missing keys in the background In-Reply-To: References: <871saawphm.fsf@curie.anarc.at> <87va7mv75u.fsf@curie.anarc.at> X-HGTTG: constant-mown From: David Edmondson Date: Mon, 03 Sep 2018 18:23:49 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.26 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: Mon, 03 Sep 2018 17:23:54 -0000 On Monday, 2018-09-03 at 18:21:32 +01, David Edmondson wrote: > How about this patch? > > You'll need to set =E2=80=9Cnotmuch-crypto-get-keys-asynchronously=E2=80= =9D to =E2=80=9Ct=E2=80=9D to > see any benefit. Oops, and delete the old version of =E2=80=9Cnotmuch-crypto-sigstatus-error-callback=E2=80=9D from just below t= he new one. > diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el > index fc2b5301..97396ba0 100644 > --- a/emacs/notmuch-crypto.el > +++ b/emacs/notmuch-crypto.el > @@ -43,6 +43,11 @@ mode." > :package-version '(notmuch . "0.25") > :group 'notmuch-crypto) >=20=20 > +(defcustom notmuch-crypto-get-keys-asynchronously nil > + "Retrieve gpg keys asynchronously." > + :type 'boolean > + :group 'notmuch-crypto) > + > (defface notmuch-crypto-part-header > '((((class color) > (background dark)) > @@ -145,6 +150,36 @@ mode." > (call-process epg-gpg-program nil t t "--list-keys" fingerprint)) > (recenter -1)))) >=20=20 > +(defun notmuch-crypto--async-key-sentinel (process event) > + (let ((status (process-status process)) > + (exit-status (process-exit-status process))) > + (when (memq status '(exit signal)) > + (message "Asynchronous GPG key retrieval %s." > + (if (=3D exit-status 0) > + "completed" > + "failed"))))) > + > +(defun notmuch-crypto-sigstatus-error-callback (button) > + (let* ((sigstatus (button-get button :notmuch-sigstatus)) > + (keyid (concat "0x" (plist-get sigstatus :keyid))) > + (buffer (get-buffer-create "*notmuch-crypto-gpg-out*"))) > + (if notmuch-crypto-get-keys-asynchronously > + (progn > + (message "Getting the GPG key %s asynchronously..." keyid) > + (make-process :name "notmuch GPG key retrieval" > + :buffer buffer > + :command (list epg-gpg-program "--recv-keys" keyid) > + :sentinel #'notmuch-crypto--async-key-sentinel)) > + (let ((window (display-buffer buffer t nil))) > + (with-selected-window window > + (with-current-buffer buffer > + (goto-char (point-max)) > + (call-process epg-gpg-program nil t t "--recv-keys" keyid) > + (insert "\n") > + (call-process epg-gpg-program nil t t "--list-keys" keyid)) > + (recenter -1)) > + (notmuch-show-refresh-view))))) > + > (defun notmuch-crypto-sigstatus-error-callback (button) > (let* ((sigstatus (button-get button :notmuch-sigstatus)) > (keyid (concat "0x" (plist-get sigstatus :keyid))) > > dme. > --=20 > For a long time I felt, without style and grace. dme. --=20 I'm not living in the real world, no more, no more.