feat(functions): Add custom ivy-password-store function

The default `ivy-pass` function shells out to `pass` in such a way
that using pinentry with emacs doesn't work, causing EXWM to freeze
until `C-g` is hit, after which the password entry buffer pops up.

That was very inconvenient - however, the new auth-source integration
with pass works correctly and this commit introduces a new function
and bindings for using the same functionality as before but doing the
actual password-reading via auth-source.
This commit is contained in:
Vincent Ambo 2018-06-06 09:46:01 +02:00
parent be8d47257f
commit 66e86d2546
2 changed files with 24 additions and 1 deletions

View file

@ -170,4 +170,24 @@ Including indent-buffer, which should not be called automatically on save."
(when (string= event "finished\n")
(message "%s process finished." process))))))))
(defun ivy-password-store (&optional password-store-dir)
"Custom version of password-store integration with ivy that
actually uses the GPG agent correctly."
(interactive)
(ivy-read "Copy password of entry: "
(password-store-list (or password-store-dir (password-store-dir)))
:require-match t
:keymap ivy-pass-map
:action (lambda (entry)
(let ((password (auth-source-pass-get 'secret entry)))
(password-store-clear)
(kill-new password)
(setq password-store-kill-ring-pointer kill-ring-yank-pointer)
(message "Copied %s to the kill ring. Will clear in %s seconds."
entry (password-store-timeout))
(setq password-store-timeout-timer
(run-at-time (password-store-timeout)
nil 'password-store-clear))))))
(provide 'functions)