* doc/misc/tramp.texi: Replace flags by their hard coded name.
Remove unused flags and the enclosed alternative text for XEmacs.
* doc/misc/trampver.texi: Use "Tramp" CamelCase. Rename "emacs"
and "xemacs" flags to "unified" and "separate". Remove flags
"emacsgw", "emacsname", "emacsdir", "ftppackagename",
"emacsothername", "emacsotherdir" and "emacsotherfilename".
(trampver):
* lisp/net/trampver.el (tramp-version): Set to "2.3.0-pre".
* lisp/net/tramp.el (bkup-backup-directory-info)
(directory-sep-char, ls-lisp-use-insert-directory-program)
(outline-regexp, tramp-backup-directory-alist)
(tramp-default-method, tramp-shell-prompt-pattern, tramp-syntax)
(tramp-file-name-regexp-unified)
(tramp-file-name-regexp-separate)
(tramp-completion-file-name-regexp-unified)
(tramp-completion-file-name-regexp-separate, tramp-chunksize)
(tramp-get-method-parameter, tramp-find-method, tramp-find-user)
(tramp-debug-message, tramp-progress-reporter-update)
(with-tramp-progress-reporter)
(tramp-rfn-eshadow-setup-minibuffer)
(rfn-eshadow-setup-minibuffer-hook, tramp-unload-hook)
(tramp-rfn-eshadow-update-overlay)
(rfn-eshadow-update-overlay-hook, tramp-default-file-modes)
(tramp-file-name-for-operation)
(tramp-completion-file-name-handler)
(tramp-autoload-file-name-handler, tramp-completion-mode-p)
(tramp-handle-directory-files)
(tramp-handle-directory-files-and-attributes)
(tramp-handle-dired-uncache, tramp-handle-find-backup-file-name)
(tramp-handle-insert-file-contents, tramp-handle-load)
(tramp-handle-shell-command)
(tramp-handle-verify-visited-file-modtime)
(tramp-handle-file-notify-valid-p, tramp-accept-process-output)
(tramp-check-for-regexp, tramp-wait-for-regexp)
(tramp-send-string, tramp-mode-string-to-int)
(tramp-get-local-gid, tramp-check-cached-permissions)
(tramp-get-remote-tmpdir, tramp-make-tramp-temp-file)
(auto-save-file-name-transforms)
(tramp-handle-make-auto-save-file-name, tramp-read-passwd)
(tramp-clear-passwd, tramp-time-diff):
* lisp/net/tramp-adb.el (directory-listing-before-filename-regexp)
(directory-sep-char, tramp-adb-file-name-handler-alist)
(tramp-adb-parse-device-names)
(tramp-adb-handle-expand-file-name)
(tramp-adb-handle-file-truename, tramp-adb--gnu-switches-to-ash)
(tramp-adb-handle-file-local-copy)
(tramp-adb-handle-write-region, tramp-adb-handle-set-file-modes)
(tramp-adb-handle-rename-file, tramp-adb-handle-process-file)
(tramp-adb-handle-shell-command)
(tramp-adb-handle-start-file-process, tramp-adb-get-device)
(tramp-adb-maybe-open-connection):
* lisp/net/tramp-cache.el (tramp-persistency-file-name)
(tramp-cache-print):
* lisp/net/tramp-cmds.el (tramp-cleanup-all-connections)
(tramp-bug, tramp-reporter-dump-variable)
(tramp-load-report-modules, tramp-append-tramp-buffers):
* lisp/net/tramp-compat.el (tramp-compat-funcall)
(tramp-advice-file-expand-wildcards)
(tramp-compat-temporary-file-directory)
(tramp-compat-make-temp-file, tramp-compat-copy-file)
(tramp-compat-delete-directory, )
(tramp-compat-process-running-p):
* lisp/net/tramp-ftp.el (tramp-methods) <ftp>:
(tramp-default-method-alist, tramp-foreign-file-name-handler-alist):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist)
(tramp-gvfs-do-copy-or-rename-file, tramp-gvfs-handle-copy-file)
(tramp-gvfs-handle-file-local-copy)
(tramp-gvfs-handle-file-name-all-completions)
(tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-file-process-filter)
(tramp-gvfs-handle-file-readable-p)
(tramp-gvfs-handle-rename-file, tramp-gvfs-handle-write-region)
(tramp-gvfs-file-name, tramp-gvfs-handler-askquestion)
(tramp-gvfs-maybe-open-connection)
(tramp-gvfs-parse-device-names):
* lisp/net/tramp-gw.el (tramp-gw-aux-proc-sentinel)
(tramp-gw-open-connection, tramp-gw-open-network-stream):
* lisp/net/tramp-sh.el (directory-sep-char)
(tramp-sh-file-name-handler-alist)
(tramp-sh-handle-file-truename)
(tramp-sh-handle-set-visited-file-modtime)
(tramp-sh-handle-verify-visited-file-modtime)
(tramp-sh-handle-set-file-modes, tramp-sh-handle-set-file-times)
(tramp-sh-handle-file-acl)
(tramp-sh-handle-file-name-all-completions)
(tramp-sh-handle-copy-file, tramp-sh-handle-rename-file)
(tramp-do-copy-or-rename-file-directly)
(tramp-do-copy-or-rename-file-out-of-band)
(dired-compress-file-suffixes, dired-remove-file)
(tramp-sh-handle-dired-compress-file)
(tramp-sh-handle-insert-directory)
(tramp-sh-handle-expand-file-name)
(tramp-sh-handle-start-file-process)
(tramp-sh-handle-process-file, tramp-sh-handle-file-local-copy)
(tramp-sh-handle-write-region, tramp-sh-handle-vc-registered)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gvfs-monitor-dir-process-filter)
(tramp-sh-inotifywait-process-filter, tramp-maybe-send-script)
(tramp-find-executable)
(tramp-open-connection-setup-interactive-shell)
(tramp-find-inline-encoding, tramp-compute-multi-hops)
(tramp-maybe-open-connection, tramp-convert-file-attributes)
(tramp-get-remote-path, tramp-get-remote-touch):
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist)
(tramp-smb-handle-copy-directory, tramp-smb-handle-copy-file)
(tramp-smb-handle-delete-directory)
(tramp-smb-handle-directory-files, tramp-smb-handle-file-acl)
(tramp-smb-handle-make-directory-internal)
(tramp-smb-handle-process-file, tramp-smb-handle-rename-file)
(tramp-smb-handle-set-file-acl, tramp-smb-handle-set-file-modes)
(tramp-smb-handle-write-region, tramp-smb-get-file-entries)
(tramp-smb-get-cifs-capabilities)
(tramp-smb-maybe-open-connection):
* lisp/net/trampver.el (tramp-repository-get-version):
Remove XEmacs compat code.
* lisp/net/tramp-cmds.el (mml-mode, mml-insert-empty-tag)
(reporter-dump-variable): Declare functions.
* lisp/net/tramp.el (tramp-bkup-backup-directory-info)
(tramp-advice-minibuffer-electric-separator)
(tramp-advice-minibuffer-electric-tilde)
(tramp-handle-unhandled-file-name-directory):
* lisp/net/tramp-compat.el (tramp-compat-with-temp-message)
(tramp-compat-font-lock-add-keywords)
(tramp-compat-load, tramp-compat-number-sequence)
(tramp-compat-split-string, tramp-compat-delete-dups):
* lisp/net/tramp-sh.el (tramp-sh-handle-insert-file-contents-literally):
Remove.
* lisp/net/tramp-sh.el (tramp-methods) <psftp>: This does not work
recursively.
@end copying
@c Entries for @command{install-info} to use
-@dircategory @value{emacsname} network features
+@dircategory Emacs network features
@direntry
* TRAMP: (tramp). Transparent Remote Access, Multiple Protocol
- @value{emacsname} remote file access via ssh and scp.
+ Emacs remote file access via ssh and scp.
@end direntry
@titlepage
@top @value{tramp} version @value{trampver} User Manual
This file documents @value{tramp} version @value{trampver}, a remote file
-editing package for @value{emacsname}.
+editing package for Emacs.
@value{tramp} stands for ``Transparent Remote (file) Access, Multiple
Protocol''. This package provides remote file editing, similar to
-@value{ftppackagename}.
+Ange FTP.
-The difference is that @value{ftppackagename} uses FTP to transfer
-files between the local and the remote host, whereas @value{tramp} uses a
-combination of @command{rsh} and @command{rcp} or other work-alike
-programs, such as @command{ssh}/@command{scp}.
+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
+@command{rsh} and @command{rcp} or other work-alike programs, such as
+@command{ssh}/@command{scp}.
You can find the latest version of this document on the web at
@uref{http://www.gnu.org/software/tramp/}.
-@c Pointer to the other Emacs flavor is necessary only in case of
-@c standalone installation.
-@ifset installchapter
-The manual has been generated for @value{emacsname}.
-@ifinfo
-If you want to read the info pages for @value{emacsothername}, you
-should read in @ref{Installation} how to create them.
-@end ifinfo
-@ifhtml
-If you're using the other Emacs flavor, you should read the
-@uref{@value{emacsotherfilename}, @value{emacsothername}} pages.
-@end ifhtml
-@end ifset
-
@ifhtml
The latest release of @value{tramp} is available for
@uref{ftp://ftp.gnu.org/gnu/tramp/, download}, or you may see
* Obtaining Tramp:: How to obtain @value{tramp}.
* History:: History of @value{tramp}.
@ifset installchapter
-* Installation:: Installing @value{tramp} with your @value{emacsname}.
+* Installation:: Installing @value{tramp} with your Emacs.
@end ifset
* Configuration:: Configuring @value{tramp} for use.
* Usage:: An overview of the operation of @value{tramp}.
How file names, directories and localnames
are mangled and managed.
* Traces and Profiles:: How to Customize Traces.
-* Issues:: Debatable Issues and What Was Decided.
* GNU Free Documentation License:: The license for this documentation.
* Function Index:: @value{tramp} functions.
--- The Detailed Node Listing ---
@c
@ifset installchapter
-Installing @value{tramp} with your @value{emacsname}
+Installing @value{tramp} with your Emacs
* Installation parameters:: Parameters in order to control installation.
* Load paths:: How to plug-in @value{tramp} into your environment.
* Connection types:: Types of connections to remote hosts.
* Inline methods:: Inline methods.
* External methods:: External methods.
-@ifset emacsgvfs
* GVFS based methods:: GVFS based external methods.
-@end ifset
-@ifset emacsgw
* Gateway methods:: Gateway methods.
-@end ifset
* Default Method:: Selecting a default method.
* Default User:: Selecting a default user.
* Default Host:: Selecting a default host.
* File name Syntax:: @value{tramp} file name conventions.
* File name completion:: File name completion.
* Ad-hoc multi-hops:: Declaring multiple hops in the file name.
-* Remote processes:: Integration with other @value{emacsname} packages.
+* Remote processes:: Integration with other Emacs packages.
* Cleanup remote connections:: Cleanup remote connections.
How file names, directories and localnames are mangled and managed
* Localname deconstruction:: Breaking a localname into its components.
-@ifset emacs
* External packages:: Integration with external Lisp packages.
-@end ifset
@end detailmenu
@end menu
@cindex overview
@value{tramp} is for transparently accessing remote files from within
-@value{emacsname}. @value{tramp} enables an easy, convenient, and
-consistent interface to remote files as if they are local files.
-@value{tramp}'s transparency extends to editing, version control, and
-@code{dired}.
+Emacs. @value{tramp} enables an easy, convenient, and consistent
+interface to remote files as if they are local files. @value{tramp}'s
+transparency extends to editing, version control, and @code{dired}.
@value{tramp} can access remote hosts using any number of access
methods, such as @command{rsh}, @command{rlogin}, @command{telnet},
@value{tramp} temporarily transfers a remote file's contents to the
local host editing and related operations. @value{tramp} can also
transfer files between hosts using standard Emacs interfaces, a
-benefit of direct integration of @value{tramp} in @value{emacsname}.
+benefit of direct integration of @value{tramp} in Emacs.
@value{tramp} can transfer files using any number of available host
programs for remote files, such as @command{rcp}, @command{scp},
@value{tramp} invokes @samp{telnet @var{host}} or @samp{rsh @var{host}
-l @var{user}} and establishes an external process to connect to the
remote host. @value{tramp} communicates with the process through an
-@value{emacsname} buffer, which also shows output from the remote
-host.
+Emacs buffer, which also shows output from the remote host.
@item
The remote host may prompt for a login name (for @command{telnet}, for
@c For the end user
@node Obtaining Tramp
-@chapter Obtaining Tramp.
+@chapter Obtaining @value{tramp}
@cindex obtaining Tramp
@value{tramp} is included as part of Emacs (since Emacs version 22.1).
Another way is to follow the terminal session below:
@example
-] @strong{cd ~/@value{emacsdir}}
+] @strong{cd ~/emacs}
] @strong{git clone git://git.savannah.gnu.org/tramp.git}
@end example
@end example
@noindent
-After one of the above commands, @file{~/@value{emacsdir}/tramp} will
+After one of the above commands, @file{~/emacs/tramp} will
containing the latest version of @value{tramp}.
@noindent
To fetch updates from the repository, use git pull:
@example
-] @strong{cd ~/@value{emacsdir}/tramp}
+] @strong{cd ~/emacs/tramp}
] @strong{git pull}
@end example
@file{configure} script:
@example
-] @strong{cd ~/@value{emacsdir}/tramp}
+] @strong{cd ~/emacs/tramp}
] @strong{autoconf}
@end example
April 2000 was the first time when multi-hop methods were added. In
July 2002, @value{tramp} unified file names with Ange-FTP@. In July
2004, proxy hosts replaced multi-hop methods. Running commands on
-remote hosts was introduced in December 2005.
-@ifset emacsgw
-Support for gateways since April 2007.
-@end ifset
+remote hosts was introduced in December 2005. Support for gateways
+since April 2007.
@ifset emacsgvfs
GVFS integration started in February 2009.
@end ifset
-@ifset emacs
-Remote commands on Windows hosts since September 2011.
-@end ifset
-Ad-hoc multi-hop methods (with a changed syntax) re-enabled in November
-2011.
+Remote commands on Windows hosts since September 2011. Ad-hoc
+multi-hop methods (with a changed syntax) re-enabled in November 2011.
In November 2012, added Juergen Hoetzel's @file{tramp-adb.el}.
-In December 2001, XEmacs package repository adds @value{tramp}.
-
@c Installation chapter is necessary only in case of standalone
@c installation. Text taken from trampinst.texi.
types}).
@strong{Note} that some user options and variables described in these
-examples are not auto loaded by @value{emacsname}. All examples
-require @value{tramp} is installed and loaded:
+examples are not auto loaded by Emacs. All examples require
+@value{tramp} is installed and loaded:
@lisp
(require 'tramp)
* Connection types:: Types of connections to remote hosts.
* Inline methods:: Inline methods.
* External methods:: External methods.
-@ifset emacsgvfs
* GVFS based methods:: GVFS based external methods.
-@end ifset
-@ifset emacsgw
* Gateway methods:: Gateway methods.
-@end ifset
* Default Method:: Selecting a default method.
Here we also try to help those who
don't have the foggiest which method
contents. Inline methods are quick and easy for small files. They
depend on the availability of suitable encoding and decoding programs
on the remote host. For local source and destination, @value{tramp}
-may use built-in equivalents of such programs in @value{emacsname}.
+may use built-in equivalents of such programs in Emacs.
Inline methods can work in situations where an external transfer
program is unavailable. Inline methods also work when transferring
@cindex ftp method
When @value{tramp} uses @option{ftp}, it forwards requests to whatever
-ftp program is specified by @value{ftppackagename}. This external
-program must be capable of servicing requests from @value{tramp}.
-
-@ifset xemacs
-This method works only for unified file names, see @ref{Issues}.
-@end ifset
+ftp program is specified by Ange FTP. This external program must be
+capable of servicing requests from @value{tramp}.
@item @option{smb}---@command{smbclient}
@cindex smb method
This is another non-native @value{tramp} method. @command{smbclient}
-connects to any server supporting the SMB/CIFS protocol, such as MS Windows and
-Samba running on GNU/Linux. Tests show this @value{tramp} method
+connects to any host with SMB/CIFS protocol, such as MS Windows and
+Samba Servers running on Unixes. Tests show this @value{tramp} method
works with MS Windows NT, MS Windows 2000, MS Windows XP, MS Windows
Vista, and MS Windows 7.
behavior is unlike other @value{tramp} methods, where local user name
is substituted.
-@option{smb} method is unavailable if @value{emacsname} is run under a
-local user authentication context in MS Windows. However such users
-can still access remote files using UNC file names instead of @value{tramp}:
+@option{smb} method is unavailable if Emacs is run under a local user
+authentication context in MS Windows. However such users can still
+access remote files using UNC file names instead of @value{tramp}:
@example
//melancholia/daniel$$/.emacs
@value{tramp} connects to Android devices with @option{adb} only when
the custom option @option{tramp-adb-connect-if-not-connected} is not
@code{nil}. Otherwise, the connection must be established outside
-@value{emacsname}.
+Emacs.
@value{tramp} does not require a host name part of the remote file
name when a single Android device is connected to @command{adb}.
name. @command{adb devices} shows available host names.
@option{adb} method normally does not need user name to authenticate
-on the Android device because it runs under the @command{adbd}
+on the Andriod device because it runs under the @command{adbd}
process. But when a user name is specified, however, @value{tramp}
applies an @command{su} in the syntax. When authentication does not
succeed, especially on un-rooted Android devices, @value{tramp}
displays login errors.
-For Android devices connected through TCP/IP, a port number can be
+For Andriod devices connected through TCP/IP, a port number can be
specified using @file{device#42} host name syntax or @value{tramp} can
use the default value as declared in @command{adb} command. Port
numbers are not applicable to Android devices connected through USB@.
mounted locally through FUSE and @value{tramp} uses this locally
mounted directory internally.
-@value{emacsname} uses the D-Bus mechanism to communicate with GVFS@.
-@value{emacsname} must have the message bus system, D-Bus integration
-active, @pxref{Top, , D-Bus, dbus}.
+Emacs uses the D-Bus mechanism to communicate with GVFS@. Emacs must
+have the message bus system, D-Bus integration active, @pxref{Top, ,
+D-Bus, dbus}.
@table @asis
@item @option{afp}
@end ifset
-@ifset emacsgw
@node Gateway methods
@section Gateway methods
@cindex methods, gateway
specified otherwise.
@end table
-@end ifset
@node Default Method
for more details.
A Caution: @value{tramp} will override any default user specified in
-the configuration files outside @value{emacsname}, such as
-@file{~/.ssh/config}. To stop @value{tramp} from applying the default
-value, set the corresponding alist entry to nil:
+the configuration files outside Emacs, such as @file{~/.ssh/config}.
+To stop @value{tramp} from applying the default value, set the
+corresponding alist entry to nil:
@lisp
(add-to-list 'tramp-default-user-alist
@vindex tramp-default-host-alist
When host name is omitted, @value{tramp} substitutes the value from
-the @code{tramp-default-host} variable. It is initially populated with
-the local hostname where @value{emacsname} is running. Both the
-default user and default host can be overridden as follows:
+the @code{tramp-default-host} variable. It is initially populated
+with the local hostname where Emacs is running. Both the default user
+and default host can be overridden as follows:
@lisp
(setq tramp-default-user "john"
With both defaults set, @samp{@trampfn{ssh, , ,}} will connect
@value{tramp} to John's home directory on target.
-@ifset emacs
@strong{Note} @samp{/::} won't work, because @samp{/:} is the prefix
for quoted file names.
-@end ifset
Instead of a single default host, @code{tramp-default-host-alist}
allows multiple default host values based on access method or user
@var{proxy} is a literal @value{tramp} file name whose local name part
is ignored, and the method and user name parts are optional.
-@ifset emacsgw
The method must be an inline or gateway method (@pxref{Inline
methods}, @pxref{Gateway methods}).
-@end ifset
-@ifclear emacsgw
-The method must be an inline method (@pxref{Inline methods}).
-@end ifclear
If @var{proxy} is @code{nil}, no additional hop is required reaching
@var{user}@@@var{host}.
The above configuration allows @value{tramp} connection as @samp{root}
to remote Ubuntu hosts.
-@ifset emacsgw
@code{tramp-default-proxies-alist} is also used for passing through
firewalls or proxy servers.
@end lisp
Gateway methods in a multiple hop chain can be declared only as the first hop.
-@end ifset
@end defopt
Passing through hops involves dealing with restricted shells, such as
@code{password-cache-expiry} sets the duration (in seconds) the
passwords are remembered. Passwords are never saved permanently nor
-can they extend beyond the lifetime of the current @value{emacsname}
-session. Set @code{password-cache-expiry} to @code{nil} to disable
-expiration.
+can they extend beyond the lifetime of the current Emacs session. Set
+@code{password-cache-expiry} to @code{nil} to disable expiration.
@vindex password-cache
@strong{Implementation Note}: password caching depends on
@file{password-cache.el} package. @value{tramp} activates password
-caching only if @value{tramp} can discover, while @value{emacsname} is
-loading, the package through @code{load-path}.
+caching only if @value{tramp} can discover, while Emacs is loading,
+the package through @code{load-path}.
@ifset installchapter
@file{password.el} is available from No Gnus or from the @value{tramp}
connection properties in a file specified by the variable
@code{tramp-persistency-file-name}.
-The default file name for @code{tramp-persistency-file-name} is:
-@ifset emacs
+The default file name for @code{tramp-persistency-file-name} is
@file{~/.emacs.d/tramp}.
-@end ifset
-@ifset xemacs
-@file{~/.xemacs/tramp}.
-@end ifset
-@value{tramp} reads this file during @value{emacsname} startup, and
-writes to it when exiting @value{emacsname}. Delete this file for
-@value{tramp} to recreate a new one on next @value{emacsname} startup.
+@value{tramp} reads this file during Emacs startup, and writes to it
+when exiting Emacs. Delete this file for @value{tramp} to recreate a
+new one on next Emacs startup.
Set @code{tramp-persistency-file-name} to @code{nil} to disable
storing connections persistently.
When remote search paths are changed, local @value{tramp} caches must
be recomputed. To force @value{tramp} to recompute afresh, exit
-@value{emacsname}, remove the persistent file (@pxref{Connection
-caching}), and restart @value{emacsname}.
+Emacs, remove the persistent file (@pxref{Connection caching}), and
+restart Emacs.
@node Remote shell setup
@end example
@ifinfo
-@ifset emacs
-@xref{Interactive Shell, , , @value{emacsdir}}.
-@end ifset
+@xref{Interactive Shell, , , emacs}.
@end ifinfo
@item @command{busybox} / @command{nc}
@value{tramp} uses the @option{adb} method to access Android
devices. Android devices provide a restricted shell access through an
-USB connection. The local host must have the Android SDK installed.
+USB connection. The local host must have Andriod SDK installed.
Applications such as @code{SSHDroid} that run @command{sshd} process
on the Android device can accept any @option{ssh}-based methods
@section Auto-save and Backup configuration
@cindex auto-save
@cindex backup
-@ifset emacs
@vindex backup-directory-alist
-@end ifset
-@ifset xemacs
-@vindex bkup-backup-directory-info
-@end ifset
To avoid @value{tramp} from saving backup files owned by root to
locations accessible to others, default backup settings in
-@ifset emacs
-@code{backup-directory-alist}
-@end ifset
-@ifset xemacs
-@code{bkup-backup-directory-info}
-@end ifset
-have to be altered.
-
-Here's a scenario where files could be inadvertently
-exposed. @value{emacsname} by default writes backup files to the same
-directory as the original files unless changed to another location,
-such as @file{~/.emacs.d/backups/}. Such a directory will also be used
-by default by @value{tramp} when using, say, a restricted file
-@file{@trampfn{su, root, localhost, /etc/secretfile}}. The backup file
-of the secretfile is now owned by the user logged in from tramp and
-not root.
-
-When
-@ifset emacs
-@code{backup-directory-alist}
-@end ifset
-@ifset xemacs
-@code{bkup-backup-directory-info}
-@end ifset
-is @code{nil} (the default), such problems do not occur.
+@code{backup-directory-alist} have to be altered.
+
+Here's a scenario where files could be inadvertently exposed. Emacs
+by default writes backup files to the same directory as the original
+files unless changed to another location, such as
+@file{~/.emacs.d/backups/}. Such a directory will also be used by
+default by @value{tramp} when using, say, a restricted file
+@file{@trampfn{su, root, localhost, /etc/secretfile}}. The backup
+file of the secretfile is now owned by the user logged in from tramp
+and not root.
+
+When @code{backup-directory-alist} is @code{nil} (the default), such
+problems do not occur.
To ``turns off'' the backup feature for @value{tramp} files and stop
@value{tramp} from saving to the backup directory, use this:
-@ifset emacs
@lisp
(add-to-list 'backup-directory-alist
(cons tramp-file-name-regexp nil))
@end lisp
-@end ifset
-@ifset xemacs
-@lisp
-(require 'backup-dir)
-(add-to-list 'bkup-backup-directory-info
- (list tramp-file-name-regexp ""))
-@end lisp
-@end ifset
-@ifset emacs
@noindent
-Disabling backups can be targeted to just the @option{su} and
+Disabling backups can be targetted to just @option{su} and
@option{sudo} methods:
@lisp
(when (stringp method)
(member method '("su" "sudo"))))))))
@end lisp
-@end ifset
Another option is to create better backup file naming with user and
host names prefixed to the file name. For example, transforming
@file{/etc/secretfile} to
@file{~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile}, set the
-@value{tramp} variable
-@ifset emacs
-@code{tramp-backup-directory-alist}
-@end ifset
-@ifset xemacs
-@code{tramp-bkup-backup-directory-info}
-@end ifset
-from the existing variable
-@ifset emacs
-@code{backup-directory-alist}.
-@end ifset
-@ifset xemacs
-@code{bkup-backup-directory-info}.
-@end ifset
+@value{tramp} variable @code{tramp-backup-directory-alist} from the
+existing variable @code{backup-directory-alist}.
Then @value{tramp} backs up to a file name that is transformed with a
prefix consisting of the DIRECTORY name. This file name prefixing
@noindent
Example:
-@ifset emacs
@lisp
(add-to-list 'backup-directory-alist
(cons "." "~/.emacs.d/backups/"))
(setq tramp-backup-directory-alist backup-directory-alist)
@end lisp
-@end ifset
-@ifset xemacs
-@lisp
-(require 'backup-dir)
-(add-to-list 'bkup-backup-directory-info
- (list "." "~/.emacs.d/backups/" 'full-path))
-(setq tramp-bkup-backup-directory-info bkup-backup-directory-info)
-@end lisp
-@end ifset
@noindent
The backup file name of @file{@trampfn{su, root, localhost,
-/etc/secretfile}} would be
-@ifset emacs
-@file{@trampfn{su, root, localhost,
+/etc/secretfile}} would be @file{@trampfn{su, root, localhost,
~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile~}}
-@end ifset
-@ifset xemacs
-@file{@trampfn{su, root, localhost,
-~/.emacs.d/backups/![su!root@@localhost]!etc!secretfile~}}
-@end ifset
Just as for backup files, similar issues of file naming affect
-auto-saving @value{tramp} files.
-@ifset emacs
-Auto-saved files are saved in the directory specified by the variable
+auto-saving @value{tramp} files. Auto-saved files are saved in the
+directory specified by the variable
@code{auto-save-file-name-transforms}. By default this is set to the
local temporary directory. But in some versions of Debian GNU/Linux,
-this points to the source directory where the @value{emacsname} was
-compiled. Reset such values to a valid directory.
+this points to the source directory where the Emacs was compiled.
+Reset such values to a valid directory.
Set @code{auto-save-file-name-transforms} to @code{nil} to save
auto-saved files to the same directory as the original file.
Alternatively, set the variable @code{tramp-auto-save-directory} to
direct all auto saves to that location.
-@end ifset
-@ifset xemacs
-@code{auto-save-directory} can also be used here instead of other
-locations specified above.
-@end ifset
@node Windows setup hints
@section Issues with Cygwin ssh
@cindex method sshx with Cygwin
@cindex sshx method with Cygwin
-Cygwin's @command{ssh} works only with a Cygwin version of
-@value{emacsname}. To check for compatibility: type @kbd{M-x eshell}, and
-start @kbd{ssh test.host}. Incompatibilities trigger this message:
+Cygwin's @command{ssh} works only with a Cygwin version of Emacs. To
+check for compatibility: type @kbd{M-x eshell}, and start @kbd{ssh
+test.host}. Incompatbilities trigger this message:
@example
Pseudo-terminal will not be allocated because stdin is not a terminal.
@cindex method scpx with Cygwin
@cindex scpx method with Cygwin
-When using the @option{scpx} access method, @value{emacsname} may call
+When using the @option{scpx} access method, Emacs may call
@command{scp} with Windows file naming, such as @code{c:/foo}. But
the version of @command{scp} that is installed with Cygwin does not
know about Windows file naming, which causes it to incorrectly look
Windows file names to Cygwin file names.
@cindex Cygwin and ssh-agent
-@cindex SSH_AUTH_SOCK and @value{emacsname} on Windows
+@cindex SSH_AUTH_SOCK and Emacs on Windows
When using the @command{ssh-agent} on Windows for password-less
interaction, @option{ssh} methods depend on the environment variable
-@env{SSH_AUTH_SOCK}. But this variable is not set when
-@value{emacsname} is started from a Desktop shortcut and
-authentication fails.
+@env{SSH_AUTH_SOCK}. But this variable is not set when Emacs is
+started from a Desktop shortcut and authentication fails.
One workaround is to use a Windows based SSH Agent, such as
Pageant. It is part of the Putty Suite of tools.
-The fallback is to start @value{emacsname} from a shell.
+The fallback is to start Emacs from a shell.
@node Usage
they are local. However, @value{tramp} employs a formalized remote
file naming syntax to perform its functions transparently. This
syntax consists of many parts specifying access methods,
-authentication, host names, and file names.
-@ifset emacs
-@value{ftppackagename} uses a similar syntax.
-@end ifset
+authentication, host names, and file names. Ange FTP uses a similar
+syntax.
@cindex type-ahead
-Unlike opening local files in @value{emacsname}, which are
-instantaneous, opening remote files in @value{tramp} is slower at
-first. Sometimes there is a noticeable delay before the prompts for
-passwords or authentication appear in the minibuffer. Hitting
-@kbd{@key{RET}} or other keys during this gap will be processed by
-@value{emacsname}. This type-ahead facility is a feature of
-@value{emacsname} that may cause missed prompts when using
+Unlike opening local files in Emacs, which are instantaneous, opening
+remote files in @value{tramp} is slower at first. Sometimes there is
+a noticable delay before the prompts for passwords or authentication
+appear in the minibuffer. Hitting @kbd{@key{RET}} or other keys
+during this gap will be processed by Emacs. This type-ahead facility
+is a feature of Emacs that may cause missed prompts when using
@value{tramp}.
@menu
* File name Syntax:: @value{tramp} file name conventions.
* File name completion:: File name completion.
* Ad-hoc multi-hops:: Declaring multiple hops in the file name.
-* Remote processes:: Integration with other @value{emacsname} packages.
+* Remote processes:: Integration with other Emacs packages.
* Cleanup remote connections:: Cleanup remote connections.
@end menu
@var{host} can take IPv4 or IPv6 address, as in @file{@trampfn{, ,
127.0.0.1, .emacs}} or @file{@trampfn{, ,
-@value{ipv6prefix}::1@value{ipv6postfix}, .emacs}}.
-@ifset emacs
-For syntactical reasons, IPv6 addresses must be embedded in square
-brackets @file{@value{ipv6prefix}} and @file{@value{ipv6postfix}}.
-@end ifset
+@value{ipv6prefix}::1@value{ipv6postfix}, .emacs}}. For syntactical
+reasons, IPv6 addresses must be embedded in square brackets
+@file{@value{ipv6prefix}} and @file{@value{ipv6postfix}}.
By default, @value{tramp} will use the current local user name as the
remote user name for log in to the remote host. Specifying a different
Specify other file access methods (@pxref{Inline methods},
@pxref{External methods}) as part of the file name.
-@ifset emacs
Method name comes before user name, as in
@file{@value{prefix}@var{method}@value{postfixhop}} (Note the trailing
-colon).
-@end ifset
-@ifset xemacs
-This is done by replacing the initial @file{@value{prefix}} with
-@file{@value{prefix}@var{method}@value{postfixhop}} (Note the trailing
-slash!).
-@end ifset
-The syntax specifications for user, host, and file do not change.
+colon). The syntax specificaton for user, host, and file do not
+change.
To connect to the host @code{melancholia} as @code{daniel}, using
@option{ssh} method for @file{.emacs} in @code{daniel}'s home
@value{tramp} can complete the following @value{tramp} file name
components: method names, user names, host names, and file names
-located on remote hosts.
-@ifset emacs
-Enable this by activating partial completion in @file{.emacs}.
+located on remote hosts. Enable this by activating partial completion
+in @file{.emacs}.
@ifinfo
-@xref{Completion Options, , , @value{emacsdir}}.
+@xref{Completion Options, , , emacs}.
@end ifinfo
-@end ifset
For example, type @kbd{C-x C-f @value{prefix}t @key{TAB}},
@value{tramp} completion choices show up as
@example
@c @multitable {@trampfn{telnet, , melancholia.danann.net,}} {@trampfn{telnet, , 192.168.0.1,}}
@multitable @columnfractions .5 .5
-@ifset emacs
@item @value{prefixhop}telnet@value{postfixhop} @tab tmp/
@item @value{prefixhop}toto@value{postfix} @tab
-@end ifset
-@ifset xemacs
-@item @value{prefixhop}telnet@value{postfixhop} @tab @value{prefixhop}toto@value{postfix}
-@end ifset
@end multitable
@end example
-@samp{@value{prefixhop}telnet@value{postfixhop}}
-is a possible completion for the respective method,
-@ifset emacs
-@samp{tmp/} stands for the directory @file{/tmp} on your local host,
-@end ifset
-and @samp{@value{prefixhop}toto@value{postfix}}
-might be a host @value{tramp} has detected in your @file{~/.ssh/known_hosts}
-file (when using @option{ssh} as default method).
+@samp{@value{prefixhop}telnet@value{postfixhop}} is a possible
+completion for the respective method, @samp{tmp/} stands for the
+directory @file{/tmp} on your local host, and
+@samp{@value{prefixhop}toto@value{postfix}} might be a host
+@value{tramp} has detected in your @file{~/.ssh/known_hosts} file
+(when using @option{ssh} as default method).
Type @kbd{e @key{TAB}} for the minibuffer completion to
@samp{@value{prefix}telnet@value{postfixhop}}. Typing @kbd{@key{TAB}}
completion lists.
After remote host name completion comes completion of file names on
-the remote host. It works the same as with local host file completion,
-except that killing with double-slash @file{//} kills only the file
-name part of the @value{tramp} file name syntax.
-@ifset emacs
-A triple-slash stands for the default behavior.
-@end ifset
+the remote host. It works the same as on loal host file completion
+except when killing with double-slash @file{//} kills only the file
+name part of the @value{tramp} file name syntax. A triple-slash
+stands for the default behavior.
@ifinfo
-@xref{Minibuffer File, , , @value{emacsdir}}.
+@xref{Minibuffer File, , , emacs}.
@end ifinfo
@noindent
Example:
@example
-@ifset emacs
@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin//etc} @key{TAB}}
@print{} @trampfn{telnet, , melancholia, /etc}
@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin///etc} @key{TAB}}
@print{} /etc
-@end ifset
-
-@ifset xemacs
-@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin//}}
- @print{} @trampfn{telnet, , melancholia, /}
-
-@kbd{C-x C-f @trampfn{telnet, , melancholia, //}}
- @print{} /
-@end ifset
@end example
During file name completion, remote directory contents are re-read
regularly to account for any changes in the filesystem that may affect
the completion candidates. Such re-reads can account for changes to
-the file system by applications outside @value{emacsname}
-(@pxref{Connection caching}).
+the file system by applications outside Emacs (@pxref{Connection
+caching}).
@defopt tramp-completion-reread-directory-timeout
@vindex tramp-completion-reread-directory-timeout
@value{tramp} adds the ad-hoc definitions on the fly to
@code{tramp-default-proxies-alist} and is available for re-use during
-that @value{emacsname} session. Subsequent @value{tramp} connections
-to the same remote host can then use the shortcut form:
-@samp{@trampfn{ssh, you, remotehost, /path}}.
+that Emacs session. Subsequent @value{tramp} connections to the same
+remote host can then use the shortcut form: @samp{@trampfn{ssh, you,
+remotehost, /path}}.
@defopt tramp-save-ad-hoc-proxies
@vindex tramp-save-ad-hoc-proxies
For ad-hoc definitions to be saved automatically in
-@option{tramp-default-proxies-alist} for future @value{emacsname}
-sessions, set @option{tramp-save-ad-hoc-proxies}.
+@option{tramp-default-proxies-alist} for future Emacs sessions, set
+@option{tramp-save-ad-hoc-proxies}.
@lisp
(setq tramp-save-ad-hoc-proxies t)
@node Remote processes
-@section Integration with other @value{emacsname} packages
+@section Integration with other Emacs packages
@cindex compile
@cindex recompile
@value{tramp} supports starting new running processes on the remote
-host for discovering remote file names. @value{emacsname} packages on
-the remote host need no specific modifications for @value{tramp}'s
-use.
+host for discovering remote file names. Emacs packages on the remote
+host need no specific modifications for @value{tramp}'s use.
This type of integration does not work with the @option{ftp} method,
and does not support the pty association as specified in
This works only for environment variables not already set in the
@code{process-environment}.
-For integrating other @value{emacsname} packages so @value{tramp} can
-execute remotely, please file a bug report. @xref{Bug Reports}.
+For integrating other Emacs packages so @value{tramp} can execute
+remotely, please file a bug report. @xref{Bug Reports}.
@subsection Running remote programs that create local X11 windows
systems, such as @samp{windows-nt} and @samp{gnu/linux}. This option
ensures the correct name of the remote shell program.
-@ifset emacs
Starting with Emacs 24, when @option{explicit-shell-file-name} is
equal to @code{nil}, calling @code{shell} interactively will prompt
for a shell name.
-@end ifset
@subsection Running @code{shell-command} on a remote host
@command{tail} command outputs continuously to the local buffer,
@file{*Async Shell Command*}
-@ifset emacs
@kbd{M-x auto-revert-tail-mode} runs similarly showing continuous output.
-@end ifset
@subsection Running @code{eshell} on a remote host
@b{@trampfn{sudo, root, host, /etc} $}
@end example
-@ifset emacs
-@code{eshell} in @value{emacsname} 23.2 added custom @code{su} and
-@code{sudo} commands that set the default directory correctly for the
+@code{eshell} in Emacs 23.2 added custom @code{su} and @code{sudo}
+commands that set the default directory correctly for the
@file{*eshell*} buffer. @value{tramp} silently updates
@code{tramp-default-proxies-alist} with an entry for this directory
(@pxref{Multi-hops}):
uid=0(root) gid=0(root) groups=0(root)
@b{@trampfn{su, root, remotehost, /root} $}
@end example
-@end ifset
@anchor{Running a debugger on a remote host}
@cindex perldb
@file{gud.el} provides a unified interface to symbolic debuggers
-@ifset emacs
@ifinfo
-(@ref{Debuggers, , , @value{emacsdir}}).
+(@ref{Debuggers, , , emacs}).
@end ifinfo
-@end ifset
@value{tramp} can run debug on remote hosts by calling @code{gdb}
with a remote file name:
@uref{http://lists.gnu.org/mailman/listinfo/tramp-devel/, the
@value{tramp} Mail Subscription Page}.
-@ifset emacs
@ifset installchapter
Before sending a bug report, run the test suite first @ref{Testing}.
@end ifset
-@end ifset
@findex tramp-bug
Check if the bug or problem is already addressed in @xref{Frequently
@item
Which systems does it work on?
-The package works successfully on Emacs 22, Emacs 23, Emacs 24, Emacs
-25, XEmacs 21 (starting with 21.4), and SXEmacs 22.
+The package works successfully on Emacs 23, Emacs 24, and Emacs 25.
While Unix and Unix-like systems are the primary remote targets,
@value{tramp} has equal success connecting to other platforms, such as
@value{tramp} overwrites @code{ControlPath} settings when initiating
@command{ssh} sessions. @value{tramp} does this to fend off a stall
-if a master session opened outside the @value{emacsname} session is no
-longer open. That is why @value{tramp} prompts for the password again
-even if there is an @command{ssh} already open.
+if a master session opened outside the Emacs session is no longer
+open. That is why @value{tramp} prompts for the password again even
+if there is an @command{ssh} already open.
Some @command{ssh} versions support a @code{ControlPersist} option,
which allows to set the @code{ControlPath} provided the variable
@item
How to get notified after @value{tramp} completes file transfers?
-Make @value{emacsname} beep after reading from or writing to the
-remote host with the following code in @file{~/.emacs} file.
+Make Emacs beep after reading from or writing to the remote host with
+the following code in @file{~/.emacs} file.
@lisp
(defadvice tramp-handle-write-region
@end lisp
-@ifset emacs
@item
How to get a Visual Warning when working with @samp{root} privileges
Get a modeline indication when working with @samp{root} privileges
-with the following code (tested with @value{emacsname} 22.1) in
-@file{~/.emacs} file:
+with the following code (tested with Emacs 22.1) in @file{~/.emacs}
+file:
@lisp
(defun my-mode-line-function ()
(add-hook 'find-file-hook 'my-mode-line-function)
(add-hook 'dired-mode-hook 'my-mode-line-function)
@end lisp
-@end ifset
-@ifset emacs
@item
How to get host indication in the mode line?
-The following code (tested with @value{emacsname} 22.1) in
-@file{~/.emacs} file shows it:
+The following code (tested with Emacs 22.1) in @file{~/.emacs} file
+shows it:
@lisp
(defconst my-mode-line-buffer-identification
my-mode-line-buffer-identification)))
@end lisp
-The mode line in @value{emacsname} 23.1 and later versions now
-contains an indication if @code{default-directory} for the current
-buffer is on a remote host. Moreover, the corresponding tool-tip
-shows the remote host name. The above @code{:eval} clause can also be
-simplified to show the host name in the mode line:
+The mode line in Emacs 23.1 and later versions now contains an
+indication if @code{default-directory} for the current buffer is on a
+remote host. Moreover, the corresponding tool-tip shows the remote
+host name. The above @code{:eval} clause can also be simplified to
+show the host name in the mode line:
@lisp
'(:eval
(substring host-name 0 (match-beginning 1))
host-name)))
@end lisp
-@end ifset
-@ifset emacs
@item
Remote host does not understand default options for directory listing
-@value{emacsname} computes the @command{dired} options based on the
-local host but if the remote host cannot understand the same
-@command{ls} command, then set them with a hook as follows:
+Emacs computes the @command{dired} options based on the local host but
+if the remote host cannot understand the same @command{ls} command,
+then set them with a hook as follows:
@lisp
(add-hook
(when (file-remote-p default-directory)
(setq dired-actual-switches "-al"))))
@end lisp
-@end ifset
@item
Use environment variables to expand long strings
For long file names, set up environment variables that are expanded in
-the minibuffer. Environment variables are set either outside
-@value{emacsname} or inside @value{emacsname} with Lisp:
+the minibuffer. Environment variables are set either outside Emacs or
+inside Emacs with Lisp:
@lisp
(setenv "xy" "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}")
@item Define own keys:
-Redefine another key sequence in @value{emacsname} for @kbd{C-x C-f}:
+Redefine another key sequence in Emacs for @kbd{C-x C-f}:
@lisp
(global-set-key
Use bookmarks to save Tramp file names.
@ifinfo
-@pxref{Bookmarks, , , @value{emacsdir}}.
+@pxref{Bookmarks, , , emacs}.
@end ifinfo
Upon visiting a location with @value{tramp}, save it as a bookmark with
-@ifset emacs
@kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{set}}.
-@end ifset
-@ifset xemacs
-@kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{set}}.
-@end ifset
To revisit that bookmark:
-@ifset emacs
@kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{jump}}.
-@end ifset
-@ifset xemacs
-@kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{jump}}.
-@end ifset
@item Use recent files:
-@ifset emacs
-@file{recentf}
-@end ifset
-@ifset xemacs
-@file{recent-files}
-@end ifset
-remembers visited places.
+@file{recentf} remembers visited places.
@ifinfo
-@ifset emacs
-@pxref{File Conveniences, , , @value{emacsdir}}.
-@end ifset
-@ifset xemacs
-@pxref{recent-files, , , edit-utils}.
-@end ifset
+@pxref{File Conveniences, , , emacs}.
@end ifinfo
Keep remote file names in the recent list without have to check for
their accessibility through remote access:
@lisp
-@ifset emacs
(recentf-mode 1)
-@end ifset
-@ifset xemacs
-(recent-files-initialize)
-(add-hook
- 'find-file-hook
- (lambda ()
- (when (file-remote-p (buffer-file-name))
- (recent-files-make-permanent)))
- 'append)
-@end ifset
@end lisp
-Reaching recently opened files:
-@ifset emacs
-@kbd{@key{menu-bar} @key{file} @key{Open Recent}}.
-@end ifset
-@ifset xemacs
-@kbd{@key{menu-bar} @key{Recent Files}}.
-@end ifset
+Reaching recently opened files: @kbd{@key{menu-bar} @key{file}
+@key{Open Recent}}.
-@ifset emacs
@item Use filecache:
Since @file{filecache} remembers visited places, add the remote
Then use directory completion in the minibuffer with @kbd{C-x C-f
C-@key{TAB}}.
-@end ifset
-@ifset emacs
@item Use bbdb:
-@file{bbdb} has a built-in feature for @value{ftppackagename} files,
-which also works for @value{tramp} file names.
+@file{bbdb} has a built-in feature for Ange FTP files, which also
+works for @value{tramp} file names.
@ifinfo
@pxref{bbdb-ftp, Storing FTP sites in the BBDB, , bbdb}.
@end ifinfo
-Load @file{bbdb} in @value{emacs}:
+Load @file{bbdb} in Emacs:
@lisp
(require 'bbdb)
@end example
In BBDB buffer, access an entry by pressing the key @key{F}.
-@end ifset
@end enumerate
Thanks to @value{tramp} users for contributing to these recipes.
@item
-Why saved multi-hop file names do not work in a new @value{emacsname}
-session?
+Why saved multi-hop file names do not work in a new Emacs session?
When saving ad-hoc multi-hop @value{tramp} file names (@pxref{Ad-hoc
-multi-hops}) via bookmarks, recent files,
-@ifset emacs
-filecache, bbdb,
-@end ifset
-or another package, use the full ad-hoc file name including all hops,
-like @file{@trampfn{ssh, bird,
-bastion|ssh@value{postfixhop}news.my.domain, /opt/news/etc}}.
+multi-hops}) via bookmarks, recent files, filecache, bbdb, or another
+package, use the full ad-hoc file name including all hops, like
+@file{@trampfn{ssh, bird, bastion|ssh@value{postfixhop}news.my.domain,
+/opt/news/etc}}.
Alternatively, when saving abbreviated multi-hop file names
@file{@trampfn{ssh, news, news.my.domain, /opt/news/etc}}, the custom
value.
-@ifset emacs
@item
-How to connect to a remote @value{emacsname} session using @value{tramp}?
+How to connect to a remote Emacs session using @value{tramp}?
Configure Emacs Client
@ifinfo
-(@pxref{Emacs Server, , , @value{emacsdir}}).
+(@pxref{Emacs Server, , , emacs}).
@end ifinfo
Then on the remote host, start the Emacs Server:
@example
export EDITOR=/path/to/emacsclient.sh
@end example
-@end ifset
@item
How to disable @value{tramp}?
@itemize @minus
-@ifset emacs
@item
-To keep @value{ftppackagename} as default the remote files access
-package, set this in @file{.emacs}:
+To keep Ange FTP as default the remote files access package, set this
+in @file{.emacs}:
@lisp
(setq tramp-default-method "ftp")
@end lisp
-@end ifset
@item
-To disable both
-@ifset emacs
-@value{tramp} (and @value{ftppackagename}),
-@end ifset
-@ifset xemacs
-@value{tramp},
-@end ifset
-set @code{tramp-mode} to @code{nil} in @file{.emacs}.
+To disable both @value{tramp} (and Ange FTP), set @code{tramp-mode} to
+@code{nil} in @file{.emacs}.
@lisp
(setq tramp-mode nil)
@end lisp
@item
-To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp}.
-@ifset emacs
-Unloading @value{tramp} resets @value{ftppackagename} plugins also.
-@end ifset
+To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp}. Unloading
+@value{tramp} resets Ange FTP plugins also.
@end itemize
@end itemize
@menu
* Localname deconstruction:: Splitting a localname into its component parts.
-@ifset emacs
* External packages:: Integrating with external Lisp packages.
-@end ifset
@end menu
handlers.
-@ifset emacs
@node External packages
@section Integrating with external Lisp packages
@subsection File name completion.
Since @value{tramp} traverses subdirectories starting with the
root-directory, it is most likely sufficient to make the
@code{default-directory} of the process buffer as the root directory.
-@end ifset
@node Traces and Profiles
The debug buffer is in
@ifinfo
-@ref{Outline Mode, , , @value{emacsdir}}.
+@ref{Outline Mode, , , emacs}.
@end ifinfo
@ifnotinfo
Outline Mode.
messages up to verbosity level 5, enter @kbd{C-u 6 C-c C-q}.
@ifinfo
Other navigation keys are described in
-@ref{Outline Visibility, , , @value{emacsdir}}.
+@ref{Outline Visibility, , , emacs}.
@end ifinfo
@value{tramp} handles errors internally. But to get a Lisp backtrace,
being written to @file{*trace-output*}.
-@node Issues
-@chapter Debatable Issues and What Was Decided
-
-@itemize @bullet
-@item The uuencode method does not always work.
-
-@command{uudecode} on some systems cannot write to stdout, but
-@value{tramp} depends on encoding and decoding programs to be able to
-read from stdin and write to stdout.
-
-We can find ways to circumvent @command{uudecode}'s ability to write
-to stdout, such as writing to a temporary file and then piping that to
-stdout.
-
-But I have decided not to implement workarounds as they are too
-fragile to work reliably. Some on systems, @value{tramp} will not have
-uuencode method.
-
-@item The @value{tramp} file name syntax differs between Emacs and XEmacs.
-
-The Emacs maintainers wish to use a unified file name syntax for
-Ange-FTP and @value{tramp} so that users don't have to learn yet
-another syntax though it is okay to learn new extensions.
-
-For the XEmacs maintainers, the disruption from a unified file name
-syntax are not worth the gains. Firstly, the XEmacs package system
-relies on EFS for downloading new packages and therefore is already
-installed. On the other hand, @value{tramp} is not installed by
-default in XEmacs. Unifying will require @value{tramp} installed from
-the start.
-
-@ifset xemacs
-@strong{Note:} To make the syntax similar to @value{ftppackagename},
-make this change to the init file:
-
-@lisp
-(setq tramp-unified-filenames t)
-(require 'tramp)
-@end lisp
-
-To disable auto loading @value{emacsname} @value{tramp} package, set
-file permissions of
-@file{@dots{}/xemacs-packages/lisp/tramp/auto-autoloads.el*} to
-@code{000}.
-
-When using unified file names, @value{emacsname} download sites are
-added to @code{tramp-default-method-alist} with default method of
-@option{ftp} @xref{Default Method} for proper working of the
-@value{emacsname} package system.
-
-The syntax for unified file names is described in the @value{tramp} manual
-for @value{emacsothername}.
-@end ifset
-@end itemize
-
-
@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include doclicense.texi
@c In the Tramp GIT, the version number is auto-frobbed from
@c configure.ac, so you should edit that file and run
@c "autoconf && ./configure" to change the version number.
-@set trampver 2.2.13.25.1
+@set trampver 2.3.0-pre
@c Other flags from configuration
@set instprefix /usr/local
@set infodir /usr/local/share/info
@c Formatting of the tramp program name consistent.
-@set tramp @sc{tramp}
+@set tramp @sc{Tramp}
@c Whether or not describe GVFS integration.
@ifclear noemacsgvfs
@set emacsgvfs
@end ifclear
-@c Whether or not describe gateway methods.
-@ifclear noemacsgw
-@set emacsgw
-@end ifclear
-
-@c Some flags which make the text independent on the (X)Emacs flavor.
-@c "emacs" resp "xemacs" are set in the Makefile. Default is "emacs".
-@ifclear emacs
-@ifclear xemacs
-@set emacs
+@c Some flags which define the remote file name syntax.
+@ifclear unified
+@ifclear separate
+@set unified
@end ifclear
@end ifclear
-@c Emacs values.
-@ifset emacs
-@set emacsname Emacs
-@set emacsdir emacs
-@set ftppackagename Ange-FTP
+@ifset unified
@set prefix /
@set prefixhop
@set postfix :
@set postfixhop :
@set ipv6prefix [
@set ipv6postfix ]
-@set emacsothername XEmacs
-@set emacsotherdir xemacs
-@set emacsotherfilename tramp-xemacs.html
@end ifset
-@c XEmacs counterparts.
-@ifset xemacs
-@set emacsname XEmacs
-@set emacsdir xemacs
-@set ftppackagename EFS
+@ifset separate
@set prefix /[
@set prefixhop [
@set postfix ]
@set postfixhop /
@set ipv6prefix
@set ipv6postfix
-@set emacsothername Emacs
-@set emacsotherdir emacs
-@set emacsotherfilename tramp-emacs.html
@end ifset
(require 'tramp)
-;; Pacify byte-compiler.
-(defvar directory-listing-before-filename-regexp)
-(defvar directory-sep-char)
-
;;;###tramp-autoload
(defcustom tramp-adb-program "adb"
"Name of the Android Debug Bridge program."
(directory-files . tramp-handle-directory-files)
(directory-files-and-attributes
. tramp-adb-handle-directory-files-and-attributes)
- (dired-call-process . ignore)
(dired-compress-file . ignore)
(dired-uncache . tramp-handle-dired-uncache)
(expand-file-name . tramp-adb-handle-expand-file-name)
(shell-command . tramp-adb-handle-shell-command)
(start-file-process . tramp-adb-handle-start-file-process)
(substitute-in-file-name . tramp-handle-substitute-in-file-name)
- (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
+ (unhandled-file-name-directory . ignore)
(vc-registered . ignore)
(verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
(write-region . tramp-adb-handle-write-region))
tramp-current-host nil nil))
result)
(tramp-message v 6 "%s" (mapconcat 'identity (process-command p) " "))
- (tramp-compat-set-process-query-on-exit-flag p nil)
+ (set-process-query-on-exit-flag p nil)
(while (eq 'run (process-status p))
(accept-process-output p 0.1))
(accept-process-output p 0.1)
(lambda (elt)
(setcar
(cdr elt)
- (tramp-compat-replace-regexp-in-string
+ (replace-regexp-in-string
":" tramp-prefix-port-format (car (cdr elt)))))
result)
result))))
(unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
(setq localname (concat "/" localname)))
;; Do normal `expand-file-name' (this does "/./" and "/../").
- ;; We bind `directory-sep-char' here for XEmacs on Windows,
- ;; which would otherwise use backslash. `default-directory' is
- ;; bound, because on Windows there would be problems with UNC
- ;; shares or Cygwin mounts.
- (let ((directory-sep-char ?/)
- (default-directory (tramp-compat-temporary-file-directory)))
+ ;; `default-directory' is bound, because on Windows there would
+ ;; be problems with UNC shares or Cygwin mounts.
+ (let ((default-directory (tramp-compat-temporary-file-directory)))
(tramp-make-tramp-file-name
method user host
(tramp-drop-volume-letter
(with-tramp-file-property v localname "file-truename"
(let ((result nil)) ; result steps in reverse order
(tramp-message v 4 "Finding true name for `%s'" filename)
- (let* ((directory-sep-char ?/)
- (steps (tramp-compat-split-string localname "/"))
+ (let* ((steps (split-string localname "/" 'omit))
(localnamedir (tramp-run-real-handler
'file-name-as-directory (list localname)))
(is-dir (string= localname localnamedir))
"Symlink target `%s' on wrong host" symlink-target))
(setq symlink-target localname))
(setq steps
- (append (tramp-compat-split-string
- symlink-target "/")
+ (append (split-string symlink-target "/" 'omit)
steps)))
(t
;; It's a file.
(split-string
(apply 'concat
(mapcar (lambda (s)
- (tramp-compat-replace-regexp-in-string
- "\\(.\\)" " -\\1"
- (tramp-compat-replace-regexp-in-string "^-" "" s)))
+ (replace-regexp-in-string
+ "\\(.\\)" " -\\1" (replace-regexp-in-string "^-" "" s)))
;; FIXME: Warning about removed switches (long and non-dash).
(delq nil
(mapcar
v 'file-error "Cannot make local copy of file `%s'" filename))
(set-file-modes
tmpfile
- (logior (or (file-modes filename) 0)
- (tramp-compat-octal-to-decimal "0400"))))
+ (logior (or (file-modes filename) 0) (string-to-number "0400" 8))))
tmpfile)))
(defun tramp-adb-handle-file-writable-p (filename)
(copy-file filename tmpfile 'ok)
(set-file-modes
tmpfile
- (logior (or (file-modes tmpfile) 0)
- (tramp-compat-octal-to-decimal "0600"))))
+ (logior (or (file-modes tmpfile) 0) (string-to-number "0600" 8))))
(tramp-run-real-handler
'write-region
(list start end tmpfile append 'no-message lockname confirm))
(with-parsed-tramp-file-name filename nil
(tramp-flush-file-property v (file-name-directory localname))
(tramp-flush-file-property v localname)
- (tramp-adb-send-command-and-check
- v (format "chmod %s %s" (tramp-compat-decimal-to-octal mode) localname))))
+ (tramp-adb-send-command-and-check v (format "chmod %o %s" mode localname))))
(defun tramp-adb-handle-set-file-times (filename &optional time)
"Like `set-file-times' for Tramp files."
(if (and t1 t2
(tramp-equal-remote filename newname)
(not (file-directory-p filename)))
- (let ((l1 (tramp-file-name-handler
- 'file-remote-p filename 'localname))
- (l2 (tramp-file-name-handler
- 'file-remote-p newname 'localname)))
+ (let ((l1 (file-remote-p filename 'localname))
+ (l2 (file-remote-p newname 'localname)))
(when (and (not ok-if-already-exists)
(file-exists-p newname))
(tramp-error v 'file-already-exists newname))
"Error renaming %s to %s" filename newname))
;; Rename by copy.
- (copy-file filename newname ok-if-already-exists t t)
+ (copy-file
+ filename newname ok-if-already-exists 'keep-time 'preserve-uid-gid)
(delete-file filename))))))
(defun tramp-adb-handle-process-file
;; because the remote process could have changed them.
(when tmpinput (delete-file tmpinput))
- ;; `process-file-side-effects' has been introduced with GNU
- ;; Emacs 23.2. If set to nil, no remote file will be changed
- ;; by `program'. If it doesn't exist, we assume its default
- ;; value t.
- (unless (and (boundp 'process-file-side-effects)
- (not (symbol-value 'process-file-side-effects)))
+ (unless process-file-side-effects
(tramp-flush-directory-property v ""))
;; Return exit status.
(current-buffer))))
;; There's some output, display it.
(when (with-current-buffer output-buffer (> (point-max) (point-min)))
- (if (functionp 'display-message-or-buffer)
- (tramp-compat-funcall 'display-message-or-buffer output-buffer)
- (pop-to-buffer output-buffer))))))))
+ (display-message-or-buffer output-buffer)))))))
;; We use BUFFER also as connection buffer during setup. Because of
;; this, its original contents must be saved, and restored once
;; process. We ignore errors, because the process
;; could have finished already.
(ignore-errors
- (tramp-compat-set-process-query-on-exit-flag p t)
+ (set-process-query-on-exit-flag p t)
(set-marker (process-mark p) (point)))
;; Return process.
p))))
(host (tramp-file-name-host vec))
(port (tramp-file-name-port vec))
(devices (mapcar 'cadr (tramp-adb-parse-device-names nil))))
- (tramp-compat-replace-regexp-in-string
+ (replace-regexp-in-string
tramp-prefix-port-format ":"
(cond ((member host devices) host)
;; This is the case when the host is connected to the default port.
(not (zerop (length host)))
(not (tramp-adb-execute-adb-command
vec "connect"
- (tramp-compat-replace-regexp-in-string
+ (replace-regexp-in-string
tramp-prefix-port-format ":" host))))
;; When new device connected, running other adb command (e.g.
;; adb shell) immediately will fail. To get around this
(unless (eq 'run (process-status p))
(tramp-error vec 'file-error "Terminated!"))
(tramp-set-connection-property p "vector" vec)
- (tramp-compat-set-process-query-on-exit-flag p nil)
+ (set-process-query-on-exit-flag p nil)
;; Check whether the properties have been changed. If
;; yes, this is a strong indication that we must expire all
;; Read the expression.
(goto-char (point-min))
(read (current-buffer)))
- ":" 'omit-nulls))))))))
+ ":" 'omit))))))))
(add-hook 'tramp-unload-hook
(lambda ()
(choice :tag " Value" sexp))))
(defcustom tramp-persistency-file-name
- (cond
- ;; GNU Emacs.
- ((and (fboundp 'locate-user-emacs-file))
- (expand-file-name (tramp-compat-funcall 'locate-user-emacs-file "tramp")))
- ((and (boundp 'user-emacs-directory)
- (stringp (symbol-value 'user-emacs-directory))
- (file-directory-p (symbol-value 'user-emacs-directory)))
- (expand-file-name "tramp" (symbol-value 'user-emacs-directory)))
- ((and (not (featurep 'xemacs)) (file-directory-p "~/.emacs.d/"))
- "~/.emacs.d/tramp")
- ;; XEmacs.
- ((and (boundp 'user-init-directory)
- (stringp (symbol-value 'user-init-directory))
- (file-directory-p (symbol-value 'user-init-directory)))
- (expand-file-name "tramp" (symbol-value 'user-init-directory)))
- ((and (featurep 'xemacs) (file-directory-p "~/.xemacs/"))
- "~/.xemacs/tramp")
- ;; For users without `~/.emacs.d/' or `~/.xemacs/'.
- (t "~/.tramp"))
+ (expand-file-name (locate-user-emacs-file "tramp"))
"File which keeps connection history for Tramp connections."
:group 'tramp
:type 'file)
(maphash
(lambda (key value)
;; Remove text properties from KEY and VALUE.
- ;; `substring-no-properties' does not exist in XEmacs.
- (when (functionp 'substring-no-properties)
- (when (vectorp key)
- (dotimes (i (length key))
- (when (stringp (aref key i))
- (aset key i
- (tramp-compat-funcall
- 'substring-no-properties (aref key i))))))
- (when (stringp key)
- (setq key (tramp-compat-funcall 'substring-no-properties key)))
- (when (stringp value)
- (setq value
- (tramp-compat-funcall 'substring-no-properties value))))
+ (when (vectorp key)
+ (dotimes (i (length key))
+ (when (stringp (aref key i))
+ (aset key i (substring-no-properties (aref key i))))))
+ (when (stringp key)
+ (setq key (substring-no-properties key)))
+ (when (stringp value)
+ (setq value (substring-no-properties value)))
;; Dump.
(let ((tmp (format
"(%s %s)"
;; When "emacs -Q" has been called, both variables are nil.
;; We do not load the persistency file then, in order to
;; have a clean test environment.
- (or (and (boundp 'init-file-user) (symbol-value 'init-file-user))
- (and (boundp 'site-run-file) (symbol-value 'site-run-file))))
+ (or init-file-user
+ site-run-file))
(condition-case err
(with-temp-buffer
(insert-file-contents tramp-persistency-file-name)
(require 'tramp)
;; Pacify byte-compiler.
+(declare-function mml-mode "mml")
+(declare-function mml-insert-empty-tag "mml")
+(declare-function reporter-dump-variable "reporter")
(defvar reporter-eval-buffer)
(defvar reporter-prompt-for-summary-p)
(setq tramp-locked nil)
;; Flush password cache.
- (tramp-compat-funcall 'password-reset)
+ (password-reset)
;; Flush file and connection cache.
(clrhash tramp-cache-data)
(defun tramp-bug ()
"Submit a bug report to the Tramp developers."
(interactive)
- (require 'reporter)
(catch 'dont-send
(let ((reporter-prompt-for-summary-p t))
(reporter-submit-bug-report
backup-by-copying-when-mismatch
backup-by-copying-when-privileged-mismatch
backup-directory-alist
- bkup-backup-directory-info
password-cache
password-cache-expiry
remote-file-name-inhibit-cache
'tramp-load-report-modules ; pre-hook
'tramp-append-tramp-buffers ; post-hook
- (tramp-compat-funcall
- (if (functionp 'propertize) 'propertize 'progn)
+ (propertize
"\n" 'display "\
Enter your bug report in this message, including as much detail
as you possibly can about the problem, what you did to cause it
(base64-encode-string (encode-coding-string val 'raw-text)))))))
;; Dump variable.
- (tramp-compat-funcall 'reporter-dump-variable varsym mailbuf)
+ (reporter-dump-variable varsym mailbuf)
(unless (hash-table-p val)
;; Remove string quotation.
(defun tramp-load-report-modules ()
"Load needed modules for reporting."
- ;; We load message.el and mml.el from Gnus.
- (if (featurep 'xemacs)
- (progn
- (load "message" 'noerror)
- (load "mml" 'noerror))
- (require 'message nil 'noerror)
- (require 'mml nil 'noerror))
- (tramp-compat-funcall 'message-mode)
- (tramp-compat-funcall 'mml-mode t))
+ (message-mode)
+ (mml-mode t))
(defun tramp-append-tramp-buffers ()
"Append Tramp buffers and buffer local variables into the bug report."
;; Non-tramp variables of interest.
'(default-directory))
'string<))
- (tramp-compat-funcall 'reporter-dump-variable varsym elbuf))
+ (reporter-dump-variable varsym elbuf))
(lisp-indent-line)
(insert ")\n"))
(insert-buffer-substring elbuf)))
(ignore-errors
(mapc
(lambda (x) (when (string-match "tramp" x) (insert x "\n")))
- (split-string (tramp-compat-funcall 'list-load-path-shadows t) "\n")))
+ (split-string (list-load-path-shadows t) "\n")))
;; Append buffers only when we are in message mode.
(when (and
(symbol-value 'mml-mode))
(let ((tramp-buf-regexp "\\*\\(debug \\)?tramp/")
- (buffer-list (tramp-compat-funcall 'tramp-list-tramp-buffers))
+ (buffer-list (tramp-list-tramp-buffers))
(curbuf (current-buffer)))
;; There is at least one Tramp buffer.
(kill-buffer nil)
(switch-to-buffer curbuf)
(goto-char (point-max))
- (insert (tramp-compat-funcall 'propertize "\n" 'display "\n\
+ (insert (propertize "\n" 'display "\n\
This is a special notion of the `gnus/message' package. If you
use another mail agent (by copying the contents of this buffer)
please ensure that the buffers are attached to your email.\n\n"))
(dolist (buffer buffer-list)
- (tramp-compat-funcall
- 'mml-insert-empty-tag 'part 'type "text/plain"
+ (mml-insert-empty-tag
+ 'part 'type "text/plain"
'encoding "base64" 'disposition "attachment" 'buffer buffer
'description buffer))
(set-buffer-modified-p nil))
;;; Commentary:
-;; Tramp's main Emacs version for development is Emacs 24. This
-;; package provides compatibility functions for Emacs 22, Emacs 23,
-;; XEmacs 21.4+ and SXEmacs 22.
+;; Tramp's main Emacs version for development is Emacs 25. This
+;; package provides compatibility functions for Emacs 23 and Emacs 24.
;;; Code:
(eval-when-compile
(require 'cl))
-(eval-and-compile
-
- ;; GNU Emacs 22.
- (unless (fboundp 'ignore-errors)
- (load "cl" 'noerror)
- (load "cl-macs" 'noerror))
-
- ;; Some packages must be required for XEmacs, because we compile
- ;; with -no-autoloads.
- (when (featurep 'xemacs)
- (require 'cus-edit)
- (require 'env)
- (require 'executable)
- (require 'outline)
- (require 'passwd)
- (require 'pp)
- (require 'regexp-opt)
- (require 'time-date))
-
- (require 'advice)
- (require 'custom)
- (require 'format-spec)
- (require 'shell)
- ;; Introduced in Emacs 23.2.
- (require 'ucs-normalize nil 'noerror)
-
- (require 'trampver)
- (require 'tramp-loaddefs)
-
- ;; As long as password.el is not part of (X)Emacs, it shouldn't be
- ;; mandatory.
- (if (featurep 'xemacs)
- (load "password" 'noerror)
- (or (require 'password-cache nil 'noerror)
- (require 'password nil 'noerror))) ; Part of contrib.
-
- ;; auth-source is relatively new.
- (if (featurep 'xemacs)
- (load "auth-source" 'noerror)
- (require 'auth-source nil 'noerror))
-
- ;; Load the appropriate timer package.
- (if (featurep 'xemacs)
- (require 'timer-funcs)
- (require 'timer))
-
- ;; Avoid byte-compiler warnings if the byte-compiler supports this.
- ;; Currently, XEmacs supports this.
- (when (featurep 'xemacs)
- (unless (boundp 'byte-compile-default-warnings)
- (defvar byte-compile-default-warnings nil))
- (delq 'unused-vars byte-compile-default-warnings))
-
- ;; `last-coding-system-used' is unknown in XEmacs.
- (unless (boundp 'last-coding-system-used)
- (defvar last-coding-system-used nil))
-
- ;; `directory-sep-char' is an obsolete variable in Emacs. But it is
- ;; used in XEmacs, so we set it here and there. The following is
- ;; needed to pacify Emacs byte-compiler.
- ;; Note that it was removed altogether in Emacs 24.1.
- (when (boundp 'directory-sep-char)
- (defvar byte-compile-not-obsolete-var nil)
- (setq byte-compile-not-obsolete-var 'directory-sep-char)
- ;; Emacs 23.2.
- (defvar byte-compile-not-obsolete-vars nil)
- (setq byte-compile-not-obsolete-vars '(directory-sep-char)))
-
- ;; `remote-file-name-inhibit-cache' has been introduced with Emacs 24.1.
- ;; Besides t, nil, and integer, we use also timestamps (as
- ;; returned by `current-time') internally.
- (unless (boundp 'remote-file-name-inhibit-cache)
- (defvar remote-file-name-inhibit-cache nil))
-
- ;; For not existing functions, or functions with a changed argument
- ;; list, there are compiler warnings. We want to avoid them in
- ;; cases we know what we do.
- (defmacro tramp-compat-funcall (function &rest arguments)
- (if (featurep 'xemacs)
- `(funcall (symbol-function ,function) ,@arguments)
- `(when (or (subrp ,function) (functionp ,function))
- (with-no-warnings (funcall ,function ,@arguments)))))
-
- ;; `set-buffer-multibyte' comes from Emacs Leim.
- (unless (fboundp 'set-buffer-multibyte)
- (defalias 'set-buffer-multibyte 'ignore))
-
- ;; The following functions cannot be aliases of the corresponding
- ;; `tramp-handle-*' functions, because this would bypass the locking
- ;; mechanism.
-
- ;; `process-file' does not exist in XEmacs.
- (unless (fboundp 'process-file)
- (defalias 'process-file
- (lambda (program &optional infile buffer display &rest args)
- (when (tramp-tramp-file-p default-directory)
- (apply
- 'tramp-file-name-handler
- 'process-file program infile buffer display args)))))
-
- ;; `start-file-process' is new in Emacs 23.
- (unless (fboundp 'start-file-process)
- (defalias 'start-file-process
- (lambda (name buffer program &rest program-args)
- (when (tramp-tramp-file-p default-directory)
- (apply
- 'tramp-file-name-handler
- 'start-file-process name buffer program program-args)))))
-
- ;; `set-file-times' is also new in Emacs 23.
- (unless (fboundp 'set-file-times)
- (defalias 'set-file-times
- (lambda (filename &optional time)
- (when (tramp-tramp-file-p filename)
- (tramp-compat-funcall
- 'tramp-file-name-handler 'set-file-times filename time)))))
-
- ;; We currently use "[" and "]" in the filename format for IPv6
- ;; hosts of GNU Emacs. This means that Emacs wants to expand
- ;; wildcards if `find-file-wildcards' is non-nil, and then barfs
- ;; because no expansion could be found. We detect this situation
- ;; and do something really awful: we have `file-expand-wildcards'
- ;; return the original filename if it can't expand anything. Let's
- ;; just hope that this doesn't break anything else.
- ;; It is not needed anymore since GNU Emacs 23.2.
- (unless (or (featurep 'xemacs)
- ;; `featurep' has only one argument in XEmacs.
- (funcall 'featurep 'files 'remote-wildcards))
- (defadvice file-expand-wildcards
+(require 'auth-source)
+(require 'advice)
+(require 'custom)
+(require 'format-spec)
+(require 'password-cache)
+(require 'shell)
+(require 'timer)
+(require 'ucs-normalize)
+
+(require 'trampver)
+(require 'tramp-loaddefs)
+
+;; `remote-file-name-inhibit-cache' has been introduced with Emacs
+;; 24.1. Besides t, nil, and integer, we use also timestamps (as
+;; returned by `current-time') internally.
+(unless (boundp 'remote-file-name-inhibit-cache)
+ (defvar remote-file-name-inhibit-cache nil))
+
+;; For not existing functions, or functions with a changed argument
+;; list, there are compiler warnings. We want to avoid them in cases
+;; we know what we do.
+(defmacro tramp-compat-funcall (function &rest arguments)
+ `(when (or (subrp ,function) (functionp ,function))
+ (with-no-warnings (funcall ,function ,@arguments))))
+
+;; We currently use "[" and "]" in the filename format for IPv6 hosts
+;; of GNU Emacs. This means that Emacs wants to expand wildcards if
+;; `find-file-wildcards' is non-nil, and then barfs because no
+;; expansion could be found. We detect this situation and do
+;; something really awful: we have `file-expand-wildcards' return the
+;; original filename if it can't expand anything. Let's just hope
+;; that this doesn't break anything else. It is not needed anymore
+;; since GNU Emacs 23.2.
+(unless (featurep 'files 'remote-wildcards)
+ (defadvice file-expand-wildcards
(around tramp-advice-file-expand-wildcards activate)
- (let ((name (ad-get-arg 0)))
- ;; If it's a Tramp file, look if wildcards need to be expanded
- ;; at all.
- (if (and
- (tramp-tramp-file-p name)
- (not (string-match
- "[[*?]" (tramp-compat-funcall
- 'file-remote-p name 'localname))))
- (setq ad-return-value (list name))
- ;; Otherwise, just run the original function.
- ad-do-it)))
- (add-hook
- 'tramp-unload-hook
- (lambda ()
- (ad-remove-advice
- 'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards)
- (ad-activate 'file-expand-wildcards))))
-
- ;; `redisplay' does not exist in XEmacs.
- (unless (fboundp 'redisplay)
- (defalias 'redisplay 'ignore)))
-
-;; `with-temp-message' does not exist in XEmacs.
-(if (fboundp 'with-temp-message)
- (defalias 'tramp-compat-with-temp-message 'with-temp-message)
- (defmacro tramp-compat-with-temp-message (_message &rest body)
- "Display MESSAGE temporarily if non-nil while BODY is evaluated."
- `(progn ,@body)))
+ (let ((name (ad-get-arg 0)))
+ ;; If it's a Tramp file, look if wildcards need to be expanded
+ ;; at all.
+ (if (and
+ (tramp-tramp-file-p name)
+ (not (string-match "[[*?]" (file-remote-p name 'localname))))
+ (setq ad-return-value (list name))
+ ;; Otherwise, just run the original function.
+ ad-do-it)))
+ (add-hook
+ 'tramp-unload-hook
+ (lambda ()
+ (ad-remove-advice
+ 'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards)
+ (ad-activate 'file-expand-wildcards))))
;; `condition-case-unless-debug' is introduced with Emacs 24.
(if (fboundp 'condition-case-unless-debug)
(funcall ,bodysym)
,@handlers))))))
-;; `font-lock-add-keywords' does not exist in XEmacs.
-(defun tramp-compat-font-lock-add-keywords (mode keywords &optional how)
- "Add highlighting KEYWORDS for MODE."
- (ignore-errors
- (tramp-compat-funcall 'font-lock-add-keywords mode keywords how)))
-
(defsubst tramp-compat-temporary-file-directory ()
- "Return name of directory for temporary files (compat function).
-For Emacs, this is the variable `temporary-file-directory', for XEmacs
-this is the function `temp-directory'."
- (let (file-name-handler-alist)
- ;; We must return a local directory. If it is remote, we could
- ;; run into an infloop.
- (cond
- ((and (boundp 'temporary-file-directory)
- (eval (car (get 'temporary-file-directory 'standard-value)))))
- ((fboundp 'temp-directory) (tramp-compat-funcall 'temp-directory))
- ((let ((d (getenv "TEMP"))) (and d (file-directory-p d)))
- (file-name-as-directory (getenv "TEMP")))
- ((let ((d (getenv "TMP"))) (and d (file-directory-p d)))
- (file-name-as-directory (getenv "TMP")))
- ((let ((d (getenv "TMPDIR"))) (and d (file-directory-p d)))
- (file-name-as-directory (getenv "TMPDIR")))
- ((file-exists-p "c:/temp") (file-name-as-directory "c:/temp"))
- (t (message (concat "Neither `temporary-file-directory' nor "
- "`temp-directory' is defined -- using /tmp."))
- (file-name-as-directory "/tmp")))))
-
-;; `make-temp-file' exists in Emacs only. On XEmacs, we use our own
-;; implementation with `make-temp-name', creating the temporary file
-;; immediately in order to avoid a security hole.
+ "Return name of directory for temporary files.
+It is the default value of `temporary-file-directory'."
+ ;; We must return a local directory. If it is remote, we could run
+ ;; into an infloop.
+ (eval (car (get 'temporary-file-directory 'standard-value))))
+
(defsubst tramp-compat-make-temp-file (f &optional dir-flag)
- "Create a temporary file (compat function).
+ "Create a local temporary file (compat function).
Add the extension of F, if existing."
(let* (file-name-handler-alist
(prefix (expand-file-name
(symbol-value 'tramp-temp-name-prefix)
(tramp-compat-temporary-file-directory)))
- (extension (file-name-extension f t))
- result)
- (condition-case nil
- (setq result
- (tramp-compat-funcall 'make-temp-file prefix dir-flag extension))
- (error
- ;; We use our own implementation, taken from files.el.
- (while
- (condition-case ()
- (progn
- (setq result (concat (make-temp-name prefix) extension))
- (if dir-flag
- (make-directory result)
- (write-region "" nil result nil 'silent))
- nil)
- (file-already-exists t))
- ;; The file was somehow created by someone else between
- ;; `make-temp-name' and `write-region', let's try again.
- nil)))
- result))
-
-;; `most-positive-fixnum' does not exist in XEmacs.
-(defsubst tramp-compat-most-positive-fixnum ()
- "Return largest positive integer value (compat function)."
- (cond
- ((boundp 'most-positive-fixnum) (symbol-value 'most-positive-fixnum))
- ;; Default value in XEmacs.
- (t 134217727)))
-
-(defun tramp-compat-decimal-to-octal (i)
- "Return a string consisting of the octal digits of I.
-Not actually used. Use `(format \"%o\" i)' instead?"
- (cond ((< i 0) (error "Cannot convert negative number to octal"))
- ((not (integerp i)) (error "Cannot convert non-integer to octal"))
- ((zerop i) "0")
- (t (concat (tramp-compat-decimal-to-octal (/ i 8))
- (number-to-string (% i 8))))))
-
-;; Kudos to Gerd Moellmann for this suggestion.
-(defun tramp-compat-octal-to-decimal (ostr)
- "Given a string of octal digits, return a decimal number."
- (let ((x (or ostr "")))
- ;; `save-match' is in `tramp-mode-string-to-int' which calls this.
- (unless (string-match "\\`[0-7]*\\'" x)
- (error "Non-octal junk in string `%s'" x))
- (string-to-number ostr 8)))
-
-;; ID-FORMAT does not exist in XEmacs.
-(defun tramp-compat-file-attributes (filename &optional id-format)
- "Like `file-attributes' for Tramp files (compat function)."
- (cond
- ((or (null id-format) (eq id-format 'integer))
- (file-attributes filename))
- ((tramp-tramp-file-p filename)
- (tramp-compat-funcall
- 'tramp-file-name-handler 'file-attributes filename id-format))
- (t (condition-case nil
- (tramp-compat-funcall 'file-attributes filename id-format)
- (wrong-number-of-arguments (file-attributes filename))))))
-
-;; PRESERVE-UID-GID does not exist in XEmacs.
+ (extension (file-name-extension f t)))
+ (make-temp-file prefix dir-flag extension)))
+
;; PRESERVE-EXTENDED-ATTRIBUTES has been introduced with Emacs 24.1
;; (as PRESERVE-SELINUX-CONTEXT), and renamed in Emacs 24.3.
(defun tramp-compat-copy-file
'copy-file filename newname ok-if-already-exists keep-date
preserve-uid-gid preserve-extended-attributes)
(wrong-number-of-arguments
- (tramp-compat-copy-file
+ (copy-file
filename newname ok-if-already-exists keep-date preserve-uid-gid))))
- (preserve-uid-gid
- (condition-case nil
- (tramp-compat-funcall
- 'copy-file filename newname ok-if-already-exists keep-date
- preserve-uid-gid)
- (wrong-number-of-arguments
- (tramp-compat-copy-file
- filename newname ok-if-already-exists keep-date))))
(t
- (copy-file filename newname ok-if-already-exists keep-date))))
+ (copy-file
+ filename newname ok-if-already-exists keep-date preserve-uid-gid))))
-;; `copy-directory' is a new function in Emacs 23.2. Implementation
-;; is taken from there.
+;; COPY-CONTENTS has been introduced with Emacs 24.1.
(defun tramp-compat-copy-directory
(directory newname &optional keep-time parents copy-contents)
"Make a copy of DIRECTORY (compat function)."
(cond
(trash
(tramp-compat-funcall 'delete-directory directory recursive trash))
- (recursive
- (tramp-compat-funcall 'delete-directory directory recursive))
(t
- (delete-directory directory)))
- ;; This Emacs version does not support the RECURSIVE or TRASH flag. We
- ;; use the implementation from Emacs 23.2.
+ (delete-directory directory recursive)))
+ ;; This Emacs version does not support the TRASH flag. We use the
+ ;; implementation from Emacs 23.2.
(wrong-number-of-arguments
(setq directory (directory-file-name (expand-file-name directory)))
(if (not (file-symlink-p directory))
directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
(delete-directory directory))))
-;; MUST-SUFFIX doesn't exist on XEmacs.
-(defun tramp-compat-load (file &optional noerror nomessage nosuffix must-suffix)
- "Like `load' for Tramp files (compat function)."
- (if must-suffix
- (tramp-compat-funcall 'load file noerror nomessage nosuffix must-suffix)
- (load file noerror nomessage nosuffix)))
-
-;; `number-sequence' does not exist in XEmacs. Implementation is
-;; taken from Emacs 23.
-(defun tramp-compat-number-sequence (from &optional to inc)
- "Return a sequence of numbers from FROM to TO as a list (compat function)."
- (if (or (subrp 'number-sequence) (symbol-file 'number-sequence))
- (tramp-compat-funcall 'number-sequence from to inc)
- (if (or (not to) (= from to))
- (list from)
- (or inc (setq inc 1))
- (when (zerop inc) (error "The increment can not be zero"))
- (let (seq (n 0) (next from))
- (if (> inc 0)
- (while (<= next to)
- (setq seq (cons next seq)
- n (1+ n)
- next (+ from (* n inc))))
- (while (>= next to)
- (setq seq (cons next seq)
- n (1+ n)
- next (+ from (* n inc)))))
- (nreverse seq)))))
-
-(defun tramp-compat-split-string (string pattern)
- "Like `split-string' but omit empty strings.
-In Emacs, (split-string \"/foo/bar\" \"/\") returns (\"foo\" \"bar\").
-This is, the first, empty, element is omitted. In XEmacs, the first
-element is not omitted."
- (delete "" (split-string string pattern)))
-
(defun tramp-compat-process-running-p (process-name)
"Returns t if system process PROCESS-NAME is running for `user-login-name'."
(when (stringp process-name)
((and (fboundp 'list-system-processes) (fboundp 'process-attributes))
(let (result)
(dolist (pid (tramp-compat-funcall 'list-system-processes) result)
- (let ((attributes (tramp-compat-funcall 'process-attributes pid)))
+ (let ((attributes (process-attributes pid)))
(when (and (string-equal
(cdr (assoc 'user attributes)) (user-login-name))
(let ((comm (cdr (assoc 'comm attributes))))
(and comm (string-match
(concat "^" (regexp-quote comm))
process-name))))
- (setq result t))))))
-
- ;; Fallback, if there is no Lisp support yet.
- (t (let ((default-directory
- (if (tramp-tramp-file-p default-directory)
- (tramp-compat-temporary-file-directory)
- default-directory))
- (unix95 (getenv "UNIX95"))
- result)
- (setenv "UNIX95" "1")
- (when (member
- (user-login-name)
- (tramp-compat-split-string
- (shell-command-to-string
- (format "ps -C %s -o user=" process-name))
- "[ \f\t\n\r\v]+"))
- (setq result t))
- (setenv "UNIX95" unix95)
- result)))))
-
-;; The following functions do not exist in XEmacs. We ignore this;
-;; they are used for checking a remote tty.
-(defun tramp-compat-process-get (process propname)
- "Return the value of PROCESS' PROPNAME property.
-This is the last value stored with `(process-put PROCESS PROPNAME VALUE)'."
- (ignore-errors (tramp-compat-funcall 'process-get process propname)))
-
-(defun tramp-compat-process-put (process propname value)
- "Change PROCESS' PROPNAME property to VALUE.
-It can be retrieved with `(process-get PROCESS PROPNAME)'."
- (ignore-errors (tramp-compat-funcall 'process-put process propname value)))
-
-(defun tramp-compat-set-process-query-on-exit-flag (process flag)
- "Specify if query is needed for process when Emacs is exited.
-If the second argument flag is non-nil, Emacs will query the user before
-exiting if process is running."
- (if (fboundp 'set-process-query-on-exit-flag)
- (tramp-compat-funcall 'set-process-query-on-exit-flag process flag)
- (tramp-compat-funcall 'process-kill-without-query process flag)))
-
-;; There exist different implementations for this function.
-(defun tramp-compat-coding-system-change-eol-conversion (coding-system eol-type)
- "Return a coding system like CODING-SYSTEM but with given EOL-TYPE.
-EOL-TYPE can be one of `dos', `unix', or `mac'."
- (cond ((fboundp 'coding-system-change-eol-conversion)
- (tramp-compat-funcall
- 'coding-system-change-eol-conversion coding-system eol-type))
- ((fboundp 'subsidiary-coding-system)
- (tramp-compat-funcall
- 'subsidiary-coding-system coding-system
- (cond ((eq eol-type 'dos) 'crlf)
- ((eq eol-type 'unix) 'lf)
- ((eq eol-type 'mac) 'cr)
- (t (error
- "Unknown EOL-TYPE `%s', must be `dos', `unix', or `mac'"
- eol-type)))))
- (t (error "Can't change EOL conversion -- is MULE missing?"))))
-
-;; `replace-regexp-in-string' does not exist in XEmacs.
-;; Implementation is taken from Emacs 24.
-(if (fboundp 'replace-regexp-in-string)
- (defalias 'tramp-compat-replace-regexp-in-string 'replace-regexp-in-string)
- (defun tramp-compat-replace-regexp-in-string
- (regexp rep string &optional fixedcase literal subexp start)
- "Replace all matches for REGEXP with REP in STRING.
-
-Return a new string containing the replacements.
-
-Optional arguments FIXEDCASE, LITERAL and SUBEXP are like the
-arguments with the same names of function `replace-match'. If START
-is non-nil, start replacements at that index in STRING.
-
-REP is either a string used as the NEWTEXT arg of `replace-match' or a
-function. If it is a function, it is called with the actual text of each
-match, and its value is used as the replacement text. When REP is called,
-the match data are the result of matching REGEXP against a substring
-of STRING.
-
-To replace only the first match (if any), make REGEXP match up to \\'
-and replace a sub-expression, e.g.
- (replace-regexp-in-string \"\\\\(foo\\\\).*\\\\'\" \"bar\" \" foo foo\" nil nil 1)
- => \" bar foo\""
-
- (let ((l (length string))
- (start (or start 0))
- matches str mb me)
- (save-match-data
- (while (and (< start l) (string-match regexp string start))
- (setq mb (match-beginning 0)
- me (match-end 0))
- ;; If we matched the empty string, make sure we advance by one char
- (when (= me mb) (setq me (min l (1+ mb))))
- ;; Generate a replacement for the matched substring.
- ;; Operate only on the substring to minimize string consing.
- ;; Set up match data for the substring for replacement;
- ;; presumably this is likely to be faster than munging the
- ;; match data directly in Lisp.
- (string-match regexp (setq str (substring string mb me)))
- (setq matches
- (cons (replace-match (if (stringp rep)
- rep
- (funcall rep (match-string 0 str)))
- fixedcase literal str subexp)
- (cons (substring string start mb) ; unmatched prefix
- matches)))
- (setq start me))
- ;; Reconstruct a string from the pieces.
- (setq matches (cons (substring string start l) matches)) ; leftover
- (apply #'concat (nreverse matches))))))
+ (setq result t)))))))))
;; `default-toplevel-value' has been declared in Emacs 24.
(unless (fboundp 'default-toplevel-value)
(defalias 'default-toplevel-value 'symbol-value))
-;; `format-message' is new in Emacs 25, and does not exist in XEmacs.
+;; `format-message' is new in Emacs 25.
(unless (fboundp 'format-message)
(defalias 'format-message 'format))
-;; `delete-dups' does not exist in XEmacs 21.4.
-(if (fboundp 'delete-dups)
- (defalias 'tramp-compat-delete-dups 'delete-dups)
- (defun tramp-compat-delete-dups (list)
- "Destructively remove `equal' duplicates from LIST.
-Store the result in LIST and return it. LIST must be a proper list.
-Of several `equal' occurrences of an element in LIST, the first
-one is kept."
- (tramp-compat-funcall
- 'cl-delete-duplicates list '(:test equal :from-end) nil)))
-
(add-hook 'tramp-unload-hook
(lambda ()
(unload-feature 'tramp-loaddefs 'force)
(defvar ange-ftp-name-format)
;; Disable Ange-FTP from file-name-handler-alist.
-;; To handle EFS, the following functions need to be dealt with:
-;;
-;; * dired-before-readin-hook contains efs-dired-before-readin
-;; * file-name-handler-alist contains efs-file-handler-function
-;; and efs-root-handler-function and efs-sifn-handler-function
-;; * find-file-hooks contains efs-set-buffer-mode
-;;
-;; But it won't happen for EFS since the XEmacs maintainers
-;; don't want to use a unified filename syntax.
(defun tramp-disable-ange-ftp ()
"Turn Ange-FTP off.
This is useful for unified remoting. See
;; ... and add it to the method list.
;;;###tramp-autoload
-(unless (featurep 'xemacs)
- (add-to-list 'tramp-methods (cons tramp-ftp-method nil))
+(add-to-list 'tramp-methods (cons tramp-ftp-method nil))
- ;; Add some defaults for `tramp-default-method-alist'.
- (add-to-list 'tramp-default-method-alist
- (list "\\`ftp\\." nil tramp-ftp-method))
- (add-to-list 'tramp-default-method-alist
- (list nil "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method)))
+;; Add some defaults for `tramp-default-method-alist'.
+;;;###tramp-autoload
+(add-to-list 'tramp-default-method-alist
+ (list "\\`ftp\\." nil tramp-ftp-method))
+;;;###tramp-autoload
+(add-to-list 'tramp-default-method-alist
+ (list nil "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method))
;; Add completion function for FTP method.
;;;###tramp-autoload
tramp-ftp-method))
;;;###tramp-autoload
-(unless (featurep 'xemacs)
- (add-to-list 'tramp-foreign-file-name-handler-alist
- (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler)))
+(add-to-list 'tramp-foreign-file-name-handler-alist
+ (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler))
(add-hook 'tramp-unload-hook
(lambda ()
(directory-files . tramp-handle-directory-files)
(directory-files-and-attributes
. tramp-handle-directory-files-and-attributes)
- (dired-call-process . ignore)
(dired-compress-file . ignore)
(dired-uncache . tramp-handle-dired-uncache)
(expand-file-name . tramp-gvfs-handle-expand-file-name)
(shell-command . ignore)
(start-file-process . ignore)
(substitute-in-file-name . tramp-handle-substitute-in-file-name)
- (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
+ (unhandled-file-name-directory . ignore)
(vc-registered . ignore)
(verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
(write-region . tramp-gvfs-handle-write-region))
(put 'with-tramp-dbus-call-method 'lisp-indent-function 2)
(put 'with-tramp-dbus-call-method 'edebug-form-spec '(form symbolp body))
-(tramp-compat-font-lock-add-keywords
- 'emacs-lisp-mode '("\\<with-tramp-dbus-call-method\\>"))
+(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-tramp-dbus-call-method\\>"))
(defvar tramp-gvfs-dbus-event-vector nil
"Current Tramp file name to be used, as vector.
(and t2 (not (tramp-gvfs-file-name-p newname))))
;; We cannot copy or rename directly.
+ ;; PRESERVE-EXTENDED-ATTRIBUTES has been introduced with
+ ;; Emacs 24.1 (as PRESERVE-SELINUX-CONTEXT), and renamed
+ ;; in Emacs 24.3.
(let ((tmpfile (tramp-compat-make-temp-file filename)))
(cond
(preserve-extended-attributes
- (tramp-compat-funcall
+ (funcall
file-operation
filename tmpfile t keep-date preserve-uid-gid
preserve-extended-attributes))
- (preserve-uid-gid
- (tramp-compat-funcall
- file-operation filename tmpfile t keep-date preserve-uid-gid))
(t
- (tramp-compat-funcall
- file-operation filename tmpfile t keep-date)))
+ (funcall
+ file-operation filename tmpfile t keep-date preserve-uid-gid)))
(rename-file tmpfile newname ok-if-already-exists))
;; Direct action.
(tramp-gvfs-do-copy-or-rename-file
'copy filename newname ok-if-already-exists keep-date
preserve-uid-gid preserve-extended-attributes))
- ;; Compat section.
+ ;; Compat section. PRESERVE-EXTENDED-ATTRIBUTES has been
+ ;; introduced with Emacs 24.1 (as PRESERVE-SELINUX-CONTEXT), and
+ ;; renamed in Emacs 24.3.
(preserve-extended-attributes
(tramp-run-real-handler
'copy-file
(list filename newname ok-if-already-exists keep-date
preserve-uid-gid preserve-extended-attributes)))
- (preserve-uid-gid
- (tramp-run-real-handler
- 'copy-file
- (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))
(t
(tramp-run-real-handler
- 'copy-file (list filename newname ok-if-already-exists keep-date)))))
+ 'copy-file
+ (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))))
(defun tramp-gvfs-handle-delete-directory (directory &optional recursive trash)
"Like `delete-directory' for Tramp files."
(tramp-error
v 'file-error
"Cannot make local copy of non-existing file `%s'" filename))
- (copy-file filename tmpfile t t)
+ (copy-file filename tmpfile 'ok-if-already-exists 'keep-time)
tmpfile)))
(defun tramp-gvfs-handle-file-name-all-completions (filename directory)
(when cache-hit (list cache-hit))))
;; We cannot use a length of 0, because file properties
;; for "foo" and "foo/" are identical.
- (tramp-compat-number-sequence (length filename) 1 -1)))))
+ (number-sequence (length filename) 1 -1)))))
;; Cache expired or no matching cache entry found so we need
;; to perform a remote operation.
(tramp-message
v 6 "Run `%s', %S" (mapconcat 'identity (process-command p) " ") p)
(tramp-set-connection-property p "vector" v)
- (tramp-compat-process-put p 'events events)
- (tramp-compat-process-put p 'watch-name localname)
- (tramp-compat-set-process-query-on-exit-flag p nil)
+ (process-put p 'events events)
+ (process-put p 'watch-name localname)
+ (set-process-query-on-exit-flag p nil)
(set-process-filter p 'tramp-gvfs-monitor-file-process-filter)
;; There might be an error if the monitor is not supported.
;; Give the filter a chance to read the output.
(defun tramp-gvfs-monitor-file-process-filter (proc string)
"Read output from \"gvfs-monitor-file\" and add corresponding \
file-notify events."
- (let* ((rest-string (tramp-compat-process-get proc 'rest-string))
+ (let* ((rest-string (process-get proc 'rest-string))
(dd (with-current-buffer (process-buffer proc) default-directory))
(ddu (regexp-quote (tramp-gvfs-url-file-name dd))))
(when rest-string
(tramp-message proc 6 "%S\n%s" proc string)
(setq string (concat rest-string string)
;; Attribute change is returned in unused wording.
- string (tramp-compat-replace-regexp-in-string
+ string (replace-regexp-in-string
"ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string))
(when (string-match "Monitoring not supported" string)
(delete-process proc))
string)
(let ((file (match-string 1 string))
(action (intern-soft
- (tramp-compat-replace-regexp-in-string
+ (replace-regexp-in-string
"_" "-" (downcase (match-string 2 string))))))
(setq string (replace-match "" nil nil string))
;; File names are returned as URL paths. We must convert them.
;; Save rest of the string.
(when (zerop (length string)) (setq string nil))
(when string (tramp-message proc 10 "Rest string:\n%s" string))
- (tramp-compat-process-put proc 'rest-string string)))
+ (process-put proc 'rest-string string)))
(defun tramp-gvfs-handle-file-readable-p (filename)
"Like `file-readable-p' for Tramp files."
(with-parsed-tramp-file-name filename nil
- (with-tramp-file-property v localname "file-executable-p"
+ (with-tramp-file-property v localname "file-readable-p"
(tramp-check-cached-permissions v ?r))))
(defun tramp-gvfs-handle-file-writable-p (filename)
(if (or (tramp-tramp-file-p filename)
(tramp-tramp-file-p newname))
(tramp-gvfs-do-copy-or-rename-file
- 'rename filename newname ok-if-already-exists t t)
+ 'rename filename newname ok-if-already-exists
+ 'keep-date 'preserve-uid-gid)
(tramp-run-real-handler
'rename-file (list filename newname ok-if-already-exists))))
(start end filename &optional append visit lockname confirm)
"Like `write-region' for Tramp files."
(with-parsed-tramp-file-name filename nil
- ;; XEmacs takes a coding system as the seventh argument, not `confirm'.
- (when (and (not (featurep 'xemacs)) confirm (file-exists-p filename))
+ (when (and confirm (file-exists-p filename))
(unless (y-or-n-p (format "File %s exists; overwrite anyway? " filename))
(tramp-error v 'file-error "File not overwritten")))
(defun tramp-gvfs-file-name (object-path)
"Retrieve file name from D-Bus OBJECT-PATH."
(dbus-unescape-from-identifier
- (tramp-compat-replace-regexp-in-string
- "^.*/\\([^/]+\\)$" "\\1" object-path)))
+ (replace-regexp-in-string "^.*/\\([^/]+\\)$" "\\1" object-path)))
(defun tramp-bluez-address (device)
"Return bluetooth device address from a given bluetooth DEVICE name."
;; host signature.
(with-temp-buffer
;; Preserve message for `progress-reporter'.
- (tramp-compat-with-temp-message ""
+ (with-temp-message ""
(insert message)
(pop-to-buffer (current-buffer))
(setq choice (if (yes-or-no-p (concat (car choices) " ")) 0 1))
:name (tramp-buffer-name vec)
:buffer (tramp-get-connection-buffer vec)
:server t :host 'local :service t)))
- (tramp-compat-set-process-query-on-exit-flag p nil)))
+ (set-process-query-on-exit-flag p nil)))
(unless (tramp-gvfs-connection-mounted-p vec)
(let* ((method (tramp-file-name-method vec))
'split-string
(shell-command-to-string (format "avahi-browse -trkp %s" service))
"[\n\r]+" 'omit "^\\+;.*$"))))
- (tramp-compat-delete-dups
+ (delete-dups
(mapcar
(lambda (x)
(let* ((list (split-string x ";"))
tramp-gw-vector 4
"Opening auxiliary process `%s', speaking with process `%s'"
proc tramp-gw-gw-proc)
- (tramp-compat-set-process-query-on-exit-flag proc nil)
+ (set-process-query-on-exit-flag proc nil)
;; We don't want debug messages, because the corresponding debug
;; buffer might be undecided.
(let ((tramp-verbose 0))
:name (tramp-buffer-name aux-vec) :buffer nil :host 'local
:server t :noquery t :service t :coding 'binary))
(set-process-sentinel tramp-gw-aux-proc 'tramp-gw-aux-proc-sentinel)
- (tramp-compat-set-process-query-on-exit-flag tramp-gw-aux-proc nil)
+ (set-process-query-on-exit-flag tramp-gw-aux-proc nil)
(tramp-message
vec 4 "Opening auxiliary process `%s', listening on port %d"
tramp-gw-aux-proc (process-contact tramp-gw-aux-proc :service))))
(tramp-file-name-port target-vec)))
(set-process-sentinel tramp-gw-gw-proc 'tramp-gw-gw-proc-sentinel)
(set-process-coding-system tramp-gw-gw-proc 'binary 'binary)
- (tramp-compat-set-process-query-on-exit-flag tramp-gw-gw-proc nil)
+ (set-process-query-on-exit-flag tramp-gw-gw-proc nil)
(tramp-message
vec 4 "Opened %s process `%s'"
(case gw-method ('tunnel "HTTP tunnel") ('socks "SOCKS"))
(setq proc (open-network-stream
name buffer (nth 1 socks-server) (nth 2 socks-server)))
(set-process-coding-system proc 'binary 'binary)
- (tramp-compat-set-process-query-on-exit-flag proc nil)
+ (set-process-query-on-exit-flag proc nil)
;; Send CONNECT command.
(process-send-string proc (format "%s%s\r\n" command authentication))
(tramp-message
tramp-gw-vector 6 "\n%s"
(format
"%s%s\r\n" command
- (tramp-compat-replace-regexp-in-string ;; no password in trace!
+ (replace-regexp-in-string ;; no password in trace!
"Basic [^\r\n]+" "Basic xxxxx" authentication t)))
(with-current-buffer buffer
;; Trap errors to be traced in the right trace buffer. Often,
(eval-when-compile
(require 'cl)
(require 'dired))
-(defvar directory-sep-char)
(defvar tramp-gw-tunnel-method)
(defvar tramp-gw-socks-method)
(defvar vc-handled-backends)
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "pscp")
(tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k")
- ("-q") ("-r")))
- (tramp-copy-keep-date t)
- (tramp-copy-recursive t)))
+ ("-q")))
+ (tramp-copy-keep-date t)))
;;;###tramp-autoload
(add-to-list 'tramp-methods
'("fcp"
(directory-files . tramp-handle-directory-files)
(directory-files-and-attributes
. tramp-sh-handle-directory-files-and-attributes)
- ;; `dired-call-process' performed by default handler.
(dired-compress-file . tramp-sh-handle-dired-compress-file)
- (dired-recursive-delete-directory
- . tramp-sh-handle-dired-recursive-delete-directory)
(dired-uncache . tramp-handle-dired-uncache)
(expand-file-name . tramp-sh-handle-expand-file-name)
(file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
;; `get-file-buffer' performed by default handler.
(insert-directory . tramp-sh-handle-insert-directory)
(insert-file-contents . tramp-handle-insert-file-contents)
- (insert-file-contents-literally
- . tramp-sh-handle-insert-file-contents-literally)
(load . tramp-handle-load)
(make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
(make-directory . tramp-sh-handle-make-directory)
(shell-command . tramp-handle-shell-command)
(start-file-process . tramp-sh-handle-start-file-process)
(substitute-in-file-name . tramp-handle-substitute-in-file-name)
- (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
+ (unhandled-file-name-directory . ignore)
(vc-registered . tramp-sh-handle-vc-registered)
(verify-visited-file-modtime . tramp-sh-handle-verify-visited-file-modtime)
(write-region . tramp-sh-handle-write-region))
(format "tramp_perl_file_truename %s"
(tramp-shell-quote-argument localname)))))
- ;; Do it yourself. We bind `directory-sep-char' here for
- ;; XEmacs on Windows, which would otherwise use backslash.
- (t (let ((directory-sep-char ?/)
- (steps (tramp-compat-split-string localname "/"))
+ ;; Do it yourself.
+ (t (let ((steps (split-string localname "/" 'omit))
(thisstep nil)
(numchase 0)
;; Don't make the following value larger than
symlink-target))
(setq symlink-target localname))
(setq steps
- (append (tramp-compat-split-string
- symlink-target "/")
- steps)))
+ (append
+ (split-string symlink-target "/" 'omit) steps)))
(t
;; It's a file.
(setq result (cons thisstep result)))))
res-gid
;; 4. Last access time, as a list of integers. Normally
;; this would be in the same format as `current-time', but
- ;; the subseconds part is not currently implemented, and (0
- ;; 0) denotes an unknown time.
+ ;; the subseconds part is not currently implemented, and
+ ;; (0 0) denotes an unknown time.
;; 5. Last modification time, likewise.
;; 6. Last status change time, likewise.
'(0 0) '(0 0) '(0 0) ;CCC how to find out?
;; 10. Inode number.
res-inode
;; 11. Device number. Will be replaced by a virtual device number.
- -1
- ))))))
+ -1))))))
(defun tramp-do-file-attributes-with-perl
(vec localname &optional id-format)
(attr (file-attributes f))
;; '(-1 65535) means file doesn't exists yet.
(modtime (or (nth 5 attr) '(-1 65535))))
- (when (boundp 'last-coding-system-used)
- (setq coding-system-used (symbol-value 'last-coding-system-used)))
+ (setq coding-system-used last-coding-system-used)
;; We use '(0 0) as a don't-know value. See also
;; `tramp-do-file-attributes-with-ls'.
(if (not (equal modtime '(0 0)))
(setq attr (buffer-substring (point) (point-at-eol))))
(tramp-set-file-property
v localname "visited-file-modtime-ild" attr))
- (when (boundp 'last-coding-system-used)
- (set 'last-coding-system-used coding-system-used))
+ (setq last-coding-system-used coding-system-used)
nil)))))
;; This function makes the same assumption as
;; connection.
(if (or (not f)
(eq (visited-file-modtime) 0)
- (not (tramp-file-name-handler 'file-remote-p f nil 'connected)))
+ (not (file-remote-p f nil 'connected)))
t
(with-parsed-tramp-file-name f nil
(let* ((remote-file-name-inhibit-cache t)
;; FIXME: extract the proper text from chmod's stderr.
(tramp-barf-unless-okay
v
- (format "chmod %s %s"
- (tramp-compat-decimal-to-octal mode)
- (tramp-shell-quote-argument localname))
+ (format "chmod %o %s" mode (tramp-shell-quote-argument localname))
"Error while changing file's mode %s" filename)))
(defun tramp-sh-handle-set-file-times (filename &optional time)
"Like `set-file-times' for Tramp files."
- (if (tramp-tramp-file-p filename)
- (with-parsed-tramp-file-name filename nil
- (when (tramp-get-remote-touch v)
- (tramp-flush-file-property v (file-name-directory localname))
- (tramp-flush-file-property v localname)
- (let ((time (if (or (null time) (equal time '(0 0)))
- (current-time)
- time))
- ;; With GNU Emacs, `format-time-string' has an
- ;; optional parameter UNIVERSAL. This is preferred,
- ;; because we could handle the case when the remote
- ;; host is located in a different time zone as the
- ;; local host.
- (utc (not (featurep 'xemacs))))
- (tramp-send-command-and-check
- v (format
- "%s %s %s %s"
- (if utc "env TZ=UTC" "")
- (tramp-get-remote-touch v)
- (if (tramp-get-connection-property v "touch-t" nil)
- (format "-t %s"
- (if utc
- (format-time-string "%Y%m%d%H%M.%S" time t)
- (format-time-string "%Y%m%d%H%M.%S" time)))
- "")
- (tramp-shell-quote-argument localname))))))
-
- ;; We handle also the local part, because in older Emacsen,
- ;; without `set-file-times', this function is an alias for this.
- ;; We are local, so we don't need the UTC settings.
- (zerop
- (tramp-call-process
- nil "touch" nil nil nil "-t"
- (format-time-string "%Y%m%d%H%M.%S" time)
- (tramp-shell-quote-argument filename)))))
+ (with-parsed-tramp-file-name filename nil
+ (when (tramp-get-remote-touch v)
+ (tramp-flush-file-property v (file-name-directory localname))
+ (tramp-flush-file-property v localname)
+ (let ((time (if (or (null time) (equal time '(0 0)))
+ (current-time)
+ time)))
+ (tramp-send-command-and-check
+ v (format
+ "env TZ=UTC %s %s %s"
+ (tramp-get-remote-touch v)
+ (if (tramp-get-connection-property v "touch-t" nil)
+ (format "-t %s" (format-time-string "%Y%m%d%H%M.%S" time t))
+ "")
+ (tramp-shell-quote-argument localname)))))))
(defun tramp-set-file-uid-gid (filename &optional uid gid)
"Set the ownership for FILENAME.
(goto-char (point-max))
(delete-blank-lines)
(when (> (point-max) (point-min))
- (tramp-compat-funcall
- 'substring-no-properties (buffer-string))))))))
+ (substring-no-properties (buffer-string))))))))
(defun tramp-sh-handle-set-file-acl (filename acl-string)
"Like `set-file-acl' for Tramp files."
(when cache-hit (list cache-hit))))
;; We cannot use a length of 0, because file properties
;; for "foo" and "foo/" are identical.
- (tramp-compat-number-sequence (length filename) 1 -1)))))
+ (number-sequence (length filename) 1 -1)))))
;; Cache expired or no matching cache entry found so we need
;; to perform a remote operation.
(format "tramp_perl_file_name_all_completions %s %s %d"
(tramp-shell-quote-argument localname)
(tramp-shell-quote-argument filename)
- (if (symbol-value
- ;; `read-file-name-completion-ignore-case'
- ;; is introduced with Emacs 22.1.
- (if (boundp
- 'read-file-name-completion-ignore-case)
- 'read-file-name-completion-ignore-case
- 'completion-ignore-case))
- 1 0)))
+ (if read-file-name-completion-ignore-case 1 0)))
(format (concat
"(cd %s 2>&1 && (%s -a %s 2>/dev/null"
(tramp-do-copy-or-rename-file
'copy filename newname ok-if-already-exists keep-date
preserve-uid-gid preserve-extended-attributes))
- ;; Compat section.
+ ;; Compat section. PRESERVE-EXTENDED-ATTRIBUTES has been
+ ;; introduced with Emacs 24.1 (as PRESERVE-SELINUX-CONTEXT), and
+ ;; renamed in Emacs 24.3.
(preserve-extended-attributes
(tramp-run-real-handler
'copy-file
(list filename newname ok-if-already-exists keep-date
preserve-uid-gid preserve-extended-attributes)))
- (preserve-uid-gid
- (tramp-run-real-handler
- 'copy-file
- (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))
(t
(tramp-run-real-handler
- 'copy-file (list filename newname ok-if-already-exists keep-date)))))
+ 'copy-file
+ (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))))
(defun tramp-sh-handle-copy-directory
(dirname newname &optional keep-date parents copy-contents)
(if (or (tramp-tramp-file-p filename)
(tramp-tramp-file-p newname))
(tramp-do-copy-or-rename-file
- 'rename filename newname ok-if-already-exists t t)
+ 'rename filename newname ok-if-already-exists
+ 'keep-time 'preserve-uid-gid)
(tramp-run-real-handler
'rename-file (list filename newname ok-if-already-exists))))
op))))
(localname1
(if t1
- (tramp-file-name-handler 'file-remote-p filename 'localname)
+ (file-remote-p filename 'localname)
filename))
(localname2
(if t2
- (tramp-file-name-handler 'file-remote-p newname 'localname)
+ (file-remote-p newname 'localname)
newname))
(prefix (file-remote-p (if t1 filename newname)))
cmd-result)
(zerop
(logand
(file-modes (file-name-directory localname1))
- (tramp-compat-octal-to-decimal "1000"))))
+ (string-to-number "1000" 8))))
(file-writable-p (file-name-directory localname2))
(or (file-directory-p localname2)
(file-writable-p localname2))))
(if (eq op 'copy)
- (tramp-compat-copy-file
+ (copy-file
localname1 localname2 ok-if-already-exists
keep-date preserve-uid-gid)
(tramp-run-real-handler
;; Since this does not work reliable, we also
;; give read permissions.
(set-file-modes
- (concat prefix tmpfile)
- (tramp-compat-octal-to-decimal "0777"))
+ (concat prefix tmpfile) (string-to-number "0777" 8))
(tramp-set-file-uid-gid
(concat prefix tmpfile)
(tramp-get-local-uid 'integer)
(tramp-get-local-gid 'integer)))
(t2
(if (eq op 'copy)
- (tramp-compat-copy-file
+ (copy-file
localname1 tmpfile t
keep-date preserve-uid-gid)
(tramp-run-real-handler
;; We must change the ownership as local user.
;; Since this does not work reliable, we also
;; give read permissions.
- (set-file-modes
- tmpfile (tramp-compat-octal-to-decimal "0777"))
+ (set-file-modes tmpfile (string-to-number "0777" 8))
(tramp-set-file-uid-gid
tmpfile
(tramp-get-remote-uid v 'integer)
;; Save exit.
(ignore-errors
(if dir-flag
- (tramp-compat-delete-directory
+ (delete-directory
(expand-file-name ".." tmpfile) 'recursive)
(delete-file tmpfile)))))
orig-vec 6 "%s"
(mapconcat 'identity (process-command p) " "))
(tramp-set-connection-property p "vector" orig-vec)
- (tramp-compat-set-process-query-on-exit-flag p nil)
+ (set-process-query-on-exit-flag p nil)
;; We must adapt `tramp-local-end-of-line' for
;; sending the password.
(unless (eq op 'copy)
(if (file-regular-p filename)
(delete-file filename)
- (tramp-compat-delete-directory filename 'recursive))))))
+ (delete-directory filename 'recursive))))))
(defun tramp-sh-handle-make-directory (dir &optional parents)
"Like `make-directory' for Tramp files."
;; Dired.
-;; CCC: This does not seem to be enough. Something dies when
-;; we try and delete two directories under Tramp :/
-(defun tramp-sh-handle-dired-recursive-delete-directory (filename)
- "Recursively delete the directory given.
-This is like `dired-recursive-delete-directory' for Tramp files."
- (with-parsed-tramp-file-name filename nil
- ;; Run a shell command 'rm -r <localname>'.
- ;; Code shamelessly stolen from the dired implementation and, um, hacked :)
- (unless (file-exists-p filename)
- (tramp-error v 'file-error "No such directory: %s" filename))
- ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>).
- (tramp-send-command
- v
- (format "rm -rf %s" (tramp-shell-quote-argument localname))
- ;; Don't read the output, do it explicitly.
- nil t)
- ;; Wait for the remote system to return to us...
- ;; This might take a while, allow it plenty of time.
- (tramp-wait-for-output (tramp-get-connection-process v) 120)
- ;; Make sure that it worked...
- (tramp-flush-file-property v (file-name-directory localname))
- (tramp-flush-directory-property v localname)
- (and (file-exists-p filename)
- (tramp-error
- v 'file-error "Failed to recursively delete %s" filename))))
+(defvar dired-compress-file-suffixes)
+(declare-function dired-remove-file "dired-aux")
-(defun tramp-sh-handle-dired-compress-file (file &rest _ok-flag)
+(defun tramp-sh-handle-dired-compress-file (file)
"Like `dired-compress-file' for Tramp files."
- ;; OK-FLAG is valid for XEmacs only, but not implemented.
;; Code stolen mainly from dired-aux.el.
(with-parsed-tramp-file-name file nil
(tramp-flush-file-property v localname)
(save-excursion
- (let ((suffixes
- (if (not (featurep 'xemacs))
- ;; Emacs case
- (symbol-value 'dired-compress-file-suffixes)
- ;; XEmacs has `dired-compression-method-alist', which is
- ;; transformed into `dired-compress-file-suffixes' structure.
- (mapcar
- (lambda (x)
- (list (concat (regexp-quote (nth 1 x)) "\\'")
- nil
- (mapconcat 'identity (nth 3 x) " ")))
- (symbol-value 'dired-compression-method-alist))))
+ (let ((suffixes dired-compress-file-suffixes)
suffix)
;; See if any suffix rule matches this file name.
(while suffixes
(when (tramp-send-command-and-check
v (concat (nth 2 suffix) " "
(tramp-shell-quote-argument localname)))
- ;; `dired-remove-file' is not defined in XEmacs.
- (tramp-compat-funcall 'dired-remove-file file)
+ (dired-remove-file file)
(string-match (car suffix) file)
(concat (substring file 0 (match-beginning 0))))))
(t
(when (tramp-send-command-and-check
v (concat "gzip -f "
(tramp-shell-quote-argument localname)))
- ;; `dired-remove-file' is not defined in XEmacs.
- (tramp-compat-funcall 'dired-remove-file file)
+ (dired-remove-file file)
(cond ((file-exists-p (concat file ".gz"))
(concat file ".gz"))
((file-exists-p (concat file ".z"))
;; Decode the output, it could be multibyte.
(decode-coding-region
beg (point-max)
- (or file-name-coding-system
- (and (boundp 'default-file-name-coding-system)
- (symbol-value 'default-file-name-coding-system))))
+ (or file-name-coding-system default-file-name-coding-system))
;; The inserted file could be from somewhere else.
(when (and (not wildcard) (not full-directory-p))
(while (string-match "//" localname)
(setq localname (replace-match "/" t t localname)))
;; No tilde characters in file name, do normal
- ;; `expand-file-name' (this does "/./" and "/../"). We bind
- ;; `directory-sep-char' here for XEmacs on Windows, which would
- ;; otherwise use backslash. `default-directory' is bound,
- ;; because on Windows there would be problems with UNC shares or
- ;; Cygwin mounts.
- (let ((directory-sep-char ?/)
- (default-directory (tramp-compat-temporary-file-directory)))
+ ;; `expand-file-name' (this does "/./" and "/../").
+ ;; `default-directory' is bound, because on Windows there would
+ ;; be problems with UNC shares or Cygwin mounts.
+ (let ((default-directory (tramp-compat-temporary-file-directory)))
(tramp-make-tramp-file-name
method user host
(tramp-drop-volume-letter
;; Send the command.
(tramp-send-command v command nil t) ; nooutput
;; Check, whether a pty is associated.
- (unless (tramp-compat-process-get
+ (unless (process-get
(tramp-get-connection-process v) 'remote-tty)
(tramp-error
v 'file-error
;; process. We ignore errors, because the process
;; could have finished already.
(ignore-errors
- (tramp-compat-set-process-query-on-exit-flag p t)
+ (set-process-query-on-exit-flag p t)
(set-marker (process-mark p) (point)))
;; Return process.
p))))
;; because the remote process could have changed them.
(when tmpinput (delete-file tmpinput))
- ;; `process-file-side-effects' has been introduced with GNU
- ;; Emacs 23.2. If set to nil, no remote file will be changed
- ;; by `program'. If it doesn't exist, we assume its default
- ;; value t.
- (unless (and (boundp 'process-file-side-effects)
- (not (symbol-value 'process-file-side-effects)))
+ (unless process-file-side-effects
(tramp-flush-directory-property v ""))
;; Return exit status.
;; `copy-file' handles direct copy and out-of-band methods.
((or (tramp-local-host-p v)
(tramp-method-out-of-band-p v size))
- (copy-file filename tmpfile t t))
+ (copy-file filename tmpfile 'ok-if-already-exists 'keep-time))
;; Use inline encoding for file transfer.
(rem-enc
(run-hooks 'tramp-handle-file-local-copy-hook)
tmpfile)))
-;; This is needed for XEmacs only. Code stolen from files.el.
-(defun tramp-sh-handle-insert-file-contents-literally
- (filename &optional visit beg end replace)
- "Like `insert-file-contents-literally' for Tramp files."
- (let ((format-alist nil)
- (after-insert-file-functions nil)
- (coding-system-for-read 'no-conversion)
- (coding-system-for-write 'no-conversion)
- (find-buffer-file-type-function
- (if (fboundp 'find-buffer-file-type)
- (symbol-function 'find-buffer-file-type)
- nil))
- (inhibit-file-name-handlers
- '(epa-file-handler image-file-handler jka-compr-handler))
- (inhibit-file-name-operation 'insert-file-contents))
- (unwind-protect
- (progn
- (fset 'find-buffer-file-type (lambda (_filename) t))
- (insert-file-contents filename visit beg end replace))
- ;; Save exit.
- (if find-buffer-file-type-function
- (fset 'find-buffer-file-type find-buffer-file-type-function)
- (fmakunbound 'find-buffer-file-type)))))
-
;; CCC grok LOCKNAME
(defun tramp-sh-handle-write-region
(start end filename &optional append visit lockname confirm)
;; (error
;; "tramp-sh-handle-write-region: LOCKNAME must be nil or equal FILENAME"))
- ;; XEmacs takes a coding system as the seventh argument, not `confirm'.
- (when (and (not (featurep 'xemacs)) confirm (file-exists-p filename))
+ (when (and confirm (file-exists-p filename))
(unless (y-or-n-p (format "File %s exists; overwrite anyway? " filename))
(tramp-error v 'file-error "File not overwritten")))
- (let ((uid (or (nth 2 (tramp-compat-file-attributes filename 'integer))
+ (let ((uid (or (nth 2 (file-attributes filename 'integer))
(tramp-get-remote-uid v 'integer)))
- (gid (or (nth 3 (tramp-compat-file-attributes filename 'integer))
+ (gid (or (nth 3 (file-attributes filename 'integer))
(tramp-get-remote-gid v 'integer))))
(if (and (tramp-local-host-p v)
(signal (car err) (cdr err))))
;; Now, `last-coding-system-used' has the right value. Remember it.
- (when (boundp 'last-coding-system-used)
- (setq coding-system-used
- (symbol-value 'last-coding-system-used))))
+ (setq coding-system-used last-coding-system-used))
;; The permissions of the temporary file should be set. If
;; FILENAME does not exist (eq modes nil) it has been
(when modes
(set-file-modes
tmpfile
- (logior (or modes 0) (tramp-compat-octal-to-decimal "0400"))))
+ (logior (or modes 0) (string-to-number "0400" 8))))
;; This is a bit lengthy due to the different methods
;; possible for file transfer. First, we check whether the
(let (last-coding-system-used (need-chown t))
;; Set file modification time.
(when (or (eq visit t) (stringp visit))
- (let ((file-attr (tramp-compat-file-attributes filename 'integer)))
+ (let ((file-attr (file-attributes filename 'integer)))
(set-visited-file-modtime
;; We must pass modtime explicitly, because FILENAME can
;; be different from (buffer-file-name), f.e. if
;; any other remote command.
(defun tramp-sh-handle-vc-registered (file)
"Like `vc-registered' for Tramp files."
- (tramp-compat-with-temp-message ""
+ (with-temp-message ""
(with-parsed-tramp-file-name file nil
(with-tramp-progress-reporter
v 3 (format-message "Checking `vc-registered' for %s" file)
(tramp-message v 6 "Run `%s', %S" (mapconcat 'identity sequence " ") p)
(tramp-set-connection-property p "vector" v)
;; Needed for `tramp-sh-gvfs-monitor-dir-process-filter'.
- (tramp-compat-process-put p 'events events)
- (tramp-compat-process-put p 'watch-name localname)
- (tramp-compat-set-process-query-on-exit-flag p nil)
+ (process-put p 'events events)
+ (process-put p 'watch-name localname)
+ (set-process-query-on-exit-flag p nil)
(set-process-filter p filter)
;; There might be an error if the monitor is not supported.
;; Give the filter a chance to read the output.
(let ((remote-prefix
(with-current-buffer (process-buffer proc)
(file-remote-p default-directory)))
- (rest-string (tramp-compat-process-get proc 'rest-string)))
+ (rest-string (process-get proc 'rest-string)))
(when rest-string
(tramp-message proc 10 "Previous string:\n%s" rest-string))
(tramp-message proc 6 "%S\n%s" proc string)
(setq string (concat rest-string string)
;; Attribute change is returned in unused wording.
- string (tramp-compat-replace-regexp-in-string
+ string (replace-regexp-in-string
"ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string))
(when (string-match "Monitoring not supported" string)
(delete-process proc))
(list
proc
(intern-soft
- (tramp-compat-replace-regexp-in-string
+ (replace-regexp-in-string
"_" "-" (downcase (match-string 4 string))))
;; File names are returned as absolute paths. We must
;; add the remote prefix.
(setq string (replace-match "" nil nil string))
;; Remove watch when file or directory to be watched is deleted.
(when (and (member (cadr object) '(moved deleted))
- (string-equal
- file (tramp-compat-process-get proc 'watch-name)))
+ (string-equal file (process-get proc 'watch-name)))
(delete-process proc))
;; Usually, we would add an Emacs event now. Unfortunately,
;; `unread-command-events' does not accept several events at
;; once. Therefore, we apply the callback directly.
- (when (member (cadr object) (tramp-compat-process-get proc 'events))
+ (when (member (cadr object) (process-get proc 'events))
(tramp-compat-funcall 'file-notify-callback object))))
;; Save rest of the string.
(when (zerop (length string)) (setq string nil))
(when string (tramp-message proc 10 "Rest string:\n%s" string))
- (tramp-compat-process-put proc 'rest-string string)))
+ (process-put proc 'rest-string string)))
(defun tramp-sh-inotifywait-process-filter (proc string)
"Read output from \"inotifywait\" and add corresponding file-notify events."
(tramp-message proc 6 "%S\n%s" proc string)
- (dolist (line (split-string string "[\n\r]+" 'omit-nulls))
+ (dolist (line (split-string string "[\n\r]+" 'omit))
;; Check, whether there is a problem.
(unless
(string-match
(mapcar
(lambda (x)
(intern-soft
- (tramp-compat-replace-regexp-in-string "_" "-" (downcase x))))
- (split-string (match-string 1 line) "," 'omit-nulls))
+ (replace-regexp-in-string "_" "-" (downcase x))))
+ (split-string (match-string 1 line) "," 'omit))
(match-string 3 line))))
;; Remove watch when file or directory to be watched is deleted.
(when (equal (cadr object) 'ignored)
vec 5 (format-message "Sending script `%s'" name)
;; In bash, leading TABs like in `tramp-vc-registered-read-file-names'
;; could result in unwanted command expansion. Avoid this.
- (setq script (tramp-compat-replace-regexp-in-string
+ (setq script (replace-regexp-in-string
(make-string 1 ?\t) (make-string 8 ? ) script))
;; The script could contain a call of Perl. This is masked with `%s'.
(when (and (string-match "%s" script)
(setq result (concat "\\" progname))))
(unless result
(when ignore-tilde
- ;; Remove all ~/foo directories from dirlist. In XEmacs,
- ;; `remove' is in CL, and we want to avoid CL dependencies.
+ ;; Remove all ~/foo directories from dirlist.
(let (newdl d)
(while dirlist
(setq d (car dirlist))
(let ((cs (or (and (memq 'utf-8 (coding-system-list))
(string-match "utf-?8" (tramp-get-remote-locale vec))
(cons 'utf-8 'utf-8))
- (tramp-compat-funcall 'process-coding-system proc)
+ (process-coding-system proc)
(cons 'undecided 'undecided)))
cs-decode cs-encode)
(when (symbolp cs) (setq cs (cons cs cs)))
(setq cs-decode (or (car cs) 'undecided)
cs-encode (or (cdr cs) 'undecided))
(setq cs-encode
- (tramp-compat-coding-system-change-eol-conversion
+ (coding-system-change-eol-conversion
cs-encode
(if (string-match
"^Darwin" (tramp-get-connection-property vec "uname" ""))
(tramp-send-command vec "echo foo ; echo bar" t)
(goto-char (point-min))
(when (search-forward "\r" nil t)
- (setq cs-decode (tramp-compat-coding-system-change-eol-conversion
+ (setq cs-decode (coding-system-change-eol-conversion
cs-decode 'dos)))
;; Special setting for Mac OS X.
(when (and (string-match
(memq 'utf-8-hfs (coding-system-list)))
(setq cs-decode 'utf-8-hfs
cs-encode 'utf-8-hfs))
- (tramp-compat-funcall
- 'set-buffer-process-coding-system cs-decode cs-encode)
+ (set-buffer-process-coding-system cs-decode cs-encode)
(tramp-message
vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode))
;; Look for ^M and do something useful if found.
;; Set `remote-tty' process property.
(let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"" 'noerror)))
(unless (zerop (length tty))
- (tramp-compat-process-put proc 'remote-tty tty)))
+ (process-put proc 'remote-tty tty)))
;; Dump stty settings in the traces.
(when (>= tramp-verbose 9)
(copy-sequence tramp-remote-process-environment)))
unset vars item)
(while env
- (setq item (tramp-compat-split-string (car env) "="))
+ (setq item (split-string (car env) "=" 'omit))
(setcdr item (mapconcat 'identity (cdr item) "="))
(if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
(push (format "%s %s" (car item) (cdr item)) vars)
value
(format-spec-make
?t
- (tramp-file-name-handler
- 'file-remote-p tmpfile 'localname)))))
+ (file-remote-p tmpfile 'localname)))))
(tramp-maybe-send-script vec value name)
(setq rem-dec name)))
(tramp-message
(push
(vector
(tramp-file-name-method hop) (tramp-file-name-user hop)
- (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil nil)
+ (tramp-gw-open-connection vec gw hop) nil nil)
target-alist)
;; For the password prompt, we need the correct values.
;; Therefore, we must remember the gateway vector. But we
(unless (and p (processp p) (memq (process-status p) '(run open)))
;; If `non-essential' is non-nil, don't reopen a new connection.
+ ;; This variable has been introduced with Emacs 24.1.
(when (and (boundp 'non-essential) (symbol-value 'non-essential))
(throw 'non-essential 'non-essential))
;; Set sentinel and query flag.
(tramp-set-connection-property p "vector" vec)
(set-process-sentinel p 'tramp-process-sentinel)
- (tramp-compat-set-process-query-on-exit-flag p nil)
+ (set-process-query-on-exit-flag p nil)
(setq tramp-current-connection
(cons (butlast (append vec nil) 2) (current-time))
tramp-current-host (system-name))
(when (and (numberp (nth 2 attr)) (< (nth 2 attr) 0))
(setcar (nthcdr 2 attr) -1))
(when (and (floatp (nth 2 attr))
- (<= (nth 2 attr) (tramp-compat-most-positive-fixnum)))
+ (<= (nth 2 attr) most-positive-fixnum))
(setcar (nthcdr 2 attr) (round (nth 2 attr))))
(when (and (numberp (nth 3 attr)) (< (nth 3 attr) 0))
(setcar (nthcdr 3 attr) -1))
(when (and (floatp (nth 3 attr))
- (<= (nth 3 attr) (tramp-compat-most-positive-fixnum)))
+ (<= (nth 3 attr) most-positive-fixnum))
(setcar (nthcdr 3 attr) (round (nth 3 attr))))
;; Convert last access time.
(unless (listp (nth 4 attr))
(when (< (nth 7 attr) 0)
(setcar (nthcdr 7 attr) -1))
(when (and (floatp (nth 7 attr))
- (<= (nth 7 attr) (tramp-compat-most-positive-fixnum)))
+ (<= (nth 7 attr) most-positive-fixnum))
(setcar (nthcdr 7 attr) (round (nth 7 attr))))
;; Convert file mode bits to string.
(unless (stringp (nth 8 attr))
(when elt1
(setcdr elt1
(append
- (tramp-compat-split-string (or default-remote-path "") ":")
+ (split-string (or default-remote-path "") ":" 'omit)
(cdr elt1)))
(setq remote-path (delq 'tramp-default-remote-path remote-path)))
(when elt2
(setcdr elt2
(append
- (tramp-compat-split-string (or own-remote-path "") ":")
+ (split-string (or own-remote-path "") ":" 'omit)
(cdr elt2)))
(setq remote-path (delq 'tramp-own-remote-path remote-path)))
"%s -t %s %s"
result
(format-time-string "%Y%m%d%H%M.%S")
- (tramp-file-name-handler 'file-remote-p tmpfile 'localname))))
+ (file-remote-p tmpfile 'localname))))
(delete-file tmpfile))
result)))
(directory-files . tramp-smb-handle-directory-files)
(directory-files-and-attributes
. tramp-handle-directory-files-and-attributes)
- (dired-call-process . ignore)
(dired-compress-file . ignore)
(dired-uncache . tramp-handle-dired-uncache)
(expand-file-name . tramp-smb-handle-expand-file-name)
(shell-command . tramp-handle-shell-command)
(start-file-process . tramp-smb-handle-start-file-process)
(substitute-in-file-name . tramp-smb-handle-substitute-in-file-name)
- (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
+ (unhandled-file-name-directory . ignore)
(vc-registered . ignore)
(verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
(write-region . tramp-smb-handle-write-region))
(unwind-protect
(progn
(make-directory tmpdir)
- (tramp-compat-copy-directory
- dirname tmpdir keep-date 'parents)
- (tramp-compat-copy-directory
+ (copy-directory dirname tmpdir keep-date 'parents)
+ (copy-directory
(expand-file-name (file-name-nondirectory dirname) tmpdir)
newname keep-date parents))
- (tramp-compat-delete-directory tmpdir 'recursive))))
+ (delete-directory tmpdir 'recursive))))
;; We can copy recursively.
((or t1 t2)
(port (tramp-file-name-port v))
(share (tramp-smb-get-share v))
(localname (file-name-as-directory
- (tramp-compat-replace-regexp-in-string
+ (replace-regexp-in-string
"\\\\" "/" (tramp-smb-get-localname v))))
(tmpdir (make-temp-name
(expand-file-name
(tramp-message
v 6 "%s" (mapconcat 'identity (process-command p) " "))
(tramp-set-connection-property p "vector" v)
- (tramp-compat-set-process-query-on-exit-flag p nil)
+ (set-process-query-on-exit-flag p nil)
(tramp-process-actions p v nil tramp-smb-actions-with-tar)
(while (memq (process-status p) '(run open))
;; Reset the transfer process properties.
(tramp-set-connection-property v "process-name" nil)
(tramp-set-connection-property v "process-buffer" nil)
- (when t1 (tramp-compat-delete-directory tmpdir 'recurse))))
+ (when t1 (delete-directory tmpdir 'recurse))))
;; Handle KEEP-DATE argument.
(when keep-date
0 (format "Copying %s to %s" filename newname)
(if (file-directory-p filename)
- (tramp-compat-copy-directory filename newname keep-date t t)
+ (tramp-compat-copy-directory
+ filename newname keep-date 'parents 'copy-contents)
(let ((tmpfile (file-local-copy filename)))
(if tmpfile
(mapc
(lambda (file)
(if (file-directory-p file)
- (tramp-compat-delete-directory file recursive)
+ (delete-directory file recursive)
(delete-file file)))
;; We do not want to delete "." and "..".
(directory-files
;; Sort them if necessary.
(unless nosort (setq result (sort result 'string-lessp)))
;; Remove double entries.
- (tramp-compat-delete-dups result)))
+ (delete-dups result)))
(defun tramp-smb-handle-expand-file-name (name &optional dir)
"Like `expand-file-name' for Tramp files."
(domain (tramp-file-name-domain v))
(port (tramp-file-name-port v))
(share (tramp-smb-get-share v))
- (localname (tramp-compat-replace-regexp-in-string
+ (localname (replace-regexp-in-string
"\\\\" "/" (tramp-smb-get-localname v)))
(args (list (concat "//" real-host "/" share) "-E")))
(tramp-message
v 6 "%s" (mapconcat 'identity (process-command p) " "))
(tramp-set-connection-property p "vector" v)
- (tramp-compat-set-process-query-on-exit-flag p nil)
+ (set-process-query-on-exit-flag p nil)
(tramp-process-actions p v nil tramp-smb-actions-get-acl)
(when (> (point-max) (point-min))
- (tramp-compat-funcall
- 'substring-no-properties (buffer-string)))))
+ (substring-no-properties (buffer-string)))))
;; Reset the transfer process properties.
(tramp-set-connection-property v "process-name" nil)
(tramp-smb-send-command
v
(if (tramp-smb-get-cifs-capabilities v)
- (format
- "posix_mkdir \"%s\" %s"
- file (tramp-compat-decimal-to-octal (default-file-modes)))
+ (format "posix_mkdir \"%s\" %o" file (default-file-modes))
(format "mkdir \"%s\"" file)))
;; We must also flush the cache of the directory, because
;; `file-attributes' reads the values from there.
(unless outbuf
(kill-buffer (tramp-get-connection-property v "process-buffer" nil)))
- ;; `process-file-side-effects' has been introduced with GNU
- ;; Emacs 23.2. If set to nil, no remote file will be changed
- ;; by `program'. If it doesn't exist, we assume its default
- ;; value t.
- (unless (and (boundp 'process-file-side-effects)
- (not (symbol-value 'process-file-side-effects)))
+ (unless process-file-side-effects
(tramp-flush-directory-property v ""))
;; Return exit status.
(tramp-error v2 'file-error "Cannot rename `%s'" filename))))
;; We must rename via copy.
- (tramp-compat-copy-file filename newname ok-if-already-exists t t t)
+ (copy-file
+ filename newname ok-if-already-exists 'keep-time 'preserve-uid-gid)
(if (file-directory-p filename)
- (tramp-compat-delete-directory filename 'recursive)
+ (delete-directory filename 'recursive)
(delete-file filename)))))
(defun tramp-smb-action-set-acl (proc vec)
(domain (tramp-file-name-domain v))
(port (tramp-file-name-port v))
(share (tramp-smb-get-share v))
- (localname (tramp-compat-replace-regexp-in-string
+ (localname (replace-regexp-in-string
"\\\\" "/" (tramp-smb-get-localname v)))
(args (list (concat "//" real-host "/" share) "-E" "-S"
- (tramp-compat-replace-regexp-in-string
+ (replace-regexp-in-string
"\n" "," acl-string))))
(if (not (zerop (length real-user)))
(tramp-message
v 6 "%s" (mapconcat 'identity (process-command p) " "))
(tramp-set-connection-property p "vector" v)
- (tramp-compat-set-process-query-on-exit-flag p nil)
+ (set-process-query-on-exit-flag p nil)
(tramp-process-actions p v nil tramp-smb-actions-set-acl)
(goto-char (point-max))
(unless (re-search-backward "tramp_exit_status [0-9]+" nil t)
(when (tramp-smb-get-cifs-capabilities v)
(tramp-flush-file-property v localname)
(unless (tramp-smb-send-command
- v (format "chmod \"%s\" %s"
- (tramp-smb-get-localname v)
- (tramp-compat-decimal-to-octal mode)))
+ v (format "chmod \"%s\" %o" (tramp-smb-get-localname v) mode))
(tramp-error
v 'file-error "Error while changing file's mode %s" filename)))))
"Like `write-region' for Tramp files."
(setq filename (expand-file-name filename))
(with-parsed-tramp-file-name filename nil
- ;; XEmacs takes a coding system as the seventh argument, not `confirm'.
- (when (and (not (featurep 'xemacs))
- confirm (file-exists-p filename))
+ (when (and confirm (file-exists-p filename))
(unless (y-or-n-p (format "File %s exists; overwrite anyway? "
filename))
(tramp-error v 'file-error "File not overwritten")))
;; Add directory itself.
(push '("" "drwxrwxrwx" 0 (0 0)) res)
- ;; There's a very strange error (debugged with XEmacs 21.4.14)
- ;; If there's no short delay, it returns nil. No idea about.
- (when (featurep 'xemacs) (sleep-for 0.01))
-
;; Return entries.
(delq nil res))))))
(member
"pathnames"
(split-string
- (buffer-substring (point) (point-at-eol)) nil t)))))))))
+ (buffer-substring (point) (point-at-eol)) nil 'omit)))))))))
(defun tramp-smb-get-stat-capability (vec)
"Check, whether the SMB server supports the STAT command."
(tramp-message
vec 6 "%s" (mapconcat 'identity (process-command p) " "))
(tramp-set-connection-property p "vector" vec)
- (tramp-compat-set-process-query-on-exit-flag p nil)
+ (set-process-query-on-exit-flag p nil)
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method tramp-smb-method
;; Notes:
;; -----
;;
-;; This package only works for Emacs 22.1 and higher, and for XEmacs 21.4
-;; and higher. For XEmacs 21, you need the package `fsf-compat' for
-;; the `with-timeout' macro.
+;; This package only works for Emacs 23.1 and higher.
;;
;; Also see the todo list at the bottom of this file.
;;
;; Pacify byte-compiler.
(eval-when-compile
(require 'cl))
-(defvar bkup-backup-directory-info)
-(defvar directory-sep-char)
(defvar eshell-path-env)
-(defvar ls-lisp-use-insert-directory-program)
-(defvar outline-regexp)
;;; User Customizable Internal Variables:
:group 'tramp
:type 'integer)
-;; Emacs case.
-(eval-and-compile
- (when (boundp 'backup-directory-alist)
- (defcustom tramp-backup-directory-alist nil
- "Alist of filename patterns and backup directory names.
+(defcustom tramp-backup-directory-alist nil
+ "Alist of filename patterns and backup directory names.
Each element looks like (REGEXP . DIRECTORY), with the same meaning like
in `backup-directory-alist'. If a Tramp file is backed up, and DIRECTORY
is a local file name, the backup directory is prepended with Tramp file
gives the same backup policy for Tramp files on their hosts like the
policy for local files."
- :group 'tramp
- :type '(repeat (cons (regexp :tag "Regexp matching filename")
- (directory :tag "Backup directory name"))))))
-
-;; XEmacs case. We cannot check for `bkup-backup-directory-info', because
-;; the package "backup-dir" might not be loaded yet.
-(eval-and-compile
- (when (featurep 'xemacs)
- (defcustom tramp-bkup-backup-directory-info nil
- "Alist of (FILE-REGEXP BACKUP-DIR OPTIONS ...))
-It has the same meaning like `bkup-backup-directory-info' from package
-`backup-dir'. If a Tramp file is backed up, and BACKUP-DIR is a local
-file name, the backup directory is prepended with Tramp file name prefix
-\(method, user, host) of file.
-
-\(setq tramp-bkup-backup-directory-info bkup-backup-directory-info)
-
-gives the same backup policy for Tramp files on their hosts like the
-policy for local files."
- :type '(repeat
- (list (regexp :tag "File regexp")
- (string :tag "Backup Dir")
- (set :inline t
- (const ok-create)
- (const full-path)
- (const prepend-name)
- (const search-upward))))
- :group 'tramp)))
+ :group 'tramp
+ :type '(repeat (cons (regexp :tag "Regexp matching filename")
+ (directory :tag "Backup directory name"))))
(defcustom tramp-auto-save-directory nil
"Put auto-save files in this directory, if set.
;; PuTTY is installed. We don't take it, if it is installed on a
;; non-windows system, or pscp from the pssh (parallel ssh) package
;; is found.
- ((and (eq system-type 'windows-nt)
- (executable-find "pscp"))
- (if (or (fboundp 'password-read)
- (fboundp 'auth-source-user-or-password)
- (fboundp 'auth-source-search)
- ;; Pageant is running.
- (tramp-compat-process-running-p "Pageant"))
- "pscp"
- "plink"))
+ ((and (eq system-type 'windows-nt) (executable-find "pscp")) "pscp")
;; There is an ssh installation.
- ((executable-find "scp")
- (if (or (fboundp 'password-read)
- (fboundp 'auth-source-user-or-password)
- (fboundp 'auth-source-search)
- ;; ssh-agent is running.
- (getenv "SSH_AUTH_SOCK")
- (getenv "SSH_AGENT_PID"))
- "scp"
- "ssh"))
+ ((executable-find "scp") "scp")
;; Fallback.
(t "ftp"))
"Default method to use for transferring files.
;; regexp works only for GNU Emacs.
;; Allow also [] style prompts. They can appear only during
;; connection initialization; Tramp redefines the prompt afterwards.
- (concat (if (featurep 'xemacs) "" "\\(?:^\\|\r\\)")
+ (concat "\\(?:^\\|\r\\)"
"[^]#$%>\n]*#?[]#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*")
"Regexp to match prompts from remote shell.
Normally, Tramp expects you to configure `shell-prompt-pattern'
(make-variable-buffer-local 'tramp-temp-buffer-file-name)
(put 'tramp-temp-buffer-file-name 'permanent-local t)
-;; XEmacs is distributed with few Lisp packages. Further packages are
-;; installed using EFS. If we use a unified filename format, then
-;; Tramp is required in addition to EFS. (But why can't Tramp just
-;; disable EFS when Tramp is loaded? Then XEmacs can ship with EFS
-;; just like before.) Another reason for using a separate filename
-;; syntax on XEmacs is that EFS hooks into XEmacs in many places, but
-;; Tramp only knows how to deal with `file-name-handler-alist', not
-;; the other places.
-
-;; Currently, we have the choice between 'ftp and 'sep.
;;;###autoload
-(defcustom tramp-syntax
- (if (featurep 'xemacs) 'sep 'ftp)
+(defcustom tramp-syntax 'ftp
"Tramp filename syntax to be used.
It can have the following values:
- `ftp' -- Ange-FTP respective EFS like syntax (GNU Emacs default)
- `sep' -- Syntax as defined for XEmacs."
+ `ftp' -- Ange-FTP like syntax
+ `sep' -- Syntax as defined for XEmacs originally."
:group 'tramp
:version "24.4"
- :type `(choice (const :tag ,(if (featurep 'xemacs) "EFS" "Ange-FTP") ftp)
+ :type '(choice (const :tag "Ange-FTP" ftp)
(const :tag "XEmacs" sep)))
(defconst tramp-prefix-format
"\\`/\\(\\[.*\\]\\|[^/|:]\\{2,\\}[^/|]*\\):"
"\\`/[^/|:][^/|]*:")
"Value for `tramp-file-name-regexp' for unified remoting.
-Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
-Tramp. See `tramp-file-name-structure' for more explanations.
+See `tramp-file-name-structure' for more explanations.
On W32 systems, the volume letter must be ignored.")
;;;###autoload
(defconst tramp-file-name-regexp-separate "\\`/\\[.*\\]"
"Value for `tramp-file-name-regexp' for separate remoting.
-XEmacs uses a separate filename syntax for Tramp and EFS.
See `tramp-file-name-structure' for more explanations.")
;;;###autoload
(if (memq system-type '(cygwin windows-nt))
"\\`/[^/]\\{2,\\}\\'" "\\`/[^/]*\\'")
"Value for `tramp-completion-file-name-regexp' for unified remoting.
-GNU Emacs uses a unified filename syntax for Tramp and Ange-FTP.
See `tramp-file-name-structure' for more explanations.
On W32 systems, the volume letter must be ignored.")
(defconst tramp-completion-file-name-regexp-separate
"\\`/\\([[][^]]*\\)?\\'"
"Value for `tramp-completion-file-name-regexp' for separate remoting.
-XEmacs uses a separate filename syntax for Tramp and EFS.
See `tramp-file-name-structure' for more explanations.")
;;;###autoload
;; to drop bytes when data is sent too quickly. There is also a connection
;; buffer local variable, which is computed depending on remote host properties
;; when `tramp-chunksize' is zero or nil.
-(defcustom tramp-chunksize
- (when (and (not (featurep 'xemacs))
- (memq system-type '(hpux)))
- 500)
+(defcustom tramp-chunksize (when (memq system-type '(hpux)) 500)
;; Parentheses in docstring starting at beginning of line are escaped.
;; Fontification is messed up when
;; `open-paren-in-column-0-is-defun-start' set to t.
Afterwards, check in `tramp-methods'. If the `tramp-methods'
entry does not exist, return nil."
(let ((hash-entry
- (tramp-compat-replace-regexp-in-string
- "^tramp-" "" (symbol-name param))))
+ (replace-regexp-in-string "^tramp-" "" (symbol-name param))))
(if (tramp-connection-property-p vec hash-entry)
;; We use the cached property.
(tramp-get-connection-property vec hash-entry nil)
;; This works with the current set of `tramp-obsolete-methods'.
;; Must be improved, if their are more sophisticated replacements.
(setq result (substring result 0 -1)))
- ;; We must mark, whether a default value has been used. Not
- ;; applicable for XEmacs.
- (if (or method (null result) (null (functionp 'propertize)))
+ ;; We must mark, whether a default value has been used.
+ (if (or method (null result))
result
- (tramp-compat-funcall 'propertize result 'tramp-default t))))
+ (propertize result 'tramp-default t))))
(defun tramp-find-user (method user host)
"Return the right user string to use.
(setq choices nil)))
luser)
tramp-default-user)))
- ;; We must mark, whether a default value has been used. Not
- ;; applicable for XEmacs.
- (if (or user (null result) (null (functionp 'propertize)))
+ ;; We must mark, whether a default value has been used.
+ (if (or user (null result))
result
- (tramp-compat-funcall 'propertize result 'tramp-default t))))
+ (propertize result 'tramp-default t))))
(defun tramp-find-host (method user host)
"Return the right host string to use.
(when (bobp)
(insert
(format
- ";; %sEmacs: %s Tramp: %s -*- mode: outline; -*-"
- (if (featurep 'sxemacs) "SX" (if (featurep 'xemacs) "X" "GNU "))
+ ";; Emacs: %s Tramp: %s -*- mode: outline; -*-"
emacs-version tramp-version))
(when (>= tramp-verbose 10)
(insert
'("tramp-backtrace"
"tramp-compat-condition-case-unless-debug"
"tramp-compat-funcall"
- "tramp-compat-with-temp-message"
"tramp-condition-case-unless-debug"
"tramp-debug-message"
"tramp-error"
(put 'with-parsed-tramp-file-name 'lisp-indent-function 2)
(put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body))
-(tramp-compat-font-lock-add-keywords
- 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>"))
+(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>"))
(defun tramp-progress-reporter-update (reporter &optional value)
(let* ((parameters (cdr reporter))
(message (aref parameters 3)))
(when (string-match message (or (current-message) ""))
- (tramp-compat-funcall 'progress-reporter-update reporter value))))
+ (progress-reporter-update reporter value))))
(defmacro with-tramp-progress-reporter (vec level message &rest body)
"Executes BODY, spinning a progress reporter with MESSAGE.
;; Display only when there is a minimum level.
(<= ,level (min tramp-verbose 3)))
(ignore-errors
- (let ((pr (tramp-compat-funcall
- #'make-progress-reporter ,message)))
+ (let ((pr (make-progress-reporter ,message nil nil)))
(when pr
- (run-at-time 3 0.1
- #'tramp-progress-reporter-update pr)))))))
+ (run-at-time
+ 3 0.1 #'tramp-progress-reporter-update pr)))))))
(unwind-protect
;; Execute the body.
(prog1 (progn ,@body) (setq cookie "done"))
;; Stop progress reporter.
- (if tm (tramp-compat-funcall 'cancel-timer tm))
+ (if tm (cancel-timer tm))
(tramp-message ,vec ,level "%s...%s" ,message cookie)))))
-(tramp-compat-font-lock-add-keywords
+(font-lock-add-keywords
'emacs-lisp-mode '("\\<with-tramp-progress-reporter\\>"))
(defmacro with-tramp-file-property (vec file property &rest body)
(put 'with-tramp-file-property 'lisp-indent-function 3)
(put 'with-tramp-file-property 'edebug-form-spec t)
-(tramp-compat-font-lock-add-keywords
- 'emacs-lisp-mode '("\\<with-tramp-file-property\\>"))
+(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-tramp-file-property\\>"))
(defmacro with-tramp-connection-property (key property &rest body)
"Check in Tramp for property PROPERTY, otherwise executes BODY and set."
(put 'with-tramp-connection-property 'lisp-indent-function 2)
(put 'with-tramp-connection-property 'edebug-form-spec t)
-(tramp-compat-font-lock-add-keywords
+(font-lock-add-keywords
'emacs-lisp-mode '("\\<with-tramp-connection-property\\>"))
(defun tramp-drop-volume-letter (name)
special handling of `substitute-in-file-name'."
(when (symbol-value 'minibuffer-completing-file-name)
(setq tramp-rfn-eshadow-overlay
- (tramp-compat-funcall
- 'make-overlay
- (tramp-compat-funcall 'minibuffer-prompt-end)
- (tramp-compat-funcall 'minibuffer-prompt-end)))
+ (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end)))
;; Copy rfn-eshadow-overlay properties.
- (let ((props (tramp-compat-funcall
- 'overlay-properties (symbol-value 'rfn-eshadow-overlay))))
+ (let ((props (overlay-properties (symbol-value 'rfn-eshadow-overlay))))
(while props
;; The `field' property prevents correct minibuffer
;; completion; we exclude it.
(if (not (eq (car props) 'field))
- (tramp-compat-funcall
- 'overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props))
+ (overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props))
(pop props) (pop props))))))
-(when (boundp 'rfn-eshadow-setup-minibuffer-hook)
- (add-hook 'rfn-eshadow-setup-minibuffer-hook
- 'tramp-rfn-eshadow-setup-minibuffer)
- (add-hook 'tramp-unload-hook
- (lambda ()
- (remove-hook 'rfn-eshadow-setup-minibuffer-hook
- 'tramp-rfn-eshadow-setup-minibuffer))))
+(add-hook 'rfn-eshadow-setup-minibuffer-hook
+ 'tramp-rfn-eshadow-setup-minibuffer)
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (remove-hook 'rfn-eshadow-setup-minibuffer-hook
+ 'tramp-rfn-eshadow-setup-minibuffer)))
(defconst tramp-rfn-eshadow-update-overlay-regexp
(format "[^%s/~]*\\(/\\|~\\)" tramp-postfix-host-format))
been set up by `rfn-eshadow-setup-minibuffer'."
;; In remote files name, there is a shadowing just for the local part.
(ignore-errors
- (let ((end (or (tramp-compat-funcall
- 'overlay-end (symbol-value 'rfn-eshadow-overlay))
- (tramp-compat-funcall 'minibuffer-prompt-end)))
+ (let ((end (or (overlay-end (symbol-value 'rfn-eshadow-overlay))
+ (minibuffer-prompt-end)))
;; We do not want to send any remote command.
(non-essential t))
(when
(tramp-tramp-file-p
- (tramp-compat-funcall
- 'buffer-substring-no-properties end (point-max)))
+ (buffer-substring-no-properties end (point-max)))
(save-excursion
(save-restriction
(narrow-to-region
(let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
(rfn-eshadow-update-overlay-hook nil)
file-name-handler-alist)
- (tramp-compat-funcall
- 'move-overlay rfn-eshadow-overlay (point-max) (point-max))
- (tramp-compat-funcall 'rfn-eshadow-update-overlay))))))))
-
-(when (boundp 'rfn-eshadow-update-overlay-hook)
- (add-hook 'rfn-eshadow-update-overlay-hook
- 'tramp-rfn-eshadow-update-overlay)
- (add-hook 'tramp-unload-hook
- (lambda ()
- (remove-hook 'rfn-eshadow-update-overlay-hook
- 'tramp-rfn-eshadow-update-overlay))))
+ (move-overlay rfn-eshadow-overlay (point-max) (point-max))
+ (rfn-eshadow-update-overlay))))))))
+
+(add-hook 'rfn-eshadow-update-overlay-hook
+ 'tramp-rfn-eshadow-update-overlay)
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (remove-hook 'rfn-eshadow-update-overlay-hook
+ 'tramp-rfn-eshadow-update-overlay)))
;; Inodes don't exist for some file systems. Therefore we must
;; generate virtual ones. Used in `find-buffer-visiting'. The method
If the file modes of FILENAME cannot be determined, return the
value of `default-file-modes', without execute permissions."
(or (file-modes filename)
- (logand (default-file-modes) (tramp-compat-octal-to-decimal "0666"))))
+ (logand (default-file-modes) (string-to-number "0666" 8))))
(defun tramp-replace-environment-variables (filename)
"Replace environment variables in FILENAME.
Return the string with the replaced variables."
(or (ignore-errors
+ ;; Optional arg has been introduced with Emacs 24 (?).
(tramp-compat-funcall 'substitute-env-vars filename 'only-defined))
;; We need an own implementation.
(save-match-data
t nil filename)))
filename))))
-;; In XEmacs, electricity is implemented via a key map for ?/ and ?~,
-;; which calls corresponding functions (see minibuf.el).
-(when (fboundp 'minibuffer-electric-separator)
- (mapc
- (lambda (x)
- (eval
- `(defadvice ,x
- (around ,(intern (format "tramp-advice-%s" x)) activate)
- "Invoke `substitute-in-file-name' for Tramp files."
- (if (and (symbol-value 'minibuffer-electric-file-name-behavior)
- (tramp-tramp-file-p (buffer-substring)))
- ;; We don't need to handle `last-input-event', because
- ;; due to the key map we know it must be ?/ or ?~.
- (let ((s (concat (buffer-substring (point-min) (point))
- (string last-command-char))))
- (delete-region (point-min) (point))
- (insert (substitute-in-file-name s))
- (setq ad-return-value last-command-char))
- ad-do-it)))
- (eval
- `(add-hook
- 'tramp-unload-hook
- (lambda ()
- (ad-remove-advice ',x 'around ',(intern (format "tramp-advice-%s" x)))
- (ad-activate ',x)))))
-
- '(minibuffer-electric-separator
- minibuffer-electric-tilde)))
-
(defun tramp-find-file-name-coding-system-alist (filename tmpname)
"Like `find-operation-coding-system' for Tramp filenames.
Tramp's `insert-file-contents' and `write-region' work over
(cond
;; FILE resp DIRECTORY.
((member operation
- (list 'access-file 'byte-compiler-base-file-name 'delete-directory
- 'delete-file 'diff-latest-backup-file 'directory-file-name
- 'directory-files 'directory-files-and-attributes
- 'dired-compress-file 'dired-uncache
- 'file-accessible-directory-p 'file-attributes
- 'file-directory-p 'file-executable-p 'file-exists-p
- 'file-local-copy 'file-modes
- 'file-name-as-directory 'file-name-directory
- 'file-name-nondirectory 'file-name-sans-versions
- 'file-ownership-preserved-p 'file-readable-p
- 'file-regular-p 'file-remote-p 'file-symlink-p 'file-truename
- 'file-writable-p 'find-backup-file-name 'find-file-noselect
- 'get-file-buffer 'insert-directory 'insert-file-contents
- 'load 'make-directory 'make-directory-internal
- 'set-file-modes 'substitute-in-file-name
- 'unhandled-file-name-directory 'vc-registered
- ;; Emacs 22+ only.
- 'set-file-times
- ;; Emacs 24+ only.
- 'file-acl 'file-notify-add-watch
- 'file-selinux-context 'set-file-acl 'set-file-selinux-context
- ;; XEmacs only.
- 'abbreviate-file-name 'create-file-buffer
- 'dired-file-modtime 'dired-make-compressed-filename
- 'dired-recursive-delete-directory 'dired-set-file-modtime
- 'dired-shell-unhandle-file-name 'dired-uucode-file
- 'insert-file-contents-literally 'make-temp-name 'recover-file
- 'vm-imap-check-mail 'vm-pop-check-mail 'vm-spool-check-mail))
+ '(access-file byte-compiler-base-file-name delete-directory
+ delete-file diff-latest-backup-file directory-file-name
+ directory-files directory-files-and-attributes
+ dired-compress-file dired-uncache
+ file-accessible-directory-p file-attributes
+ file-directory-p file-executable-p file-exists-p
+ file-local-copy file-modes
+ file-name-as-directory file-name-directory
+ file-name-nondirectory file-name-sans-versions
+ file-ownership-preserved-p file-readable-p
+ file-regular-p file-remote-p file-symlink-p file-truename
+ file-writable-p find-backup-file-name find-file-noselect
+ get-file-buffer insert-directory insert-file-contents
+ load make-directory make-directory-internal
+ set-file-modes set-file-times substitute-in-file-name
+ unhandled-file-name-directory vc-registered
+ ;; Emacs 24+ only.
+ file-acl file-notify-add-watch file-selinux-context
+ set-file-acl set-file-selinux-context))
(if (file-name-absolute-p (nth 0 args))
(nth 0 args)
(expand-file-name (nth 0 args))))
;; FILE DIRECTORY resp FILE1 FILE2.
((member operation
- (list 'add-name-to-file 'copy-file 'expand-file-name
- 'file-name-all-completions 'file-name-completion
- 'file-newer-than-file-p 'make-symbolic-link 'rename-file
- ;; Emacs 23+ only.
- 'copy-directory
- ;; Emacs 24+ only.
- 'file-equal-p 'file-in-directory-p
- ;; XEmacs only.
- 'dired-make-relative-symlink
- 'vm-imap-move-mail 'vm-pop-move-mail 'vm-spool-move-mail))
+ '(add-name-to-file copy-directory copy-file expand-file-name
+ file-name-all-completions file-name-completion
+ file-newer-than-file-p make-symbolic-link rename-file
+ ;; Emacs 24+ only.
+ file-equal-p file-in-directory-p))
(save-match-data
(cond
((tramp-tramp-file-p (nth 0 args)) (nth 0 args))
(nth 2 args))
;; BUFFER.
((member operation
- (list 'set-visited-file-modtime 'verify-visited-file-modtime
- ;; Emacs 22+ only.
- 'make-auto-save-file-name
- ;; XEmacs only.
- 'backup-buffer))
+ '(make-auto-save-file-name
+ set-visited-file-modtime verify-visited-file-modtime))
(buffer-file-name
(if (bufferp (nth 0 args)) (nth 0 args) (current-buffer))))
;; COMMAND.
((member operation
- (list ;; not in Emacs 23+.
- 'dired-call-process
- ;; Emacs only.
- 'shell-command
- ;; Emacs 22+ only.
- 'process-file
- ;; Emacs 23+ only.
- 'start-file-process
- ;; XEmacs only.
- 'dired-print-file 'dired-shell-call-process))
+ '(process-file shell-command start-file-process))
default-directory)
;; PROC.
- ((member operation (list 'file-notify-rm-watch 'file-notify-valid-p))
+ ((member operation
+ '(;; Emacs 24+ only.
+ file-notify-rm-watch
+ ;; Emacs 25+ only.
+ file-notify-valid-p))
(when (processp (nth 0 args))
(with-current-buffer (process-buffer (nth 0 args))
default-directory)))
(progn (defun tramp-completion-file-name-handler (operation &rest args)
"Invoke Tramp file name completion handler.
Falls back to normal file name handler if no Tramp file name handler exists."
- ;; We bind `directory-sep-char' here for XEmacs on Windows, which
- ;; would otherwise use backslash.
- (let ((directory-sep-char ?/)
- (fn (assoc operation tramp-completion-file-name-handler-alist)))
+ (let ((fn (assoc operation tramp-completion-file-name-handler-alist)))
(if (and
;; When `tramp-mode' is not enabled, we don't do anything.
fn tramp-mode
;; indicated his interest in using a fancier completion system.
(or (eq tramp-syntax 'sep)
(featurep 'tramp) ;; If it's loaded, we may as well use it.
- ;; `partial-completion-mode' does not exist in XEmacs.
- ;; It is obsoleted with Emacs 24.1.
+ ;; `partial-completion-mode' is obsoleted with Emacs 24.1.
(and (boundp 'partial-completion-mode)
(symbol-value 'partial-completion-mode))
;; FIXME: These may have been loaded even if the user never
;;;###autoload
(progn (defun tramp-autoload-file-name-handler (operation &rest args)
"Load Tramp file name handler, and perform OPERATION."
- ;; Avoid recursive loading of tramp.el. `temporary-file-directory'
- ;; does not exist in XEmacs, so we must use something else.
- (let ((default-directory "/"))
+ ;; Avoid recursive loading of tramp.el.
+ (let ((default-directory temporary-file-directory))
(load "tramp" nil t))
(apply operation args)))
;; variable. On the other hand, those files shouldn't have partial
;; Tramp file name syntax. Maybe another variable should be introduced
;; overwriting this check in such cases. Or we change Tramp file name
-;; syntax in order to avoid ambiguities, like in XEmacs ...
+;; syntax in order to avoid ambiguities.
;;;###tramp-autoload
(defun tramp-completion-mode-p ()
"Check, whether method / user name / host name completion is active."
;; Signal from outside. `non-essential' has been introduced in Emacs 24.
(and (boundp 'non-essential) (symbol-value 'non-essential))
tramp-completion-mode
- ;; Emacs.
(equal last-input-event 'tab)
(and (natnump last-input-event)
(or
(equal last-input-event ?\t)
(and (not (event-modifiers last-input-event))
(or (equal last-input-event ?\?)
- (equal last-input-event ?\ )))))
- ;; XEmacs.
- (and (featurep 'xemacs)
- ;; `last-input-event' might be nil.
- (not (null last-input-event))
- ;; `last-input-event' may have no character approximation.
- (tramp-compat-funcall 'event-to-character last-input-event)
- (or
- ;; ?\t has event-modifier 'control.
- (equal
- (tramp-compat-funcall 'event-to-character last-input-event) ?\t)
- (and (not (event-modifiers last-input-event))
- (or (equal
- (tramp-compat-funcall 'event-to-character last-input-event)
- ?\?)
- (equal
- (tramp-compat-funcall 'event-to-character last-input-event)
- ?\ )))))))
+ (equal last-input-event ?\ )))))))
(defun tramp-connectable-p (filename)
"Check, whether it is possible to connect the remote host w/o side-effects.
(substring directory 0 -1)
directory)))
-(defun tramp-handle-directory-files
- (directory &optional full match nosort files-only)
+(defun tramp-handle-directory-files (directory &optional full match nosort)
"Like `directory-files' for Tramp files."
- ;; FILES-ONLY is valid for XEmacs only.
(when (file-directory-p directory)
(setq directory (file-name-as-directory (expand-file-name directory)))
(let ((temp (nreverse (file-name-all-completions "" directory)))
(while temp
(setq item (directory-file-name (pop temp)))
- (when (and (or (null match) (string-match match item))
- (or (null files-only)
- ;; Files only.
- (and (equal files-only t) (file-regular-p item))
- ;; Directories only.
- (file-directory-p item)))
+ (when (or (null match) (string-match match item))
(push (if full (concat directory item) item)
result)))
(if nosort result (sort result 'string<)))))
"Like `directory-files-and-attributes' for Tramp files."
(mapcar
(lambda (x)
- (cons x (tramp-compat-file-attributes
+ (cons x (file-attributes
(if full x (expand-file-name x directory)) id-format)))
(directory-files directory full match nosort)))
-(defun tramp-handle-dired-uncache (dir &optional dir-p)
+(defun tramp-handle-dired-uncache (dir)
"Like `dired-uncache' for Tramp files."
- ;; DIR-P is valid for XEmacs only.
(with-parsed-tramp-file-name
- (if (or dir-p (file-directory-p dir)) dir (file-name-directory dir)) nil
+ (if (file-directory-p dir) dir (file-name-directory dir)) nil
(tramp-flush-directory-property v localname)))
(defun tramp-handle-file-accessible-directory-p (filename)
(defun tramp-handle-find-backup-file-name (filename)
"Like `find-backup-file-name' for Tramp files."
(with-parsed-tramp-file-name filename nil
- ;; We set both variables. It doesn't matter whether it is
- ;; Emacs or XEmacs.
(let ((backup-directory-alist
- ;; Emacs case.
- (when (boundp 'backup-directory-alist)
- (if (symbol-value 'tramp-backup-directory-alist)
- (mapcar
- (lambda (x)
- (cons
- (car x)
- (if (and (stringp (cdr x))
- (file-name-absolute-p (cdr x))
- (not (tramp-file-name-p (cdr x))))
- (tramp-make-tramp-file-name method user host (cdr x))
- (cdr x))))
- (symbol-value 'tramp-backup-directory-alist))
- (symbol-value 'backup-directory-alist))))
-
- (bkup-backup-directory-info
- ;; XEmacs case.
- (when (boundp 'bkup-backup-directory-info)
- (if (symbol-value 'tramp-bkup-backup-directory-info)
- (mapcar
- (lambda (x)
- (nconc
- (list (car x))
- (list
- (if (and (stringp (car (cdr x)))
- (file-name-absolute-p (car (cdr x)))
- (not (tramp-file-name-p (car (cdr x)))))
- (tramp-make-tramp-file-name
- method user host (car (cdr x)))
- (car (cdr x))))
- (cdr (cdr x))))
- (symbol-value 'tramp-bkup-backup-directory-info))
- (symbol-value 'bkup-backup-directory-info)))))
-
+ (if tramp-backup-directory-alist
+ (mapcar
+ (lambda (x)
+ (cons
+ (car x)
+ (if (and (stringp (cdr x))
+ (file-name-absolute-p (cdr x))
+ (not (tramp-file-name-p (cdr x))))
+ (tramp-make-tramp-file-name method user host (cdr x))
+ (cdr x))))
+ tramp-backup-directory-alist)
+ backup-directory-alist)))
(tramp-run-real-handler 'find-backup-file-name (list filename)))))
(defun tramp-handle-insert-directory
;; When the file is not readable for the owner, it
;; cannot be inserted, even if it is readable for the
;; group or for everybody.
- (set-file-modes
- local-copy (tramp-compat-octal-to-decimal "0600"))
+ (set-file-modes local-copy (string-to-number "0600" 8))
(when (and (null remote-copy)
(tramp-get-method-parameter
(setq tramp-temp-buffer-file-name local-copy))
;; We must ensure that `file-coding-system-alist'
- ;; matches `local-copy'. We must also use `visit',
- ;; otherwise there might be an error in the
- ;; `revert-buffer' function under XEmacs.
+ ;; matches `local-copy'.
(let ((file-coding-system-alist
(tramp-find-file-name-coding-system-alist
filename local-copy)))
(with-tramp-progress-reporter v 0 (format "Loading %s" file)
(let ((local-copy (file-local-copy file)))
(unwind-protect
- (tramp-compat-load local-copy noerror t nosuffix must-suffix)
+ (load local-copy noerror t nosuffix must-suffix)
(delete-file local-copy)))))
t)))
(current-buffer))))
;; There's some output, display it.
(when (with-current-buffer output-buffer (> (point-max) (point-min)))
- (if (functionp 'display-message-or-buffer)
- (tramp-compat-funcall 'display-message-or-buffer output-buffer)
- (pop-to-buffer output-buffer))))))))
+ (display-message-or-buffer output-buffer)))))))
(defun tramp-handle-substitute-in-file-name (filename)
"Like `substitute-in-file-name' for Tramp files.
(let (process-environment)
(tramp-run-real-handler 'substitute-in-file-name (list filename)))))
-(defun tramp-handle-unhandled-file-name-directory (_filename)
- "Like `unhandled-file-name-directory' for Tramp files."
- ;; Starting with Emacs 23, we must simply return nil. But we must
- ;; keep backward compatibility, also with XEmacs. "~/" cannot be
- ;; returned, because there might be machines without a HOME
- ;; directory (like hydra).
- (and (< emacs-major-version 23) "/"))
-
(defun tramp-handle-set-visited-file-modtime (&optional time-list)
"Like `set-visited-file-modtime' for Tramp files."
(unless (buffer-file-name)
;; connection.
(if (or (not f)
(eq (visited-file-modtime) 0)
- (not (tramp-file-name-handler 'file-remote-p f nil 'connected)))
+ (not (file-remote-p f nil 'connected)))
t
(with-parsed-tramp-file-name f nil
(let* ((remote-file-name-inhibit-cache t)
(with-current-buffer (process-buffer proc)
(file-exists-p
(concat (file-remote-p default-directory)
- (tramp-compat-process-get proc 'watch-name))))))
+ (process-get proc 'watch-name))))))
;;; Functions for establishing connection:
;; Under Windows XP, accept-process-output doesn't return
;; sometimes. So we add an additional timeout.
(with-timeout ((or timeout 1))
- (if (featurep 'xemacs)
- (accept-process-output p timeout timeout-msecs)
- (accept-process-output p timeout timeout-msecs (and proc t))))
+ (accept-process-output p timeout timeout-msecs (and proc t)))
(tramp-message proc 10 "%s %s %s\n%s"
proc (process-status proc) p (buffer-string)))))
(when (or (not (tramp-get-connection-property proc "check-remote-echo" nil))
;; Sometimes, the echo string is suppressed on the remote side.
(not (string-equal
- (tramp-compat-funcall
- 'substring-no-properties tramp-echo-mark-marker
+ (substring-no-properties
+ tramp-echo-mark-marker
0 (min tramp-echo-mark-marker-length (1- (point-max))))
- (tramp-compat-funcall
- 'buffer-substring-no-properties
+ (buffer-substring-no-properties
(point-min)
(min (+ (point-min) tramp-echo-mark-marker-length)
(point-max))))))
the string that matched, or nil. Waits indefinitely if TIMEOUT is
nil."
(with-current-buffer (process-buffer proc)
- (let ((found (tramp-check-for-regexp proc regexp))
- (start-time (current-time)))
+ (let ((found (tramp-check-for-regexp proc regexp)))
(cond (timeout
- ;; Work around a bug in XEmacs 21, where the timeout
- ;; expires faster than it should. This degenerates
- ;; to polling for buggy XEmacsen, but oh, well.
- (while (and (not found)
- (< (tramp-time-diff (current-time) start-time)
- timeout))
- (with-timeout (timeout)
- (while (not found)
- (tramp-accept-process-output proc 1)
- (unless (memq (process-status proc) '(run open))
- (tramp-error-with-buffer
- nil proc 'file-error "Process has died"))
- (setq found (tramp-check-for-regexp proc regexp))))))
+ (with-timeout (timeout)
+ (while (not found)
+ (tramp-accept-process-output proc 1)
+ (unless (memq (process-status proc) '(run open))
+ (tramp-error-with-buffer
+ nil proc 'file-error "Process has died"))
+ (setq found (tramp-check-for-regexp proc regexp)))))
(t
(while (not found)
(tramp-accept-process-output proc 1)
(let (buffer-read-only) (delete-region (point-min) (point-max)))
;; Replace "\n" by `tramp-rsh-end-of-line'.
(setq string
- (mapconcat 'identity
- (tramp-compat-split-string string "\n")
- tramp-rsh-end-of-line))
+ (mapconcat
+ 'identity (split-string string "\n") tramp-rsh-end-of-line))
(unless (or (string= string "")
(string-equal (substring string -1) tramp-rsh-end-of-line))
(setq string (concat string tramp-rsh-end-of-line)))
(save-match-data
(logior
(cond
- ((char-equal owner-read ?r) (tramp-compat-octal-to-decimal "00400"))
+ ((char-equal owner-read ?r) (string-to-number "00400" 8))
((char-equal owner-read ?-) 0)
(t (error "Second char `%c' must be one of `r-'" owner-read)))
(cond
- ((char-equal owner-write ?w) (tramp-compat-octal-to-decimal "00200"))
+ ((char-equal owner-write ?w) (string-to-number "00200" 8))
((char-equal owner-write ?-) 0)
(t (error "Third char `%c' must be one of `w-'" owner-write)))
(cond
- ((char-equal owner-execute-or-setid ?x)
- (tramp-compat-octal-to-decimal "00100"))
- ((char-equal owner-execute-or-setid ?S)
- (tramp-compat-octal-to-decimal "04000"))
- ((char-equal owner-execute-or-setid ?s)
- (tramp-compat-octal-to-decimal "04100"))
+ ((char-equal owner-execute-or-setid ?x) (string-to-number "00100" 8))
+ ((char-equal owner-execute-or-setid ?S) (string-to-number "04000" 8))
+ ((char-equal owner-execute-or-setid ?s) (string-to-number "04100" 8))
((char-equal owner-execute-or-setid ?-) 0)
(t (error "Fourth char `%c' must be one of `xsS-'"
owner-execute-or-setid)))
(cond
- ((char-equal group-read ?r) (tramp-compat-octal-to-decimal "00040"))
+ ((char-equal group-read ?r) (string-to-number "00040" 8))
((char-equal group-read ?-) 0)
(t (error "Fifth char `%c' must be one of `r-'" group-read)))
(cond
- ((char-equal group-write ?w) (tramp-compat-octal-to-decimal "00020"))
+ ((char-equal group-write ?w) (string-to-number "00020" 8))
((char-equal group-write ?-) 0)
(t (error "Sixth char `%c' must be one of `w-'" group-write)))
(cond
- ((char-equal group-execute-or-setid ?x)
- (tramp-compat-octal-to-decimal "00010"))
- ((char-equal group-execute-or-setid ?S)
- (tramp-compat-octal-to-decimal "02000"))
- ((char-equal group-execute-or-setid ?s)
- (tramp-compat-octal-to-decimal "02010"))
+ ((char-equal group-execute-or-setid ?x) (string-to-number "00010" 8))
+ ((char-equal group-execute-or-setid ?S) (string-to-number "02000" 8))
+ ((char-equal group-execute-or-setid ?s) (string-to-number "02010" 8))
((char-equal group-execute-or-setid ?-) 0)
(t (error "Seventh char `%c' must be one of `xsS-'"
group-execute-or-setid)))
(cond
- ((char-equal other-read ?r)
- (tramp-compat-octal-to-decimal "00004"))
+ ((char-equal other-read ?r) (string-to-number "00004" 8))
((char-equal other-read ?-) 0)
(t (error "Eighth char `%c' must be one of `r-'" other-read)))
(cond
- ((char-equal other-write ?w) (tramp-compat-octal-to-decimal "00002"))
- ((char-equal other-write ?-) 0)
- (t (error "Ninth char `%c' must be one of `w-'" other-write)))
+ ((char-equal other-write ?w) (string-to-number "00002" 8))
+ ((char-equal other-write ?-) 0)
+ (t (error "Ninth char `%c' must be one of `w-'" other-write)))
(cond
- ((char-equal other-execute-or-sticky ?x)
- (tramp-compat-octal-to-decimal "00001"))
- ((char-equal other-execute-or-sticky ?T)
- (tramp-compat-octal-to-decimal "01000"))
- ((char-equal other-execute-or-sticky ?t)
- (tramp-compat-octal-to-decimal "01001"))
+ ((char-equal other-execute-or-sticky ?x) (string-to-number "00001" 8))
+ ((char-equal other-execute-or-sticky ?T) (string-to-number "01000" 8))
+ ((char-equal other-execute-or-sticky ?t) (string-to-number "01001" 8))
((char-equal other-execute-or-sticky ?-) 0)
(t (error "Tenth char `%c' must be one of `xtT-'"
other-execute-or-sticky)))))))
;;;###tramp-autoload
(defun tramp-get-local-gid (id-format)
+ ;; `group-gid' has been introduced with Emacs 24.4.
(if (and (fboundp 'group-gid) (equal id-format 'integer))
(tramp-compat-funcall 'group-gid)
- (nth 3 (tramp-compat-file-attributes "~/" id-format))))
+ (nth 3 (file-attributes "~/" id-format))))
;;;###tramp-autoload
(defun tramp-check-cached-permissions (vec access)
(tramp-get-file-property
vec (tramp-file-name-localname vec)
(concat "file-attributes-" suffix) nil)
- (tramp-compat-file-attributes
+ (file-attributes
(tramp-make-tramp-file-name
(tramp-file-name-method vec)
(tramp-file-name-user vec)
(or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp"))))
(with-tramp-connection-property vec "tmpdir"
(or (and (file-directory-p dir) (file-writable-p dir)
- (tramp-file-name-handler 'file-remote-p dir 'localname))
+ (file-remote-p dir 'localname))
(tramp-error vec 'file-error "Directory %s not accessible" dir)))
dir))
(setq result nil)
;; This creates the file by side effect.
(set-file-times result)
- (set-file-modes result (tramp-compat-octal-to-decimal "0700"))))
+ (set-file-modes result (string-to-number "0700" 8))))
;; Return the local part.
(with-parsed-tramp-file-name result nil localname)))
(remove-hook 'kill-buffer-hook
'tramp-delete-temp-file-function)))
-;;; Auto saving to a special directory:
-(defvar auto-save-file-name-transforms)
-
(defun tramp-handle-make-auto-save-file-name ()
"Like `make-auto-save-file-name' for Tramp files.
Returns a file name in `tramp-auto-save-directory' for autosaving
(let ((system-type 'not-windows)
(auto-save-file-name-transforms
- (if (and (null tramp-auto-save-directory)
- (boundp 'auto-save-file-name-transforms))
- (symbol-value 'auto-save-file-name-transforms)))
+ (if (null tramp-auto-save-directory)
+ auto-save-file-name-transforms))
(buffer-file-name
(if (null tramp-auto-save-directory)
buffer-file-name
("]" . "_r"))
(buffer-file-name))
tramp-auto-save-directory))))
- ;; Run plain `make-auto-save-file-name'. There might be an advice when
- ;; it is not a magic file name operation (since Emacs 22).
- ;; We must deactivate it temporarily.
- (if (not (ad-is-active 'make-auto-save-file-name))
- (tramp-run-real-handler 'make-auto-save-file-name nil)
- ;; else
- (ad-deactivate 'make-auto-save-file-name)
- (prog1
- (tramp-run-real-handler 'make-auto-save-file-name nil)
- (ad-activate 'make-auto-save-file-name)))))
-
-(unless (tramp-exists-file-name-handler 'make-auto-save-file-name)
- (defadvice make-auto-save-file-name
- (around tramp-advice-make-auto-save-file-name () activate)
- "Invoke `tramp-*-handle-make-auto-save-file-name' for Tramp files."
- (if (tramp-tramp-file-p (buffer-file-name))
- ;; We cannot call `tramp-handle-make-auto-save-file-name'
- ;; directly, because this would bypass the locking mechanism.
- (setq ad-return-value
- (tramp-file-name-handler 'make-auto-save-file-name))
- ad-do-it))
- (add-hook
- 'tramp-unload-hook
- (lambda ()
- (ad-remove-advice
- 'make-auto-save-file-name
- 'around 'tramp-advice-make-auto-save-file-name)
- (ad-activate 'make-auto-save-file-name))))
-
-;; In XEmacs < 21.5, autosaved remote files have permission 0666 minus
-;; umask. This is a security threat.
-
-(defun tramp-set-auto-save-file-modes ()
- "Set permissions of autosaved remote files to the original permissions."
- (let ((bfn (buffer-file-name)))
- (when (and (tramp-tramp-file-p bfn)
- (buffer-modified-p)
- (stringp buffer-auto-save-file-name)
- (not (equal bfn buffer-auto-save-file-name)))
- (unless (file-exists-p buffer-auto-save-file-name)
- (write-region "" nil buffer-auto-save-file-name))
- ;; Permissions should be set always, because there might be an old
- ;; auto-saved file belonging to another original file. This could
- ;; be a security threat.
- (set-file-modes
- buffer-auto-save-file-name
- (or (file-modes bfn) (tramp-compat-octal-to-decimal "0600"))))))
-
-(unless (and (featurep 'xemacs)
- (= emacs-major-version 21)
- (> emacs-minor-version 4))
- (add-hook 'auto-save-hook 'tramp-set-auto-save-file-modes)
- (add-hook 'tramp-unload-hook
- (lambda ()
- (remove-hook 'auto-save-hook 'tramp-set-auto-save-file-modes))))
+ ;; Run plain `make-auto-save-file-name'.
+ (tramp-run-real-handler 'make-auto-save-file-name nil)))
(defun tramp-subst-strs-in-string (alist string)
"Replace all occurrences of the string FROM with TO in STRING.
(tramp-check-for-regexp proc tramp-password-prompt-regexp)
(format "%s for %s " (capitalize (match-string 1)) key))))
;; We suspend the timers while reading the password.
- (stimers (and (functionp 'with-timeout-suspend)
- (tramp-compat-funcall 'with-timeout-suspend)))
+ (stimers (with-timeout-suspend))
auth-info auth-passwd)
(unwind-protect
(with-parsed-tramp-file-name key nil
(prog1
(or
- ;; See if auth-sources contains something useful, if
- ;; it's bound. `auth-source-user-or-password' is an
- ;; obsoleted function, it has been replaced by
+ ;; See if auth-sources contains something useful.
+ ;; `auth-source-user-or-password' is an obsoleted
+ ;; function since Emacs 24.1, it has been replaced by
;; `auth-source-search'.
(ignore-errors
- (and (boundp 'auth-sources)
- (tramp-get-connection-property
+ (and (tramp-get-connection-property
v "first-password-request" nil)
;; Try with Tramp's current method.
(if (fboundp 'auth-source-search)
(setq auth-info
- (tramp-compat-funcall
- 'auth-source-search
+ (auth-source-search
:max 1
:user (or tramp-current-user t)
:host tramp-current-host
auth-passwd (if (functionp auth-passwd)
(funcall auth-passwd)
auth-passwd))
- (tramp-compat-funcall
- 'auth-source-user-or-password
+ (tramp-compat-funcall 'auth-source-user-or-password
"password" tramp-current-host tramp-current-method))))
;; Try the password cache.
- (when (functionp 'password-read)
- (let ((password
- (tramp-compat-funcall 'password-read pw-prompt key)))
- (tramp-compat-funcall 'password-cache-add key password)
- password))
+ (let ((password (password-read pw-prompt key)))
+ (password-cache-add key password)
+ password)
;; Else, get the password interactively.
(read-passwd pw-prompt))
(tramp-set-connection-property v "first-password-request" nil)))
;; Reenable the timers.
- (and (functionp 'with-timeout-unsuspend)
- (tramp-compat-funcall 'with-timeout-unsuspend stimers)))))
+ (with-timeout-unsuspend stimers))))
;;;###tramp-autoload
(defun tramp-clear-passwd (vec)
(tramp-dissect-file-name
(concat
tramp-prefix-format
- (tramp-compat-replace-regexp-in-string
+ (replace-regexp-in-string
(concat tramp-postfix-hop-regexp "$")
tramp-postfix-host-format hop))))))
- (tramp-compat-funcall
- 'password-cache-remove
+ (password-cache-remove
(tramp-make-tramp-file-name
(tramp-file-name-method vec)
(tramp-file-name-user vec)
(defun tramp-time-diff (t1 t2)
"Return the difference between the two times, in seconds.
T1 and T2 are time values (as returned by `current-time' for example)."
- (cond ((and (fboundp 'subtract-time)
- (fboundp 'float-time))
- (tramp-compat-funcall
- 'float-time (tramp-compat-funcall 'subtract-time t1 t2)))
- ((and (fboundp 'subtract-time)
- (fboundp 'time-to-seconds))
- (tramp-compat-funcall
- 'time-to-seconds (tramp-compat-funcall 'subtract-time t1 t2)))
- ((fboundp 'itimer-time-difference)
- (tramp-compat-funcall
- 'itimer-time-difference
- (if (< (length t1) 3) (append t1 '(0)) t1)
- (if (< (length t2) 3) (append t2 '(0)) t2)))
- (t
- (let ((time (time-subtract t1 t2)))
- (+ (* (car time) 65536.0)
- (cadr time)
- (/ (or (nth 2 time) 0) 1000000.0))))))
+ (float-time (subtract-time t1 t2)))
;; Currently (as of Emacs 20.5), the function `shell-quote-argument'
;; does not deal well with newline characters. Newline is replaced by
;; * In Emacs 21, `insert-directory' shows total number of bytes used
;; by the files in that directory. Add this here.
;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman)
-;; * abbreviate-file-name
;; * Better error checking. At least whenever we see something
;; strange when doing zerop, we should kill the process and start
;; again. (Greg Stark)
;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
;; Keywords: comm, processes
;; Package: tramp
-;; Version: 2.2.13.25.1
+;; Version: 2.3.0-pre
;; This file is part of GNU Emacs.
;; In the Tramp GIT repository, the version number and the bug report
;; address are auto-frobbed from configure.ac, so you should edit that
-;; file and run "autoconf && ./configure" to change them. (X)Emacs
+;; file and run "autoconf && ./configure" to change them. Emacs
;; version check is defined in macro AC_EMACS_INFO of aclocal.m4;
;; should be changed only there.
;;;###tramp-autoload
-(defconst tramp-version "2.2.13.25.1"
+(defconst tramp-version "2.3.0-pre"
"This version of Tramp.")
;;;###tramp-autoload
(defconst tramp-bug-report-address "tramp-devel@gnu.org"
"Email address to send bug reports to.")
-;; `locate-dominating-file' does not exist in XEmacs. But it is not used here.
-(autoload 'locate-dominating-file "files")
-(autoload 'tramp-compat-replace-regexp-in-string "tramp-compat")
-
(defun tramp-repository-get-version ()
"Try to return as a string the repository revision of the Tramp sources."
- (unless (featurep 'xemacs)
- (let ((dir (locate-dominating-file (locate-library "tramp") ".git")))
- (when dir
- (with-temp-buffer
- (let ((default-directory (file-name-as-directory dir)))
- (and (zerop
- (ignore-errors
- (call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
- (not (zerop (buffer-size)))
- (tramp-compat-replace-regexp-in-string
- "\n" "" (buffer-string)))))))))
-
-;; Check for (X)Emacs version.
-(let ((x (if (or (>= emacs-major-version 22)
- (and (featurep 'xemacs)
- (= emacs-major-version 21)
- (>= emacs-minor-version 4)))
- "ok"
- (format "Tramp 2.2.13.25.1 is not fit for %s"
- (when (string-match "^.*$" (emacs-version))
- (match-string 0 (emacs-version)))))))
+ (let ((dir (locate-dominating-file (locate-library "tramp") ".git")))
+ (when dir
+ (with-temp-buffer
+ (let ((default-directory (file-name-as-directory dir)))
+ (and (zerop
+ (ignore-errors
+ (call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
+ (not (zerop (buffer-size)))
+ (replace-regexp-in-string "\n" "" (buffer-string))))))))
+
+;; Check for Emacs version.
+(let ((x (if (>= emacs-major-version 23)
+ "ok"
+ (format "Tramp 2.3.0-pre is not fit for %s"
+ (when (string-match "^.*$" (emacs-version))
+ (match-string 0 (emacs-version)))))))
(unless (string-match "\\`ok\\'" x) (error "%s" x)))
(add-hook 'tramp-unload-hook