From: David Edmondson <dme@dme.org>
To: "Antoine Beaupré" <anarcat@orangeseeds.org>, notmuch@notmuchmail.org
Subject: Re: feature request: fetch missing keys in the background
Date: Mon, 03 Sep 2018 18:23:49 +0100 [thread overview]
Message-ID: <cunwos2sdei.fsf@constant-mown.hh.sledj.net> (raw)
In-Reply-To: <cunzhwyxzs3.fsf@disaster-area.hh.sledj.net>
On Monday, 2018-09-03 at 18:21:32 +01, David Edmondson wrote:
> How about this patch?
>
> You'll need to set “notmuch-crypto-get-keys-asynchronously” to “t” to
> see any benefit.
Oops, and delete the old version of
“notmuch-crypto-sigstatus-error-callback” from just below the 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)
>
> +(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))))
>
> +(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 (= 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.
> --
> For a long time I felt, without style and grace.
dme.
--
I'm not living in the real world, no more, no more.
next prev parent reply other threads:[~2018-09-03 17:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-03 15:49 feature request: fetch missing keys in the background Antoine Beaupré
2018-09-03 16:46 ` David Edmondson
2018-09-03 16:50 ` David Edmondson
2018-09-03 17:10 ` Antoine Beaupré
2018-09-03 17:21 ` David Edmondson
2018-09-03 17:23 ` David Edmondson [this message]
2018-09-03 17:47 ` PATCH: " Antoine Beaupré
2018-09-03 18:19 ` David Edmondson
2018-09-03 19:49 ` feature request: " Antoine Beaupré
2018-09-04 13:32 ` David Edmondson
2018-09-04 13:34 ` Antoine Beaupré
2018-09-04 13:39 ` David Edmondson
2018-09-04 14:12 ` Antoine Beaupré
2018-09-04 14:39 ` David Bremner
2018-09-07 11:31 ` David Edmondson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cunwos2sdei.fsf@constant-mown.hh.sledj.net \
--to=dme@dme.org \
--cc=anarcat@orangeseeds.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).