Improve Tramp's initial warnings

* lisp/net/tramp-cache.el (tramp-dump-connection-properties):
Adapt comment.

* lisp/net/tramp-compat.el (tramp-warning): Declare and use it.

* lisp/net/tramp-message.el (tramp-warning): Declare `indent'.
This commit is contained in:
Michael Albinus 2025-04-03 14:57:06 +02:00
parent 1e865a2f28
commit fd5f817882
3 changed files with 27 additions and 24 deletions

View file

@ -573,12 +573,11 @@ PROPERTIES is a list of file properties (strings)."
print-length print-level) print-length print-level)
;; Remove `tramp-null-hop'. ;; Remove `tramp-null-hop'.
(remhash tramp-null-hop cache) (remhash tramp-null-hop cache)
;; Remove temporary data. If there is the key "login-as", we ;; If there is the key "login-as", we don't save, because all
;; don't save either, because all other properties might ;; other properties might depend on the login name, and we
;; depend on the login name, and we want to give the ;; want to give the possibility to use another login name
;; possibility to use another login name later on. Key ;; later on. Key "started" exists for the "ftp" method only,
;; "started" exists for the "ftp" method only, which must not ;; which must not be kept persistent.
;; be kept persistent.
(maphash (maphash
(lambda (key value) (lambda (key value)
(if (and (tramp-file-name-p key) (hash-table-p value) (if (and (tramp-file-name-p key) (hash-table-p value)

View file

@ -38,30 +38,34 @@
(require 'xdg) (require 'xdg)
(declare-function tramp-error "tramp-message") (declare-function tramp-error "tramp-message")
(declare-function tramp-warning "tramp-message")
(declare-function tramp-tramp-file-p "tramp") (declare-function tramp-tramp-file-p "tramp")
(defvar tramp-temp-name-prefix) (defvar tramp-temp-name-prefix)
(defconst tramp-compat-emacs-compiled-version (eval-when-compile emacs-version) (defconst tramp-compat-emacs-compiled-version (eval-when-compile emacs-version)
"The Emacs version used for compilation.") "The Emacs version used for compilation.")
(unless (= emacs-major-version (with-eval-after-load 'tramp
(car (version-to-list tramp-compat-emacs-compiled-version))) (unless (= emacs-major-version
(lwarn 'tramp :warning (car (version-to-list tramp-compat-emacs-compiled-version)))
"Tramp has been compiled with Emacs %s, this is Emacs %s" (tramp-warning nil
tramp-compat-emacs-compiled-version emacs-version)) "Tramp has been compiled with Emacs %s, this is Emacs %s"
tramp-compat-emacs-compiled-version emacs-version))
(with-eval-after-load 'docker-tramp (with-eval-after-load 'docker-tramp
(lwarn 'tramp :warning (tramp-warning nil
(concat "Package `docker-tramp' has been obsoleted, " (concat "Package `docker-tramp' has been obsoleted, "
"please use integrated package `tramp-container'"))) "please use integrated package `tramp-container'")))
(with-eval-after-load 'kubernetes-tramp
(lwarn 'tramp :warning (with-eval-after-load 'kubernetes-tramp
(concat "Package `kubernetes-tramp' has been obsoleted, " (tramp-warning nil
"please use integrated package `tramp-container'"))) (concat "Package `kubernetes-tramp' has been obsoleted, "
(with-eval-after-load 'tramp-nspawn "please use integrated package `tramp-container'")))
(lwarn 'tramp :warning
(concat "Package `tramp-nspawn' has been obsoleted, " (with-eval-after-load 'tramp-nspawn
"please use integrated package `tramp-container'"))) (tramp-warning nil
(concat "Package `tramp-nspawn' has been obsoleted, "
"please use integrated package `tramp-container'"))))
;; For not existing functions, obsolete functions, or functions with a ;; For not existing functions, obsolete functions, or functions with a
;; changed argument list, there are compiler warnings. We want to ;; changed argument list, there are compiler warnings. We want to

View file

@ -467,7 +467,7 @@ the resulting error message."
"Show a warning. "Show a warning.
VEC-OR-PROC identifies the connection to use, remaining arguments passed VEC-OR-PROC identifies the connection to use, remaining arguments passed
to `tramp-message'." to `tramp-message'."
(declare (tramp-suppress-trace t)) (declare (indent 1) (tramp-suppress-trace t))
(let (signal-hook-function) (let (signal-hook-function)
(apply 'tramp-message vec-or-proc 2 fmt-string arguments) (apply 'tramp-message vec-or-proc 2 fmt-string arguments)
(apply 'lwarn 'tramp :warning fmt-string arguments))) (apply 'lwarn 'tramp :warning fmt-string arguments)))