diff options
| author | Michael Albinus | 2022-08-04 19:27:49 +0200 |
|---|---|---|
| committer | Michael Albinus | 2022-08-04 19:27:49 +0200 |
| commit | a08dd087e9460322cc39aa387a8bb2bf70ec1abd (patch) | |
| tree | 5381fdb70ce71886a18aa95bc9033ab62af2c64a | |
| parent | 9b5c54a49df931116d85fdfb0b482b1a1074eaf5 (diff) | |
| download | emacs-a08dd087e9460322cc39aa387a8bb2bf70ec1abd.tar.gz emacs-a08dd087e9460322cc39aa387a8bb2bf70ec1abd.zip | |
Adapt Tramp for backward compatibility
* lisp/net/tramp-compat.el (tramp-compat-auth-source-netrc-parse-all):
New defalias.
* lisp/net/tramp.el (tramp-parse-netrc): Use it. (Bug#56976)
| -rw-r--r-- | lisp/net/tramp-compat.el | 10 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index e8135332700..b83f9f0724e 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -320,6 +320,16 @@ CONDITION can also be a list of error conditions." | |||
| 320 | (lambda (string1 string2) | 320 | (lambda (string1 string2) |
| 321 | (eq t (compare-strings string1 nil nil string2 nil nil t))))) | 321 | (eq t (compare-strings string1 nil nil string2 nil nil t))))) |
| 322 | 322 | ||
| 323 | ;; Function `auth-source-netrc-parse-all' is new in Emacs 29.1. | ||
| 324 | ;; `netrc-parse' has been obsoleted in parallel. | ||
| 325 | (defalias 'tramp-compat-auth-source-netrc-parse-all | ||
| 326 | (if (fboundp 'auth-source-netrc-parse-all) | ||
| 327 | #'auth-source-netrc-parse-all | ||
| 328 | (lambda (&optional file) | ||
| 329 | (declare-function netrc-parse "netrc") | ||
| 330 | (autoload 'netrc-parse "netrc") | ||
| 331 | (netrc-parse file)))) | ||
| 332 | |||
| 323 | (dolist (elt (all-completions "tramp-compat-" obarray 'functionp)) | 333 | (dolist (elt (all-completions "tramp-compat-" obarray 'functionp)) |
| 324 | (put (intern elt) 'tramp-suppress-trace t)) | 334 | (put (intern elt) 'tramp-suppress-trace t)) |
| 325 | 335 | ||
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a35b9baaa8c..dcc8c632f91 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3340,13 +3340,11 @@ Host is always \"localhost\"." | |||
| 3340 | (defun tramp-parse-netrc (filename) | 3340 | (defun tramp-parse-netrc (filename) |
| 3341 | "Return a list of (user host) tuples allowed to access. | 3341 | "Return a list of (user host) tuples allowed to access. |
| 3342 | User may be nil." | 3342 | User may be nil." |
| 3343 | ;; The declaration is not sufficient at runtime, because netrc.el is | ||
| 3344 | ;; not autoloaded. | ||
| 3345 | (mapcar | 3343 | (mapcar |
| 3346 | (lambda (item) | 3344 | (lambda (item) |
| 3347 | (and (assoc "machine" item) | 3345 | (and (assoc "machine" item) |
| 3348 | `(,(cdr (assoc "login" item)) ,(cdr (assoc "machine" item))))) | 3346 | `(,(cdr (assoc "login" item)) ,(cdr (assoc "machine" item))))) |
| 3349 | (auth-source-netrc-parse-all filename))) | 3347 | (tramp-compat-auth-source-netrc-parse-all filename))) |
| 3350 | 3348 | ||
| 3351 | (defun tramp-parse-putty (registry-or-dirname) | 3349 | (defun tramp-parse-putty (registry-or-dirname) |
| 3352 | "Return a list of (user host) tuples allowed to access. | 3350 | "Return a list of (user host) tuples allowed to access. |