From: galaunay Date: Sun, 13 Jan 2019 21:30:53 +0000 (+0000) Subject: Add auth-source-pass-filename option X-Git-Tag: emacs-27.0.90~2285 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a63cbb56dfc6074189407e9e182e807ce058e618;p=emacs.git 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'. --- 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$"))))