emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add custom variable auth-source-pass-file-extension.


From: Nicolas Graves
Subject: [PATCH] Add custom variable auth-source-pass-file-extension.
Date: Thu, 9 Mar 2023 17:30:18 +0100

---
 lisp/auth-source-pass.el | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index dbcc9d05753..5e232b44438 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -69,6 +69,11 @@ Unix password store'."
   :type 'boolean
   :version "29.1")
 
+(defcustom auth-source-pass-file-extension "gpg"
+  "File extension to expect for auth-source-pass."
+  :type 'string
+  :version "30.1")
+
 (cl-defun auth-source-pass-search (&rest spec
                                          &key backend type host user port
                                          require max
@@ -195,9 +200,10 @@ See `auth-source-pass-get'."
 (defun auth-source-pass--read-entry (entry)
   "Return a string with the file content of ENTRY."
   (with-temp-buffer
-    (insert-file-contents (expand-file-name
-                           (format "%s.gpg" entry)
-                           auth-source-pass-filename))
+    (insert-file-contents
+     (expand-file-name
+      (format (concat "%s." auth-source-pass-file-extension) entry)
+      auth-source-pass-filename))
     (buffer-substring-no-properties (point-min) (point-max))))
 
 (defun auth-source-pass-parse-entry (entry)
@@ -238,7 +244,8 @@ CONTENTS is the contents of a password-store formatted 
file."
   (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\\'"))))
+     (directory-files-recursively
+      store-dir (concat "\\." auth-source-pass-file-extension "\\'")))))
 
 (defun auth-source-pass--find-match (hosts user port)
   "Return password-store entry data matching HOSTS, USER and PORT.
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]