From 0e4e79a6fb6a96ec841ff0b66143c575946a43f5 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 9 Sep 2024 15:22:35 +0200 Subject: [PATCH] Silence compiler error * lisp/net/tramp.el (tramp-file-name*): Embed `function-put' calls with `tramp--with-startup'. (tramp-active-command-completion-p) * lisp/net/tramp-cache.el (tramp-get-hash-table): Remove declare form. Add `tramp-suppress-trace' function property. (cherry picked from commit d33d8c089b909b1fa64a799146557fcb68096269) --- lisp/net/tramp-cache.el | 7 ++++++- lisp/net/tramp.el | 28 +++++++++++++++++----------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 2d9d58b51ac..a5bdacb4d91 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -131,7 +131,7 @@ details see the info pages." If it doesn't exist yet, it is created and initialized with matching entries of `tramp-connection-properties'. If KEY is `tramp-cache-undefined', don't create anything, and return nil." - (declare (tramp-suppress-trace t)) + ;; (declare (tramp-suppress-trace t)) (unless (eq key tramp-cache-undefined) (or (gethash key tramp-cache-data) (let ((hash @@ -144,6 +144,11 @@ If KEY is `tramp-cache-undefined', don't create anything, and return nil." (tramp-set-connection-property key (nth 1 elt) (nth 2 elt))))) hash)))) +;; We cannot use the `declare' form for `tramp-suppress-trace' in +;; autoloaded functions, because the tramp-loaddefs.el generation +;; would fail. +(function-put #'tramp-get-hash-table 'tramp-suppress-trace t) + ;;;###tramp-autoload (defun tramp-get-file-property (key file property &optional default) "Get the PROPERTY of FILE from the cache context of KEY. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 1dfdf7c68c8..8c649f28415 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1513,17 +1513,18 @@ calling HANDLER.") ;; so .... here we are. ;;;###tramp-autoload(require 'cl-lib) ;;;###tramp-autoload -(progn - (cl-defstruct (tramp-file-name (:type list) :named) - method user domain host port localname hop)) +(cl-defstruct (tramp-file-name (:type list) :named) + method user domain host port localname hop) -(function-put #'tramp-file-name-method 'tramp-suppress-trace t) -(function-put #'tramp-file-name-user 'tramp-suppress-trace t) -(function-put #'tramp-file-name-domain 'tramp-suppress-trace t) -(function-put #'tramp-file-name-host 'tramp-suppress-trace t) -(function-put #'tramp-file-name-port 'tramp-suppress-trace t) -(function-put #'tramp-file-name-localname 'tramp-suppress-trace t) -(function-put #'tramp-file-name-hop 'tramp-suppress-trace t) +(tramp--with-startup + (function-put #'tramp-file-name-method 'tramp-suppress-trace t) + (function-put #'tramp-file-name-user 'tramp-suppress-trace t) + (function-put #'tramp-file-name-domain 'tramp-suppress-trace t) + (function-put #'tramp-file-name-host 'tramp-suppress-trace t) + (function-put #'tramp-file-name-port 'tramp-suppress-trace t) + (function-put #'tramp-file-name-localname 'tramp-suppress-trace t) + (function-put #'tramp-file-name-hop 'tramp-suppress-trace t) + (function-put #'make-tramp-file-name 'tramp-suppress-trace t)) ;;;###tramp-autoload (defconst tramp-null-hop @@ -2713,11 +2714,16 @@ They are completed by `M-x TAB' only if the current buffer is remote." (defun tramp-active-command-completion-p (_symbol _buffer) "A predicate for Tramp interactive commands. They are completed by `M-x TAB' only if there's an active connection or buffer." - (declare (tramp-suppress-trace t)) + ;; (declare (tramp-suppress-trace t)) (or (and (hash-table-p tramp-cache-data) (not (zerop (hash-table-count tramp-cache-data)))) (tramp-list-remote-buffers))) +;; We cannot use the `declare' form for `tramp-suppress-trace' in +;; autoloaded functions, because the tramp-loaddefs.el generation +;; would fail. +(function-put #'tramp-active-command-completion-p 'tramp-suppress-trace t) + (defun tramp-connectable-p (vec-or-filename) "Check if it is possible to connect the remote host without side-effects. This is true, if either the remote host is already connected, or if we are -- 2.39.2