@c -*-texinfo-*-

@c Copyright (C) 2021-2024 Free Software Foundation, Inc.
@c See file doclicense.texi for copying conditions.

@include trampver.texi

@node ELPA Installation
@ifplaintext
@unnumbered Installing @value{tramp} via GNU ELPA
@end ifplaintext
@ifnotplaintext
@section Installing @value{tramp} via GNU ELPA
@end ifnotplaintext
@cindex installation
@cindex GNU ELPA

@ifplaintext
@ifclear elpainclude
@value{tramp} stands for ``Transparent Remote (file) Access, Multiple
Protocol''.  This package provides remote file editing, similar to
Ange-FTP.

The difference is that Ange-FTP uses FTP to transfer files between the
local and the remote host, whereas @value{tramp} uses a combination of
@option{rsh} and @option{rcp} or other work-alike programs, such as
@option{ssh}/@option{scp}.

A remote file name has always the syntax

@example
@trampfn{method,user%domain@@host#port,/path/to/file}
@end example

Most of the parts are optional, read the manual
@uref{@value{trampurl}} for details.
@end ifclear
@end ifplaintext

@value{tramp} must be compiled for the Emacs version you are running.
If you experience compatibility error messages for the @value{tramp}
package, or if you use another major Emacs version than the version
@value{tramp} has been installed with, you must recompile the package:

@subheading Emacs 29 or newer

@itemize @bullet
@item
Recompile the @value{tramp} package

@example
M-x package-recompile RET tramp
@end example
@end itemize

@subheading Emacs 28 or older

@itemize @bullet
@item
Remove all byte-compiled @value{tramp} files

@example
$ rm -f ~/.emacs.d/elpa/tramp-@value{trampver}/tramp*.elc
@end example

@item
Start Emacs with @value{tramp}'s source files

@example
$ emacs -L ~/.emacs.d/elpa/tramp-@value{trampver} -l tramp
@end example

This should not give you the error.

@item
Recompile the @value{tramp} package @strong{with this running Emacs
instance}

@example
M-x tramp-recompile-elpa
@end example

Afterwards, you must restart Emacs.
@end itemize

@subheading Mitigation of a bug in Emacs 29.1

Due to a bug in Emacs 29.1, you must apply the following change prior
installation or upgrading @value{tramp} @value{trampver} from GNU ELPA:

@lisp
(when (string-equal emacs-version "29.1")
  (with-current-buffer
      (url-retrieve-synchronously
       "https://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/emacs-lisp/loaddefs-gen.el?h=emacs-29")
    (goto-char (point-min))
    (while (looking-at "^.+$") (forward-line))
    (eval-region (point) (point-max))))
@end lisp
