diff options
author | galaunay <gaby.launay@tutanota.com> | 2019-01-13 21:30:53 +0000 |
---|---|---|
committer | Damien Cassou <damien@cassou.me> | 2019-06-24 09:15:40 +0200 |
commit | a63cbb56dfc6074189407e9e182e807ce058e618 (patch) | |
tree | fbfa119a4917068c1867c9b908c12016a98da00f /lisp/auth-source-pass.el | |
parent | 9574565202a1a9a58a38b067b0230933733c0b4b (diff) | |
download | emacs-a63cbb56dfc6074189407e9e182e807ce058e618.tar.gz |
Add auth-source-pass-filename option
* lisp/auth-source-pass.el (auth-source-pass)
(auth-source-pass-filename): Add option to specify a customized
password-store path.
(auth-source-pass--read-entry)
(auth-source-pass-entries): Use the new option instead of hard-coded
`~/.password-store'.
Diffstat (limited to 'lisp/auth-source-pass.el')
-rw-r--r-- | lisp/auth-source-pass.el | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el index 4fcb1015e76..1fda6982328 100644 --- a/lisp/auth-source-pass.el +++ b/lisp/auth-source-pass.el @@ -38,6 +38,17 @@ (require 'auth-source) (require 'url-parse) +(defgroup auth-source-pass nil + "password-store integration within auth-source." + :prefix "auth-source-pass-" + :group 'auth-source + :version "27.1") + +(defcustom auth-source-pass-filename "~/.password-store" + "Filename of the password-store folder." + :type 'directory + :version "27.1") + (cl-defun auth-source-pass-search (&rest spec &key backend type host user port &allow-other-keys) @@ -121,7 +132,7 @@ key2: value2" (with-temp-buffer (insert-file-contents (expand-file-name (format "%s.gpg" entry) - "~/.password-store")) + auth-source-pass-filename)) (buffer-substring-no-properties (point-min) (point-max)))) (defun auth-source-pass-parse-entry (entry) @@ -188,7 +199,7 @@ often." ;; in Emacs (defun auth-source-pass-entries () "Return a list of all password store entries." - (let ((store-dir (expand-file-name "~/.password-store/"))) + (let ((store-dir (expand-file-name auth-source-pass-filename))) (mapcar (lambda (file) (file-name-sans-extension (file-relative-name file store-dir))) (directory-files-recursively store-dir "\\.gpg$")))) |