From 9652736b084a09133e983e204eaa29573c0359cc Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 8 Jan 2022 13:38:18 +0100 Subject: [PATCH] Adapt Tramp for `auth-info-password' * lisp/net/tramp-compat.el (tramp-compat-auth-info-password): New defalias. * lisp/net/tramp.el (tramp-read-passwd): Use it. --- lisp/net/tramp-compat.el | 10 ++++++++++ lisp/net/tramp.el | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 0a45b12a04a..db7e7d67c4d 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -283,6 +283,16 @@ CONDITION can also be a list of error conditions." (tramp-error vec tramp-permission-denied file) (tramp-error vec tramp-permission-denied "Permission denied: %s" file))) +;; Function `auth-info-password' is new in Emacs 29.1. +(defalias 'tramp-compat-auth-info-password + (if (fboundp 'auth-info-password) + #'auth-info-password + (lambda (auth-info) + (let ((secret (plist-get auth-info :secret))) + (while (functionp secret) + (setq secret (funcall secret))) + secret)))) + (dolist (elt (all-completions "tramp-compat-" obarray 'functionp)) (put (intern elt) 'tramp-suppress-trace t)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index fdbb78123df..7d6157ed8c2 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -5756,7 +5756,8 @@ Invokes `password-read' if available, `read-passwd' else." :create t)) tramp-password-save-function (plist-get auth-info :save-function) - auth-passwd (auth-info-password auth-info)))) + auth-passwd + (tramp-compat-auth-info-password auth-info)))) ;; Try the password cache. (progn -- 2.39.2