>Tramp 2.6.0-pre (this is the version in Emacs 29) cares about. However,
>it is not ready for release yet, and backporting this special -O
>handling isn't trivial.
>
>In order to work around the problem, you might adapt the "scp" call in
>Tramp. Add the "-O" command line argument in the tramp-methods "scp"
>definition, parameter tramp-copy-args
I ended up putting this in my .emacs, which seems to work for me:
;; Tramp < 2.6: add -O option to scp
(when (string< tramp-version "2.6")
(setf (cdr (assoc `tramp-copy-args (assoc "scp" tramp-methods)))
(list (delete-dups (append `(("-O"))
(car (cdr (assoc `tramp-copy-args
(assoc "scp"
tramp-methods)))))))))