* doc/misc/tramp.texi (Inline methods): Add tramp-docker-program,
tramp-podman-program, tramp-kubernetes-program,
tramp-toolbox-program, tramp-distrobox-program,
tramp-flatpak-program, tramp-apptainer-program, and
tramp-nspawn-program.
(Remote shell setup): Rearrange indices.
(Ssh setup): Say "user option" when needed.
(Keeping files encrypted): Add tramp-crypt-encfs-program.
(Frequently Asked Questions): Rearrange indices. Remove duplicate
text. Add tramp-mode.
* lisp/net/tramp.el (tramp-active-command-completion-p): New defun.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection)
(tramp-cleanup-all-connections, tramp-cleanup-some-buffers)
(tramp-cleanup-all-buffers, tramp-rename-files):
* lisp/net/tramp-message.el (tramp-setup-debug-buffer):
Declare `completion'.
* lisp/net/tramp-integration.el (tramp-info-link): New widget.
(tramp-widget-info-link-action): New defun.
* lisp/net/tramp.el (tramp, tramp-mode, tramp-backup-directory-alist)
(tramp-auto-save-directory, tramp-encoding-shell)
(tramp-encoding-command-switch)
(tramp-encoding-command-interactive, tramp-default-method)
(tramp-default-method-alist, tramp-default-user)
(tramp-default-user-alist, tramp-default-host)
(tramp-default-host-alist, tramp-default-proxies-alist)
(tramp-save-ad-hoc-proxies, tramp-show-ad-hoc-proxies)
(tramp-restricted-shell-hosts-alist, tramp-local-host-regexp)
(tramp-shell-prompt-pattern, tramp-password-prompt-regexp)
(tramp-otp-password-prompt-regexp, tramp-wrong-passwd-regexp)
(tramp-terminal-type, tramp-syntax)
(tramp-ignored-file-name-regexp, tramp-chunksize)
(tramp-process-connection-type, tramp-remote-path)
(tramp-remote-process-environment)
(tramp-completion-multi-hop-methods)
(tramp-completion-use-auth-sources, tramp-use-file-attributes)
(tramp-inhibit-errors-if-setting-file-attributes-fail)
(tramp-allow-unsafe-temporary-files):
* lisp/net/tramp-adb.el (tramp-adb-program)
(tramp-adb-connect-if-not-connected):
* lisp/net/tramp-cache.el (tramp-connection-properties)
(tramp-persistency-file-name, tramp-completion-use-cache):
* lisp/net/tramp-cmds.el (tramp-cleanup-some-buffers-hook)
(tramp-default-rename-alist, tramp-confirm-rename-file-names)
(tramp-file-name-with-method):
* lisp/net/tramp-container.el (tramp-docker-program)
(tramp-podman-program, tramp-kubernetes-program)
(tramp-kubernetes-context, tramp-kubernetes-namespace)
(tramp-toolbox-program, tramp-distrobox-program)
(tramp-flatpak-program, tramp-apptainer-program)
(tramp-nspawn-program):
* lisp/net/tramp-crypt.el (tramp-crypt-encfs-program)
(tramp-crypt-encfsctl-program, tramp-crypt-encfs-option)
(tramp-crypt-save-encfs-config-remote):
* lisp/net/tramp-fuse.el (tramp-fuse-unmount-on-cleanup):
* lisp/net/tramp-gvfs.el (tramp-gvfs-methods):
* lisp/net/tramp-message.el (tramp-verbose, tramp-debug-to-file)
(tramp-debug-command-messages):
* lisp/net/tramp-rclone.el (tramp-rclone-program):
* lisp/net/tramp-sh.el (tramp-inline-compress-start-size)
(tramp-copy-size-limit, tramp-histfile-override)
(tramp-use-connection-share)
(tramp-use-scp-direct-remote-copying, tramp-sh-extra-args):
* lisp/net/tramp-sshfs.el (tramp-sshfs-program): Add `:link' key.
* lisp/net/tramp.el (tramp-enable-method): Move function ...
* lisp/net/tramp-cmds.el (tramp-enable-method): ... here.
(cherry picked from commit
7e17a1fff401e7cb98a9b140d791957ae3af2451)
@item @option{androidsu}
@cindex method @option{androidsu}
@cindex @option{androidsu} method
+
Because the default implementation of the @option{su} method and other
shell-based methods conflict with non-standard @command{su}
implementations popular among Android users and the restricted
Integration for Docker containers. The host name may be either a
running container's name or ID, as returned by @samp{docker ps}.
+@vindex tramp-docker-program
+If the @command{docker} program isn't found in your @env{PATH}
+environment variable, you can tell @value{tramp} its absolute path via
+the user option @code{tramp-docker-program}.
+
@item @option{podman}
@cindex method @option{podman}
@cindex @option{podman} method
Podman is an alternative to @option{docker} which may be run rootless,
if desired.
+@vindex tramp-podman-program
+If the @command{podman} program isn't found in your @env{PATH}
+environment variable, you can tell @value{tramp} its absolute path via
+the user option @code{tramp-podman-program}.
+
@item @option{kubernetes}
@cindex method @option{kubernetes}
@cindex @option{kubernetes} method
another namespace but the default one. This can also be combined with
the @samp{@var{container}.} prefix.
+@vindex tramp-kubernetes-program
+Internally, @value{tramp} uses the @command{kubectl} program. If this
+program isn't found in your @env{PATH} environment variable, you can
+tell @value{tramp} its absolute path via the user option
+@code{tramp-kubernetes-program}.
+
This method does not support user names.
@item @option{toolbox}
Contrary to the other container-based methods, these two methods start
a created container, if it isn't running yet.
+@vindex tramp-toolbox-program
+@vindex tramp-distrobox-program
+If the @command{toolbox} or @command{distrobox} program isn't found in
+your @env{PATH} environment variable, you can tell @value{tramp} its
+absolute path via the user option @code{tramp-toolbox-program} or
+@code{tramp-distrobox-program}, respectively.
+
These are optional methods, @pxref{Optional methods}. They do not
support user names.
application ID, a sandbox instance ID, or a PID, as returned by
@samp{flatpak ps}.
+@vindex tramp-flatpak-program
+If the @command{flatpak} program isn't found in your @env{PATH}
+environment variable, you can tell @value{tramp} its absolute path via
+the user option @code{tramp-flatpak-program}.
+
This is an optional method, @pxref{Optional methods}. It does not
support user names.
Integration of Apptainer instances. The host name is the instance
name, as returned by @samp{apptainer instance list}.
+@vindex tramp-apptainer-program
+If the @command{apptainer} program isn't found in your @env{PATH}
+environment variable, you can tell @value{tramp} its absolute path via
+the user option @code{tramp-apptainer-program}.
+
This is an optional method, @pxref{Optional methods}. It does not
support user names.
Integration of @code{systemd-nspawn} instances. The host name is the
instance name, as returned by @samp{machinectl list --all}.
+@vindex tramp-nspawn-program
+Internally, @value{tramp} uses the @command{machinectl} program. If this
+program isn't found in your @env{PATH} environment variable, you can
+tell @value{tramp} its absolute path via the user option
+@code{tramp-nspawn-program}.
+
This is an optional method, @pxref{Optional methods}.
@end table
provides a few tweaks to address the most common ones.
@table @asis
-@item @code{tramp-shell-prompt-pattern}
@vindex tramp-shell-prompt-pattern
+@item @code{tramp-shell-prompt-pattern}
@code{tramp-shell-prompt-pattern} is for remote login shell prompt,
which may not be the same as the local login shell prompt,
@code{shell-prompt-pattern}. Since most hosts use identical prompts,
@value{tramp} sets a similar default value for both prompts.
-@item @code{tramp-password-prompt-regexp}
-@item @code{tramp-otp-password-prompt-regexp}
-@item @code{tramp-wrong-passwd-regexp}
@vindex tramp-password-prompt-regexp
@vindex tramp-otp-password-prompt-regexp
@vindex tramp-wrong-passwd-regexp
+@item @code{tramp-password-prompt-regexp}
+@item @code{tramp-otp-password-prompt-regexp}
+@item @code{tramp-wrong-passwd-regexp}
@value{tramp} uses @code{tramp-password-prompt-regexp} to
distinguish between prompts for passwords and prompts for passphrases.
Similar localization may be necessary for handling wrong password
prompts, for which @value{tramp} uses @code{tramp-wrong-passwd-regexp}.
-@item @code{tramp-terminal-type}
@vindex tramp-terminal-type
@vindex TERM@r{, environment variable}
+@item @code{tramp-terminal-type}
@value{tramp} uses the user option @code{tramp-terminal-type} to set
the remote environment variable @env{TERM} for the shells it runs.
@end group
@end lisp
-@item Determining a @value{tramp} session
@vindex TERM@r{, environment variable}
@vindex INSIDE_EMACS@r{, environment variable}
+@item Determining a @value{tramp} session
Sometimes, it is needed to identify whether a shell runs under
@value{tramp} control. The setting of environment variable @env{TERM}
shell-specific config files. For example, bash can use
@file{~/.bash_profile} and ignore @file{.profile}.
-@item Interactive shell prompt
-
@vindex INSIDE_EMACS@r{, environment variable}
@vindex SHELLNAME@r{, environment variable}
@vindex ESHELL@r{, environment variable}
+@item Interactive shell prompt
+
@value{tramp} redefines the remote shell prompt internally for robust
parsing. This redefinition affects the looks of a prompt in an
interactive remote shell through commands, such as @kbd{M-x shell
@itemize @minus
@item
-Variable @code{tramp-use-scp-direct-remote-copying} is non-@code{nil},
+User option @code{tramp-use-scp-direct-remote-copying} is non-@code{nil},
@item
Remote host @samp{source} doesn't use the @option{RemoteCommand}
directory. File and directory names will be also encrypted.
@end deffn
+@defopt tramp-crypt-encfs-program
+This is the name of the @command{encfsctl} program. If it isn't in
+your @env{PATH} environment variable, you can set the absolute path
+here.
+@end defopt
+
@defopt tramp-crypt-encfs-option
If a remote directory is marked for encryption, it is initialized via
@command{encfs} the very first time a file in this directory is
(setq vc-handled-backends '(SVN Git))
@end lisp
-@item
@vindex remote-file-name-inhibit-locks
+@item
Disable file locks. Set @code{remote-file-name-inhibit-locks} to
@code{t} if you know that different Emacs sessions are not modifying
the same remote file.
-@item
@vindex remote-file-name-inhibit-auto-save
+@item
Keep auto-save files local. This is already the default configuration
in Emacs, don't change it. If you want to disable auto-saving for
remote files at all, set @code{remote-file-name-inhibit-auto-save} to
this problem because they allocate a pseudo tty. @xref{Inline
methods}.
+@vindex tramp-chunksize
@item
@value{tramp} stops transferring strings longer than 500 characters
non-@code{nil} value. This transforms the error into a warning.
-@item
-How to ignore errors when changing file attributes?
-
-@vindex tramp-inhibit-errors-if-setting-file-attributes-fail
-Sometimes, for example while saving remote files, errors appear when
-changing file attributes like permissions, time stamps, or ownership.
-If these errors can be ignored, set user option
-@code{tramp-inhibit-errors-if-setting-file-attributes-fail} to a
-non-@code{nil} value. This transforms the error into a warning.
-
-
@item
How to disable other packages from calling @value{tramp}?
(tramp-change-syntax 'simplified)
@end lisp
-@item
@vindex tramp-ignored-file-name-regexp
+@item
To deactivate @value{tramp} for some look-alike remote file names, set
@code{tramp-ignored-file-name-regexp} to a proper regexp in
@file{.emacs}. @strong{Note}, that we don't use
This is needed, if you mount for example a virtual file system on your
local host's root directory as @file{/ssh:example.com:}.
-@item
@findex inhibit-remote-files
+@item
To disable both @value{tramp} (and Ange FTP), type @kbd{M-x
inhibit-remote-files @key{RET}}. You can also add this to your
@file{.emacs}.
(inhibit-remote-files)
@end lisp
-@item
+@vindex tramp-mode
+This command sets the user option @code{tramp-mode} to @code{nil}.
+
@findex without-remote-files
+@item
If you write code, which is intended to run only for local files, you
can use the @code{without-remote-files} macro.
@end lisp
This improves performance, because many primitive file name operations
-don't check any longer for @value{tramp} file name regexps then.
+don't check any longer for @value{tramp} file name regexps then. The
+macro binds the user option @code{tramp-mode} to @code{nil}.
-@item
@findex tramp-unload-tramp
+@item
To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp @key{RET}}.
Unloading @value{tramp} resets Ange FTP plugins also.
@end itemize
"Name of the Android Debug Bridge program."
:group 'tramp
:version "24.4"
- :type 'string)
+ :type '(choice (const "adb")
+ (string))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-adb-program))
(defcustom tramp-adb-connect-if-not-connected nil
"Try to run `adb connect' if provided device is not connected currently.
It is used for TCP/IP devices."
:group 'tramp
:version "25.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(tramp-info-link :tag "Tramp manual"
+ tramp-adb-connect-if-not-connected))
;;;###tramp-autoload
(defconst tramp-adb-method "adb"
:version "24.4"
:type '(repeat (list (choice :tag "File Name regexp" regexp (const nil))
(choice :tag " Property" string)
- (choice :tag " Value" sexp))))
+ (choice :tag " Value" sexp)))
+ :link '(info-link :tag "Tramp manual"
+ "(tramp) Predefined connection information"))
;;;###tramp-autoload
(defcustom tramp-persistency-file-name (locate-user-emacs-file "tramp")
"File which keeps connection history for Tramp connections."
:group 'tramp
- :type 'file)
+ :type 'file
+ :link '(info-link :tag "Tramp manual" "(tramp) Connection caching"))
;;;###tramp-autoload
(defconst tramp-cache-version (make-tramp-file-name :method "cache")
your laptop to different networks frequently."
:group 'tramp
:version "29.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(tramp-info-link :tag "Tramp manual" tramp-completion-use-cache))
;;;###tramp-autoload
(defun tramp-parse-connection-properties (method)
(when syntax
(customize-set-variable 'tramp-syntax syntax)))
+;;;###tramp-autoload
+(defun tramp-enable-method (method)
+ "Enable optional METHOD if possible."
+ (interactive
+ (list
+ (let ((methods nil))
+ (mapatoms (lambda (sym)
+ (when-let ((fboundp sym)
+ (name (symbol-name sym))
+ ;; It must match `tramp-enable-METHOD-method'.
+ ((string-match
+ (rx "tramp-enable-"
+ (group (regexp tramp-method-regexp))
+ "-method")
+ name))
+ (method (match-string 1 name)))
+ (push method methods))))
+ (completing-read "Enable Tramp method: " methods
+ (lambda (method)
+ (not (assoc method tramp-methods)))))))
+ (when-let (((not (assoc method tramp-methods)))
+ (fn (intern (format "tramp-enable-%s-method" method)))
+ ((functionp fn)))
+ (funcall fn)
+ (message "Tramp method \"%s\" enabled" method)))
+
+(put 'tramp-enable-method 'minibuffer-action "enable")
+
;; Use `match-buffers' starting with Emacs 29.1.
;;;###tramp-autoload
(defun tramp-list-tramp-buffers ()
buffer. KEEP-PASSWORD non-nil preserves the password cache.
KEEP-PROCESSES non-nil preserves the asynchronous processes.
When called interactively, a Tramp connection has to be selected."
+ (declare (completion tramp-active-command-completion-p))
(interactive
;; When interactive, select the Tramp remote identification.
;; Return nil when there is no Tramp connection.
(defun tramp-cleanup-all-connections ()
"Flush all Tramp internal objects.
This includes password cache, file cache, connection cache, buffers."
+ (declare (completion tramp-active-command-completion-p))
(interactive)
;; Flush password cache.
functions are called with `current-buffer' set."
:group 'tramp
:version "30.1"
- :type 'hook)
+ :type 'hook
+ :link '(info-link :tag "Tramp manual" "(tramp) Cleanup remote connections"))
(add-hook 'tramp-cleanup-some-buffers-hook
#'buffer-file-name)
A buffer is killed when it has a remote `default-directory', and
one of the functions in `tramp-cleanup-some-buffers-hook' returns
non-nil."
+ (declare (completion tramp-active-command-completion-p))
(interactive)
;; Remove all Tramp related connections.
;;;###tramp-autoload
(defun tramp-cleanup-all-buffers ()
"Kill all remote buffers."
+ (declare (completion tramp-active-command-completion-p))
(interactive)
(let ((tramp-cleanup-some-buffers-hook '(always)))
(tramp-cleanup-some-buffers)))
:group 'tramp
:version "27.1"
:type '(repeat (cons (choice :tag "Source regexp" regexp sexp)
- (choice :tag "Target name" string (const nil)))))
+ (choice :tag "Target name" string (const nil))))
+ :link '(info-link :tag "Tramp manual" "(tramp) Renaming remote files"))
(defcustom tramp-confirm-rename-file-names t
"Whether renaming a buffer file name must be confirmed."
:group 'tramp
:version "27.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(info-link :tag "Tramp manual" "(tramp) Renaming remote files"))
(defun tramp-default-rename-file (string)
"Determine default file name for renaming according to STRING.
The remote connection identified by SOURCE is flushed by
`tramp-cleanup-connection'."
+ (declare (completion tramp-active-command-completion-p))
(interactive
(let ((connections
(mapcar #'tramp-make-tramp-file-name (tramp-list-connections)))
(const "sudo")
(const "doas")
(const "run0")
- (const "ksu")))
+ (const "ksu"))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-file-name-with-method))
(defun tramp-file-name-with-sudo (filename)
"Convert FILENAME into a multi-hop file name with \"sudo\".
:group 'tramp
:version "29.1"
:type '(choice (const "docker")
- (string)))
+ (string))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-docker-program))
;;;###tramp-autoload
(defcustom tramp-podman-program "podman"
:group 'tramp
:version "29.1"
:type '(choice (const "podman")
- (string)))
+ (string))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-podman-program))
;;;###tramp-autoload
(defcustom tramp-kubernetes-program "kubectl"
:group 'tramp
:version "29.1"
:type '(choice (const "kubectl")
- (string)))
+ (string))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-kubernetes-program))
(defcustom tramp-kubernetes-context nil
"Context of Kubernetes.
:group 'tramp
:version "30.1"
:type '(choice (const :tag "Use default" nil)
- (string)))
+ (string))
+ :link '(info-link :tag "Tramp manual" "(tramp) Kubernetes setup"))
(defcustom tramp-kubernetes-namespace nil
"Namespace of Kubernetes.
:group 'tramp
:version "31.1"
:type '(choice (const :tag "Use default" nil)
- (string)))
+ (string))
+ :link '(info-link :tag "Tramp manual" "(tramp) Kubernetes setup"))
;;;###tramp-autoload
(defcustom tramp-toolbox-program "toolbox"
:group 'tramp
:version "30.1"
:type '(choice (const "toolbox")
- (string)))
+ (string))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-toolbox-program))
;;;###tramp-autoload
(defcustom tramp-distrobox-program "distrobox"
:group 'tramp
:version "30.1"
:type '(choice (const "distrobox")
- (string)))
+ (string))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-distrobox-program))
;;;###tramp-autoload
(defcustom tramp-flatpak-program "flatpak"
:group 'tramp
:version "30.1"
:type '(choice (const "flatpak")
- (string)))
+ (string))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-flatpak-program))
;;;###tramp-autoload
(defcustom tramp-apptainer-program "apptainer"
:group 'tramp
:version "30.1"
:type '(choice (const "apptainer")
- (string)))
+ (string))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-apptainer-program))
(defcustom tramp-nspawn-program "machinectl"
"Name of the machinectl program."
:group 'tramp
:version "30.1"
:type '(choice (const "machinectl")
- (string)))
+ (string))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-nspawn-program))
;;;###tramp-autoload
(defconst tramp-docker-method "docker"
"Name of the encfs program."
:group 'tramp
:version "28.1"
- :type 'string)
+ :type 'string
+ :link '(info-link :tag "Tramp manual" "(tramp) Keeping files encrypted"))
(defcustom tramp-crypt-encfsctl-program "encfsctl"
"Name of the encfsctl program."
:group 'tramp
:version "28.1"
- :type 'string)
+ :type 'string
+ :link '(info-link :tag "Tramp manual" "(tramp) Keeping files encrypted"))
(defcustom tramp-crypt-encfs-option "--standard"
"Configuration option for encfs.
:group 'tramp
:version "28.1"
:type '(choice (const "--standard")
- (const "--paranoia")))
+ (const "--paranoia"))
+ :link '(info-link :tag "Tramp manual" "(tramp) Keeping files encrypted"))
;; We check only for encfs, assuming that encfsctl will be available
;; as well. The autoloaded value is nil, the check will run when
"Whether to keep the encfs configuration file in the encrypted remote directory."
:group 'tramp
:version "28.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(info-link :tag "Tramp manual" "(tramp) Keeping files encrypted"))
;;;###tramp-autoload
(defvar tramp-crypt-directories nil
"Whether fuse volumes shall be unmounted on cleanup."
:group 'tramp
:version "28.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(info-link :tag "Tramp manual" "(tramp) FUSE setup"))
(defun tramp-fuse-cleanup (vec)
"Cleanup fuse volume determined by VEC."
(const "mtp")
(const "nextcloud")
(const "sftp")
- (const "smb"))))
+ (const "smb")))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-gvfs-methods))
;;;###tramp-autoload
(defconst tramp-goa-methods '("gdrive" "nextcloud")
(delete (info-lookup->mode-cache 'symbol ',mode)
(info-lookup->topic-cache 'symbol))))))))
+;;; Integration of new `:link' type in `defcustom':
+
+(define-widget 'tramp-info-link 'link
+ "A link to the Tramp info file."
+ :action 'tramp-widget-info-link-action)
+
+(defun tramp-widget-info-link-action (widget &optional _event)
+ "Open the info node specified by WIDGET.
+It's value must be a Tramp user option, indexed in the Tramp manual via
+`@vindex'."
+ (let* ((topic (widget-value widget))
+ (pattern
+ (rx "\n*" (1+ " ") (0+ nonl)
+ (literal (if (stringp topic) topic (symbol-name topic)))
+ (0+ nonl) ":" (1+ (any "\t "))
+ (group (0+ nonl))
+ "." (0+ (any "\t\n ")) "(line" (1+ " ")
+ (group (1+ digit))
+ ")")))
+ (info "(tramp) Variable Index")
+ (goto-char (point-min))
+ (when (re-search-forward pattern nil t)
+ (let ((nodename (concat "(tramp) " (match-string-no-properties 1)))
+ (line (string-to-number (match-string 2))))
+ (info nodename)
+ (forward-line (- line 2))))))
+
;;; Integration of shortdoc.el:
(tramp--with-startup
10 traces (huge)
11 call traces (maintainer only)."
:group 'tramp
- :type 'integer)
+ :type 'integer
+ :link '(info-link :tag "Tramp manual" "(tramp) Traces and Profiles"))
(defcustom tramp-debug-to-file nil
"Whether Tramp debug messages shall be saved to file.
`tramp-compat-temporary-file-directory'."
:group 'tramp
:version "28.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(info-link :tag "Tramp manual" "(tramp) Traces and Profiles"))
(defcustom tramp-debug-command-messages nil
"Whether to write only command messages to the debug buffer.
This increases `tramp-verbose' to 6 if necessary."
:group 'tramp
:version "30.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(info-link :tag "Tramp manual" "(tramp) Traces and Profiles"))
(defconst tramp-debug-outline-regexp
(rx ;; Timestamp.
(defun tramp-setup-debug-buffer ()
"Function to setup debug buffers."
- (declare (tramp-suppress-trace t))
- ;; (declare (completion tramp-debug-buffer-command-completion-p)
- ;; (tramp-suppress-trace t))
+ (declare (completion tramp-debug-buffer-command-completion-p)
+ (tramp-suppress-trace t))
(interactive)
(set-buffer-file-coding-system 'utf-8)
(setq buffer-undo-list t)
(local-set-key "\M-n" 'clone-buffer)
(add-hook 'clone-buffer-hook #'tramp-setup-debug-buffer nil 'local))
-(function-put
- #'tramp-setup-debug-buffer 'completion-predicate
- #'tramp-debug-buffer-command-completion-p)
-
(defun tramp-debug-buffer-name (vec)
"A name for the debug buffer of VEC."
(declare (tramp-suppress-trace t))
"Name of the rclone program."
:group 'tramp
:version "27.1"
- :type 'string)
+ :type 'string
+ :link '(info-link :tag "Tramp manual" "(tramp) Setup of rclone method"))
;;;###tramp-autoload
(tramp--with-startup
out-of-band methods).
If it is nil, no compression at all will be applied."
:group 'tramp
- :type '(choice (const nil) integer))
+ :type '(choice (const nil) integer)
+ :link '(info-link :tag "Tramp manual" "(tramp) Inline methods"))
(defcustom tramp-copy-size-limit 10240
"Maximum file size where inline copying is preferred to an out-of-the-band copy.
If it is nil, out-of-the-band copy will be used without a check."
:group 'tramp
- :type '(choice (const nil) integer))
+ :type '(choice (const nil) integer)
+ :link '(info-link :tag "Tramp manual" "(tramp) External methods"))
;;;###tramp-autoload
(defcustom tramp-histfile-override "~/.tramp_history"
:version "25.2"
:type '(choice (const :tag "Do not override HISTFILE" nil)
(const :tag "Unset HISTFILE" t)
- (string :tag "Redirect to a file")))
+ (string :tag "Redirect to a file"))
+ :link '(info-link :tag "Tramp manual" "(tramp) Managing remote shell history"))
(put 'tramp-histfile-override 'permanent-local t)
(const :tag "Don't set ControlMaster" nil)
(const :tag "Suppress ControlMaster" suppress))
;; Check with (safe-local-variable-p 'tramp-use-connection-share 'suppress)
- :safe (lambda (val) (and (memq val '(t nil suppress)) t)))
+ :safe (lambda (val) (and (memq val '(t nil suppress)) t))
+ :link '(info-link :tag "Tramp manual" "(tramp) Using ssh connection sharing"))
(defvar tramp-ssh-controlmaster-options nil
"Which ssh Control* arguments to use.
"Whether to use direct copying between two remote hosts."
:group 'tramp
:version "29.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(tramp-info-link :tag "Tramp manual"
+ tramp-use-scp-direct-remote-copying))
;; Initialize `tramp-methods' with the supported methods.
;;;###tramp-autoload
shell from reading its init file."
:group 'tramp
:version "30.1"
- :type '(alist :key-type regexp :value-type string))
+ :type '(alist :key-type regexp :value-type string)
+ :link '(info-link :tag "Tramp manual" "(tramp) Remote shell setup"))
;;;###tramp-autoload
(defconst tramp-actions-before-shell
"The sshfs mount command."
:group 'tramp
:version "28.1"
- :type 'string)
+ :type 'string
+ :link '(info-link :tag "Tramp manual" "(tramp) Setup of sshfs method"))
;;;###tramp-autoload
(defvar tramp-default-remote-shell) ;; Silence byte compiler.
:group 'files
:group 'comm
:version "22.1"
- :link '(custom-manual "(tramp)Top"))
+ :link '(info-link :tag "Tramp manual" "(tramp) Top"))
;; Maybe we need once a real Tramp mode, with key bindings etc.
;;;###autoload
(defcustom tramp-mode t
"Whether Tramp is enabled.
-If it is set to nil, all remote file names are used literally."
- :type 'boolean)
+If it is set to nil, all remote file names are used literally. Don't
+set it manually, use `inhibit-remote-files' or `without-remote-files'
+instead."
+ :type 'boolean
+ :link '(tramp-info-link :tag "Tramp manual" tramp-mode)
+ :link '(info-link :tag "Emacs manual" "(emacs) Remote Files")
+ :link '(info-link :tag "Elisp manual" "(elisp) Magic File Names"))
(defcustom tramp-backup-directory-alist nil
"Alist of filename patterns and backup directory names.
gives the same backup policy for Tramp files on their hosts like the
policy for local files."
:type '(repeat (cons (regexp :tag "Regexp matching filename")
- (directory :tag "Backup directory name"))))
+ (directory :tag "Backup directory name")))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-backup-directory-alist))
(defcustom tramp-auto-save-directory nil
"Put auto-save files in this directory, if set.
The idea is to use a local directory so that auto-saving is faster.
This setting has precedence over `auto-save-file-name-transforms'."
:type '(choice (const :tag "Use default" nil)
- (directory :tag "Auto save directory name")))
+ (directory :tag "Auto save directory name"))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-auto-save-directory))
;; Suppress `shell-file-name' for w32 systems.
(defcustom tramp-encoding-shell
Note that this variable is not used for remote commands. There are
mechanisms in tramp.el which automatically determine the right shell to
use for the remote host."
- :type '(file :must-match t))
+ :type '(file :must-match t)
+ :link '(info-link :tag "Tramp manual" "(tramp) Remote shell setup"))
;; Suppress `shell-file-name' for w32 systems.
(defcustom tramp-encoding-command-switch
(if (tramp-compat-funcall 'w32-shell-dos-semantics) "/c" "-c"))
"Use this switch together with `tramp-encoding-shell' for local commands.
See the variable `tramp-encoding-shell' for more information."
- :type 'string)
+ :type 'string
+ :link '(info-link :tag "Tramp manual" "(tramp) Remote shell setup"))
;; Suppress `shell-file-name' for w32 systems.
(defcustom tramp-encoding-command-interactive
"Use this switch together with `tramp-encoding-shell' for interactive shells.
See the variable `tramp-encoding-shell' for more information."
:version "24.1"
- :type '(choice (const nil) string))
+ :type '(choice (const nil) string)
+ :link '(info-link :tag "Tramp manual" "(tramp) Remote shell setup"))
;; Since Emacs 26.1, `system-name' can return nil at build time if
;; Emacs is compiled with "--no-build-details". We do expect it to be
"Default method to use for transferring files.
See `tramp-methods' for possibilities.
Also see `tramp-default-method-alist'."
- :type 'string)
+ :type 'string
+ :link '(info-link :tag "Tramp manual" "(tramp) Default Method"))
;;;###tramp-autoload
(defcustom tramp-default-method-alist nil
See `tramp-methods' for a list of possibilities for METHOD."
:type '(repeat (list (choice :tag "Host regexp" regexp sexp)
(choice :tag "User regexp" regexp sexp)
- (choice :tag "Method name" string (const nil)))))
+ (choice :tag "Method name" string (const nil))))
+ :link '(info-link :tag "Tramp manual" "(tramp) Default Method"))
(defconst tramp-default-method-marker "-"
"Marker for default method in remote file names.")
"Default user to use for transferring files.
It is nil by default; otherwise settings in configuration files like
\"~/.ssh/config\" would be overwritten. Also see `tramp-default-user-alist'."
- :type '(choice (const nil) string))
+ :type '(choice (const nil) string)
+ :link '(info-link :tag "Tramp manual" "(tramp) Default User"))
;;;###tramp-autoload
(defcustom tramp-default-user-alist nil
empty string for the method name."
:type '(repeat (list (choice :tag "Method regexp" regexp sexp)
(choice :tag " Host regexp" regexp sexp)
- (choice :tag " User name" string (const nil)))))
+ (choice :tag " User name" string (const nil))))
+ :link '(info-link :tag "Tramp manual" "(tramp) Default User"))
(defcustom tramp-default-host tramp-system-name
"Default host to use for transferring files.
Useful for su and sudo methods mostly."
- :type 'string)
+ :type 'string
+ :link '(info-link :tag "Tramp manual" "(tramp) Default Host"))
;;;###tramp-autoload
(defcustom tramp-default-host-alist nil
:version "24.4"
:type '(repeat (list (choice :tag "Method regexp" regexp sexp)
(choice :tag " User regexp" regexp sexp)
- (choice :tag " Host name" string (const nil)))))
+ (choice :tag " Host name" string (const nil))))
+ :link '(info-link :tag "Tramp manual" "(tramp) Default Host"))
(defcustom tramp-default-proxies-alist nil
;; FIXME: This is not an "alist", because its elements are not of
interpreted as a regular expression which always matches."
:type '(repeat (list (choice :tag "Host regexp" regexp sexp)
(choice :tag "User regexp" regexp sexp)
- (choice :tag " Proxy name" string (const nil)))))
+ (choice :tag " Proxy name" string (const nil))))
+ :link '(info-link :tag "Tramp manual" "(tramp) Multi-hops"))
(defcustom tramp-save-ad-hoc-proxies nil
"Whether to save ad-hoc proxies persistently."
:version "24.3"
- :type 'boolean)
+ :type 'boolean
+ :link '(info-link :tag "Tramp manual" "(tramp) Ad-hoc multi-hops"))
(defcustom tramp-show-ad-hoc-proxies nil
"Whether to show ad-hoc proxies in file names."
:version "29.2"
- :type 'boolean)
+ :type 'boolean
+ :link '(info-link :tag "Tramp manual" "(tramp) Ad-hoc multi-hops"))
;; For some obscure technical reasons, `system-name' on w32 returns
;; either lower case or upper case letters. See
proxies only, see `tramp-default-proxies-alist'. If the local
host runs a restricted shell, it shall be added to this list, too."
:version "27.1"
- :type '(repeat (regexp :tag "Host regexp")))
+ :type '(repeat (regexp :tag "Host regexp"))
+ :link '(info-link :tag "Tramp manual" "(tramp) Multi-hops"))
;;;###tramp-autoload
(defcustom tramp-local-host-regexp
If the local host runs a chrooted environment, set this to nil."
:version "30.1"
:type '(choice (const :tag "Chrooted environment" nil)
- (regexp :tag "Host regexp")))
+ (regexp :tag "Host regexp"))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-local-host-regexp))
(defvar tramp-completion-function-alist nil
"Alist of methods for remote files.
This regexp must match both `tramp-initial-end-of-output' and
`tramp-end-of-output'."
- :type 'regexp)
+ :type 'regexp
+ :link '(tramp-info-link :tag "Tramp manual" tramp-shell-prompt-pattern))
(defcustom tramp-password-prompt-regexp
(rx-to-string
The `sudo' program appears to insert a `^@' character into the prompt."
:version "29.1"
- :type 'regexp)
+ :type 'regexp
+ :link '(tramp-info-link :tag "Tramp manual" tramp-password-prompt-regexp))
(defcustom tramp-otp-password-prompt-regexp
(rx-to-string
"Regexp matching one-time password prompts.
The regexp should match at end of buffer."
:version "29.2"
- :type 'regexp)
+ :type 'regexp
+ :link '(tramp-info-link :tag "Tramp manual" tramp-otp-password-prompt-regexp))
(defcustom tramp-wrong-passwd-regexp
(rx bol (* nonl)
(* nonl))
"Regexp matching a `login failed' message.
The regexp should match at end of buffer."
- :type 'regexp)
+ :type 'regexp
+ :link '(tramp-info-link :tag "Tramp manual" tramp-wrong-passwd-regexp))
(defcustom tramp-yesno-prompt-regexp
(rx "Are you sure you want to continue connecting (yes/no"
confused by ANSI control escape sequences and suchlike. Often, shell init
files conditionalize this setup based on the TERM environment variable."
:group 'tramp
- :type 'string)
+ :type 'string
+ :link '(tramp-info-link :tag "Tramp manual" tramp-terminal-type))
(defcustom tramp-terminal-prompt-regexp
(rx (| (: "TERM = (" (* nonl) ")")
(const :tag "XEmacs" separate))
:require 'tramp
:initialize #'custom-initialize-default
- :set #'tramp-set-syntax)
+ :set #'tramp-set-syntax
+ :link '(info-link :tag "Tramp manual" "(tramp) Change file name syntax"))
(defun tramp-set-syntax (symbol value)
"Set SYMBOL to value VALUE.
(defcustom tramp-ignored-file-name-regexp nil
"Regular expression matching file names that are not under Tramp's control."
:version "27.1"
- :type '(choice (const nil) regexp))
+ :type '(choice (const nil) regexp)
+ :link '(tramp-info-link :tag "Tramp manual" tramp-ignored-file-name-regexp))
(defconst tramp-volume-letter-regexp
(if (eq system-type 'windows-nt)
Please raise a bug report via \\[tramp-bug] if your system needs
this variable to be set as well."
- :type '(choice (const nil) integer))
+ :type '(choice (const nil) integer)
+ :link '(tramp-info-link :tag "Tramp manual" tramp-chunksize))
;; Logging in to a remote host normally requires obtaining a pty. But
;; Emacs on macOS has `process-connection-type' set to nil by default,
"Overrides `process-connection-type' for connections from Tramp.
Tramp binds `process-connection-type' to the value given here before
opening a connection to a remote host."
- :type '(choice (const nil) (const t) (const pipe) (const pty)))
+ :type '(choice (const nil) (const t) (const pipe) (const pty))
+ :link '(tramp-info-link :tag "Tramp manual" tramp-process-connection-type))
(defcustom tramp-connection-timeout 60
"Defines the max time to wait for establishing a connection (in seconds).
:type '(repeat (choice
(const :tag "Default Directories" tramp-default-remote-path)
(const :tag "Private Directories" tramp-own-remote-path)
- (string :tag "Directory"))))
+ (string :tag "Directory")))
+ :link '(info-link :tag "Tramp manual" "(tramp) Remote programs"))
(defcustom tramp-remote-process-environment
'("ENV=''" "TMOUT=0" "LC_CTYPE=''"
The INSIDE_EMACS environment variable will automatically be set
based on the Tramp and Emacs versions, and should not be set here."
:version "26.1"
- :type '(repeat string))
+ :type '(repeat string)
+ :link '(info-link :tag "Tramp manual" "(tramp) Remote processes"))
;;; Internal Variables:
;;; Internal functions which must come first:
-(defun tramp-enable-method (method)
- "Enable optional METHOD if possible."
- (interactive
- (list
- (let ((methods nil))
- (mapatoms (lambda (sym)
- (when-let ((fboundp sym)
- (name (symbol-name sym))
- ;; It must match `tramp-enable-METHOD-method'.
- ((string-match
- (rx "tramp-enable-"
- (group (regexp tramp-method-regexp))
- "-method")
- name))
- (method (match-string 1 name)))
- (push method methods))))
- (completing-read "Enable Tramp method: " methods
- (lambda (method)
- (not (assoc method tramp-methods)))))))
- (when-let (((not (assoc method tramp-methods)))
- (fn (intern (format "tramp-enable-%s-method" method)))
- ((functionp fn)))
- (funcall fn)
- (message "Tramp method \"%s\" enabled" method)))
-
-(put 'tramp-enable-method 'minibuffer-action "enable")
-
;; Conversion functions between external representation and
;; internal data structure. Convenience functions for internal
;; data structure.
They are completed by `M-x TAB' only if the current buffer is remote."
(tramp-tramp-file-p (tramp-get-default-directory buffer)))
+;; This function takes action, when `read-extended-command-predicate'
+;; is set to `command-completion-default-include-p'.
+;;;###tramp-autoload
+(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))
+ (or (and (hash-table-p tramp-cache-data)
+ (not (zerop (hash-table-count tramp-cache-data))))
+ (tramp-list-remote-buffers)))
+
(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
(defcustom tramp-completion-multi-hop-methods nil
"Methods for which to provide completions over multi-hop connections."
:version "30.1"
- :type '(repeat (string :tag "Method name")))
+ :type '(repeat (string :tag "Method name"))
+ :link '(info-link :tag "Tramp manual" "(tramp) Ad-hoc multi-hops"))
(defcustom tramp-completion-use-auth-sources auth-source-do-cache
"Whether to use `auth-source-search' for completion of user and host names.
This could be disturbing, if it requires a password / passphrase,
as for \"~/.authinfo.gpg\"."
:version "27.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(info-link :tag "Tramp manual" "(tramp) File name completion"))
(defun tramp-parse-auth-sources (method)
"Return a list of (user host) tuples allowed to access for METHOD.
`ls', is not sufficient to provide more fine-grained information.
This variable is intended as connection-local variable."
:version "30.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(tramp-info-link :tag "Tramp manual" tramp-use-file-attributes))
(defsubst tramp-use-file-attributes (vec)
"Whether to use \"file-attributes\" file property for check."
(defcustom tramp-inhibit-errors-if-setting-file-attributes-fail nil
"Whether to warn only if `tramp-*-set-file-{modes,times,uid-gid}' fails."
:version "30.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(tramp-info-link :tag "Tramp manual"
+ tramp-inhibit-errors-if-setting-file-attributes-fail))
(defmacro tramp-skeleton-set-file-modes-times-uid-gid
(filename &rest body)
(defcustom tramp-allow-unsafe-temporary-files nil
"Whether root-owned auto-save, backup or lock files can be written to \"/tmp\"."
:version "28.1"
- :type 'boolean)
+ :type 'boolean
+ :link '(tramp-info-link :tag "Tramp manual"
+ tramp-allow-unsafe-temporary-files))
(defun tramp-handle-find-backup-file-name (filename)
"Like `find-backup-file-name' for Tramp files."