>From 1859ab24a1fee10d78aa2a3907e48786c2f1d7f6 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Fri, 11 Nov 2022 19:55:11 -0800 Subject: [PATCH 0/2] *** NOT A PATCH *** *** BLURB HERE *** F. Jason Park (2): [POC] Make auth-source-pass behave more like other backends [POC] Support auth-source-pass in ERC doc/misc/auth.texi | 11 ++ doc/misc/erc.texi | 3 +- etc/NEWS | 8 ++ lisp/auth-source-pass.el | 105 +++++++++++++++- lisp/erc/erc-compat.el | 99 +++++++++++++++ lisp/erc/erc.el | 7 +- test/lisp/auth-source-pass-tests.el | 184 ++++++++++++++++++++++++++++ test/lisp/erc/erc-services-tests.el | 3 - 8 files changed, 414 insertions(+), 6 deletions(-) Interdiff: diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el index 54070e03eb..34edd4fa31 100644 --- a/lisp/auth-source-pass.el +++ b/lisp/auth-source-pass.el @@ -132,7 +132,7 @@ auth-source-pass--build-result-many (auth-source-pass--do-debug "final result: %S" rv)) (let (out) (dolist (e rv out) - (when-let* ((s (plist-get e :secret)) ; s not captured by closure + (when-let* ((s (plist-get e :secret)) ; not captured by closure in 29.1 (v (auth-source--obfuscate s))) (setf (plist-get e :secret) (lambda () (auth-source--deobfuscate v)))) @@ -256,7 +256,7 @@ auth-source-pass--find-match (list hosts)))) (defun auth-source-pass--retrieve-parsed (seen path port-number-p) - (when-let ((m (string-match auth-source-pass--match-regexp path))) + (when (string-match auth-source-pass--match-regexp path) (puthash path (list :host (or (match-string 10 path) (match-string 11 path)) :user (or (match-string 20 path) (match-string 21 path)) @@ -306,7 +306,7 @@ auth-source-pass--find-match-many ,@(and secret (not (eq secret t)) (list :secret secret))) out) (when (or (zerop (cl-decf max)) - (null (setq entries (remove e entries)))) + (null (setq entries (delete e entries)))) (throw 'done out))))))))))) (defun auth-source-pass--disambiguate (host &optional user port) diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el index 739f502764..47d5258f92 100644 --- a/lisp/erc/erc-compat.el +++ b/lisp/erc/erc-compat.el @@ -184,15 +184,15 @@ erc-compat--with-memoization ;; This basically hard codes `auth-source-pass-port-separator' to ":" (defun erc-compat--auth-source-pass--retrieve-parsed (seen e port-number-p) - (when-let ((pat (rx (or bot "/") - (or (: (? (group-n 20 (+ (not (in " /@")))) "@") - (group-n 10 (+ (not (in " /:@")))) - (? ":" (group-n 30 (+ (not (in " /:")))))) - (: (group-n 11 (+ (not (in " /:@")))) - (? ":" (group-n 31 (+ (not (in " /:"))))) - (? "/" (group-n 21 (+ (not (in " /:"))))))) - eot)) - (m (string-match pat e))) + (when (string-match (rx (or bot "/") + (or (: (? (group-n 20 (+ (not (in " /@")))) "@") + (group-n 10 (+ (not (in " /:@")))) + (? ":" (group-n 30 (+ (not (in " /:")))))) + (: (group-n 11 (+ (not (in " /:@")))) + (? ":" (group-n 31 (+ (not (in " /:"))))) + (? "/" (group-n 21 (+ (not (in " /:"))))))) + eot) + e) (puthash e (list :host (or (match-string 10 e) (match-string 11 e)) :user (or (match-string 20 e) @@ -247,7 +247,7 @@ erc-compat--auth-source-pass--build-result-many ,@(and secret (not (eq secret t)) (list :secret secret))) out) (when (or (zerop (cl-decf max)) - (null (setq entries (remove e entries)))) + (null (setq entries (delete e entries)))) (throw 'done nil))))))))) (reverse out))) -- 2.38.1