unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Add custom variable auth-source-pass-file-extension.
@ 2023-03-09 16:30 Nicolas Graves via Emacs development discussions.
  2023-03-11  9:20 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Graves via Emacs development discussions. @ 2023-03-09 16:30 UTC (permalink / raw)
  To: emacs-devel; +Cc: ngraves

---
 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




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add custom variable auth-source-pass-file-extension.
  2023-03-09 16:30 [PATCH] Add custom variable auth-source-pass-file-extension Nicolas Graves via Emacs development discussions.
@ 2023-03-11  9:20 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-03-11  9:20 UTC (permalink / raw)
  To: Nicolas Graves; +Cc: emacs-devel

> Cc: ngraves@ngraves.fr
> Date: Thu,  9 Mar 2023 17:30:18 +0100
> From:  Nicolas Graves via "Emacs development discussions." <emacs-devel@gnu.org>
> 
> ---
>  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

Thanks, but could you please state the motivation and rationale for
this change?



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-11  9:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09 16:30 [PATCH] Add custom variable auth-source-pass-file-extension Nicolas Graves via Emacs development discussions.
2023-03-11  9:20 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).