Notmuch: Unlock GPG on demand in the foreground.

master
Pierre Neidhardt 2019-09-10 11:28:41 +02:00
parent d031411717
commit 65e0fdf80d
1 changed files with 13 additions and 0 deletions

View File

@ -86,4 +86,17 @@
;; (advice-add 'debbugs-gnu-select-report :override #'debbugs-notmuch-select-report)
;; TODO: This is a bit brittle since it only works if ~/.authinfo.gpg exists.
;; Is there a way to unlock gpg manually without a file?
(defun ambrevar/gpg-unlock ()
"Unlock GPG."
(let ((sentinel (lambda (_process _args)
(notmuch-poll)
(notmuch-refresh-this-buffer))))
(make-process :name "gpg" :buffer nil
:command (list "gpg" "--decrypt" (expand-file-name "~/.authinfo.gpg"))
:sentinel sentinel)))
(advice-add 'notmuch-poll-and-refresh-this-buffer :override #'ambrevar/gpg-unlock)
(provide 'init-notmuch)