fix(mail): Add hack to "warm up" GPG agent before sending mail
This is required in order to let password lookups work correctly when shelling out to password-store from MSMTP, as it won't be calling pinentry correctly otherwise.
This commit is contained in:
parent
66e86d2546
commit
0806463a00
2 changed files with 17 additions and 0 deletions
|
@ -190,4 +190,13 @@ Including indent-buffer, which should not be called automatically on save."
|
|||
(run-at-time (password-store-timeout)
|
||||
nil 'password-store-clear))))))
|
||||
|
||||
(defun warmup-gpg-agent (arg &optional exit)
|
||||
"Function used to warm up the GPG agent before use. This is
|
||||
useful in cases where there is no easy way to make pinentry run
|
||||
in the correct context (such as when sending email)."
|
||||
(interactive)
|
||||
(message "Warming up GPG agent")
|
||||
(epg-sign-string (epg-make-context) "dummy")
|
||||
nil)
|
||||
|
||||
(provide 'functions)
|
||||
|
|
|
@ -42,4 +42,12 @@
|
|||
;; in the UI m(
|
||||
("vincent@aprila.no" . "aprila/Sende element")))
|
||||
|
||||
;; MSMTP decrypts passwords using pass, but pinentry doesn't work
|
||||
;; correctly in that setup. This forces a warmup of the GPG agent
|
||||
;; before sending the message.
|
||||
;;
|
||||
;; Note that the sending function is advised because the provided hook
|
||||
;; for this seems to run at the wrong time.
|
||||
(advice-add 'notmuch-mua-send-common :before 'warmup-gpg-agent)
|
||||
|
||||
(provide 'mail-setup)
|
||||
|
|
Loading…
Reference in a new issue