about summary refs log tree commit diff
path: root/init/functions.el
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2018-06-06T08·22+0200
committerVincent Ambo <mail@tazj.in>2018-06-06T08·22+0200
commit0806463a004de5258640664280b69b1118c624b2 (patch)
tree3e2c715bc10047839f0d386c65b91af1c4a29e9c /init/functions.el
parent66e86d2546c8abdc22cc7333e85e50eef3408c3d (diff)
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.
Diffstat (limited to 'init/functions.el')
-rw-r--r--init/functions.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/init/functions.el b/init/functions.el
index 5ed9a06fd6fb..84a689656425 100644
--- a/init/functions.el
+++ b/init/functions.el
@@ -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)