From 1f4e2e82649bb2a122b1406caf645ea06a933dc6 Mon Sep 17 00:00:00 2001 From: JD Smith <93749+jdtsmith@users.noreply.github.com> Date: Sun, 10 Aug 2025 17:17:47 -0400 Subject: [PATCH] Adapt tramp to new autoload-macro expand Bug #78995. * lisp/net/tramp-compat.el (tramp-loaddefs): suppress error on requiring tramp-loaddef. * lisp/net/tramp.el (tramp--with-startup): declare autoload-macro expand, and suppress warnings about this declare form on older versions of Emacs. --- lisp/net/tramp-compat.el | 2 +- lisp/net/tramp.el | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 9787e3a6553..5db8f1f61da 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -29,7 +29,7 @@ ;;; Code: -(require 'tramp-loaddefs) +(require 'tramp-loaddefs nil t) ; guard against load during autoload gen (require 'ansi-color) (require 'auth-source) (require 'format-spec) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 503b370cb3d..e80a470957f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -103,8 +103,15 @@ (put 'tramp--startup-hook 'tramp-suppress-trace t) + ;; TODO: once (autoload-macro expand) is available in all supported + ;; Emacs versions, this can be eliminated: + ;; backward compatibility for autoload-macro declare form + (unless (assq 'autoload-macro macro-declarations-alist) + (push '(autoload-macro ignore) macro-declarations-alist)) + (defmacro tramp--with-startup (&rest body) "Schedule BODY to be executed at the end of tramp.el." + (declare (autoload-macro expand)) `(add-hook 'tramp--startup-hook (lambda () ,@body))) (eval-and-compile