all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Graves via "Emacs development discussions." <emacs-devel@gnu.org>
To: emacs-devel@gnu.org
Cc: ngraves@ngraves.fr
Subject: [PATCH] Add custom variable auth-source-pass-file-extension.
Date: Thu,  9 Mar 2023 17:30:18 +0100	[thread overview]
Message-ID: <20230309163018.20565-1-ngraves@ngraves.fr> (raw)

---
 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	other threads:[~2023-03-09 16:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 16:30 Nicolas Graves via Emacs development discussions. [this message]
2023-03-11  9:20 ` [PATCH] Add custom variable auth-source-pass-file-extension Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230309163018.20565-1-ngraves@ngraves.fr \
    --to=emacs-devel@gnu.org \
    --cc=ngraves@ngraves.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.