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.
This commit is contained in:
JD Smith
2025-08-10 17:17:47 -04:00
parent da3973b657
commit 1f4e2e8264
2 changed files with 8 additions and 1 deletions

View File

@@ -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)

View File

@@ -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