;; They should have the format
;;
;; \s-\{2,2} - leading spaces
-;; \S-\(.*\S-\)\s-* - file name, 32 chars, left bound
+;; \S-\(.*\S-\)\s-* - file name, 30 chars, left bound
+;; \s-+[ADHRSV]* - permissions, 7 chars, right bound
;; \s- - space delimeter
-;; \s-*[ADHRS]* - permissions, 5 chars, right bound
-;; \s- - space delimeter
-;; \s-*[0-9]+ - size, 8 (Samba) or 7 (Windows)
-;; chars, right bound
+;; \s-+[0-9]+ - size, 8 chars, right bound
;; \s-\{2,2\} - space delimeter
;; \w\{3,3\} - weekday
;; \s- - space delimeter
+;; \w\{3,3\} - month
+;; \s- - space delimeter
;; [ 19][0-9] - day
;; \s- - space delimeter
;; [0-9]\{2,2\}:[0-9]\{2,2\}:[0-9]\{2,2\} - time
;; \s- - space delimeter
;; [0-9]\{4,4\} - year
;;
+;; samba/src/client.c (http://samba.org/doxygen/samba/client_8c-source.html)
+;; has function display_finfo:
+;;
+;; d_printf(" %-30s%7.7s %8.0f %s",
+;; finfo->name,
+;; attrib_string(finfo->mode),
+;; (double)finfo->size,
+;; asctime(LocalTime(&t)));
+;;
+;; in Samba 1.9, there's the following code:
+;;
+;; DEBUG(0,(" %-30s%7.7s%10d %s",
+;; CNV_LANG(finfo->name),
+;; attrib_string(finfo->mode),
+;; finfo->size,
+;; asctime(LocalTime(&t))));
+;;
;; Problems:
;; * Modern regexp constructs, like spy groups and counted repetitions, aren't
;; available in older Emacsen.
;; size
(if (string-match "\\([0-9]+\\)$" line)
- (setq
- size (string-to-number (match-string 1 line))
- line (substring
- line 0 (- (max 8 (1+ (length (match-string 1 line)))))))
+ (let ((length (- (max 10 (1+ (length (match-string 1 line)))))))
+ (setq size (string-to-number (match-string 1 line)))
+ (when (string-match "\\([ADHRSV]+\\)" (substring line length))
+ (setq length (+ length (match-end 0))))
+ (setq line (substring line 0 length)))
(return))
- ;; mode
- (if (string-match "\\(\\([ADHRS]+\\)?\\s-?\\)$" line)
+ ;; mode: ARCH, DIR, HIDDEN, RONLY, SYSTEM, VOLID
+ (if (string-match "\\([ADHRSV]+\\)?$" line)
(setq
- mode (or (match-string 2 line) "")
+ mode (or (match-string 1 line) "")
mode (save-match-data (format
"%s%s"
(if (string-match "D" mode) "d" "-")
(mapconcat
(lambda (x) "") " "
(concat "r" (if (string-match "R" mode) "-" "w") "x"))))
- line (substring line 0 (- (1+ (length (match-string 2 line))))))
+ line (substring line 0 -7))
(return))
;; localname
- (if (string-match "^\\s-+\\(\\S-\\(.*\\S-\\)?\\)\\s-+$" line)
+ (if (string-match "^\\s-+\\(\\S-\\(.*\\S-\\)?\\)\\s-*$" line)
(setq localname (match-string 1 line))
(return))))
-;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- coding: iso-8859-1; -*-
+;;; -*- mode: Emacs-Lisp; coding: iso-8859-1; -*-
+;;; tramp.el --- Transparent Remote Access, Multiple Protocol
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-;; Author: Kai.Grossjohann@CS.Uni-Dortmund.DE
+;; Author: kai.grossjohann@gmx.net
;; Keywords: comm, processes
;; This file is part of GNU Emacs.
;; the local and the remote host, whereas tramp.el uses a combination
;; of rsh and rcp or other work-alike programs, such as ssh/scp.
;;
-;; For more detailed instructions, please see the info file, which is
-;; included in the file `tramp.tar.gz' mentioned below.
+;; For more detailed instructions, please see the info file.
;;
;; Notes:
;; -----
;;
;; Also see the todo list at the bottom of this file.
;;
-;; The current version of tramp.el can be retrieved from the following
-;; URL: ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/tramp.tar.gz
-;; For your convenience, the *.el file is available separately from
-;; the same directory.
+;; The current version of Tramp can be retrieved from the following URL:
+;; http://savannah.nongnu.org/download/tramp/
;;
;; There's a mailing list for this, as well. Its name is:
-;; tramp-devel@mail.freesoftware.fsf.org
+;; tramp-devel@mail.freesoftware.fsf.org
;; Send a mail with `help' in the subject (!) to the administration
;; address for instructions on joining the list. The administration
;; address is:
;;; Code:
-;; In the Tramp CVS repository, the version numer is auto-frobbed from
-;; the Makefile, so you should edit the top-level Makefile to change
-;; the version number.
-(defconst tramp-version "2.0.30"
- "This version of tramp.")
-
-(defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org"
- "Email address to send bug reports to.")
+;; The Tramp version number and bug report address, as prepared by configure.
+(require 'trampver)
(require 'timer)
(require 'format-spec) ;from Gnus 5.8, also in tar ball
Please raise a bug report via \"M-x tramp-bug\" if your system needs
this variable to be set as well."
:group 'tramp
- :type 'integer)
+ :type '(choice (const nil) integer))
;;; Internal Variables:
(file-name-nondirectory localname)))))
(sit-for 1) ;needed for rsh but not ssh?
(tramp-wait-for-output))
+ ;; The following let-binding is used by code that's commented
+ ;; out. Let's leave the let-binding in for a while to see
+ ;; that the commented-out code is really not needed. Commenting-out
+ ;; happened on 2003-03-13.
(let ((old-pos (point)))
(insert-buffer-substring
(tramp-get-buffer multi-method method user host))
(save-excursion
(tramp-send-command multi-method method user host "cd")
(tramp-wait-for-output))
- ;; Another XEmacs specialty follows. What's the right way to do
- ;; it?
- (when (and (featurep 'xemacs)
- (eq major-mode 'dired-mode))
- (save-excursion
- (require 'dired)
- (dired-insert-set-properties old-pos (point)))))))
+ ;; For the time being, the XEmacs kludge is commented out.
+ ;; Please test it on various XEmacs versions to see if it works.
+;; ;; Another XEmacs specialty follows. What's the right way to do
+;; ;; it?
+;; (when (and (featurep 'xemacs)
+;; (eq major-mode 'dired-mode))
+;; (save-excursion
+;; (require 'dired)
+;; (dired-insert-set-properties old-pos (point))))
+ )))
;; Continuation of kluge to pacify byte-compiler.
;;(eval-when-compile
(setq uname (buffer-substring (point) (tramp-line-end-position)))
(setq localname (concat uname fname))
(erase-buffer)))
- ;; Look if localname starts with "/../" construct. If this is
- ;; the case, then we return a local name instead of a remote name.
- (if (string-match "^/\\.\\./" localname)
- (expand-file-name (substring localname 3))
- ;; 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.
- (let ((directory-sep-char ?/))
- (tramp-make-tramp-file-name
- multi-method method user host
- (tramp-drop-volume-letter
- (tramp-run-real-handler 'expand-file-name
- (list 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.
+ (let ((directory-sep-char ?/))
+ (tramp-make-tramp-file-name
+ multi-method method user host
+ (tramp-drop-volume-letter
+ (tramp-run-real-handler 'expand-file-name
+ (list localname)))))))))
+
+;; old version follows. it uses ".." to cross file handler
+;; boundaries.
+;; ;; Look if localname starts with "/../" construct. If this is
+;; ;; the case, then we return a local name instead of a remote name.
+;; (if (string-match "^/\\.\\./" localname)
+;; (expand-file-name (substring localname 3))
+;; ;; 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.
+;; (let ((directory-sep-char ?/))
+;; (tramp-make-tramp-file-name
+;; multi-method method user host
+;; (tramp-drop-volume-letter
+;; (tramp-run-real-handler 'expand-file-name
+;; (list localname))))))))))
;; Remote commands.
@c This is *so* much nicer :)
@footnotestyle end
-@c In the Tramp CVS, the version number is auto-frobbed from the
-@c Makefile, so you should edit the top-level Makefile to change
-@c the version number.
-@macro trampver{}
-2.0.30
-@end macro
+@c In the Tramp CVS, 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.
+@include trampver.texi
@c Entries for @command{install-info} to use
@dircategory Emacs
@sc{tramp}
@end macro
-@c Distinguish between GNU Emacs and XEmacs. Derived from the
-@c Makefile variable $(EMACS-ID). Valid values are `emacs' and `xemacs'.
-@set emacs
-
@c Some flags which make the text independent on the (X)Emacs flavor.
+@c "emacs" resp "xemacs" are set in the Makefile.
+
@c GNU Emacs values.
@ifset emacs
-@set emacs-name Emacs
+@set emacs-name GNU Emacs
@set emacs-dir emacs
+@set emacs-other-name XEmacs
+@set emacs-other-dir xemacs
+@set emacs-other-file-name tramp-xemacs.html
@set ftp-package-name Ange-FTP
@set tramp-prefix /
@set tramp-prefix-single-hop
@ifset xemacs
@set emacs-name XEmacs
@set emacs-dir xemacs
+@set emacs-other-name GNU Emacs
+@set emacs-other-dir emacs
+@set emacs-other-file-name tramp-emacs.html
@set ftp-package-name EFS
@set tramp-prefix /[
@set tramp-prefix-single-hop [
You can find the latest version of this document on the web at
@uref{http://www.freesoftware.fsf.org/tramp/}.
+The manual has been generated for @value{emacs-name}.
+@ifinfo
+If you want to read the info pages for @value{emacs-other-name}, you
+should read in @ref{Installation} how to create them.
+@end ifinfo
+@ifhtml
+If you're using the other Emacs flavour, you should read the
+@uref{@value{emacs-other-file-name}, @value{emacs-other-name}} pages.
+@end ifhtml
+
@ifhtml
This manual is also available as a @uref{tramp_ja.html, Japanese
translation}.
* Remote Programs:: How @tramp{} finds and uses programs on the remote machine.
* Remote shell setup:: Remote shell setup hints.
* Windows setup hints:: Issues with Cygwin ssh.
+* Auto-save and Backup:: Auto-save and Backup.
Using @tramp
How file names, directories and localnames are mangled and managed.
-* Localname deconstruction:: Breaking a localname into its components.
+* Localname deconstruction:: Breaking a localname into its components.
@end detailmenu
@end menu
@chapter Obtaining @tramp{}.
@cindex obtaining Tramp
-@tramp{} is freely available on the Internet and the latest release may be
-downloaded from
-@uref{ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/tramp.tar.gz}. This
-release includes the full documentation and code for @tramp{}, suitable
-for installation. But Emacs (21.4 or later) includes @tramp{}
-already, and there is a @tramp{} package for XEmacs, as well. So
-maybe it is easier to just use those. But if you want the bleeding
+@tramp{} is freely available on the Internet and the latest release
+may be downloaded from
+@uref{http://savannah.nongnu.org/download/tramp/}. This
+release includes the full documentation and code for @tramp{},
+suitable for installation. But Emacs (21.4 or later) includes
+@tramp{} already, and there is a @tramp{} package for XEmacs, as well.
+So maybe it is easier to just use those. But if you want the bleeding
edge, read on@dots{...}
-For the especially brave, @tramp{} is available from CVS. The CVS version
-is the latest version of the code and may contain incomplete features or
-new issues. Use these versions at your own risk.
+For the especially brave, @tramp{} is available from CVS. The CVS
+version is the latest version of the code and may contain incomplete
+features or new issues. Use these versions at your own risk.
Instructions for obtaining the latest development version of @tramp{}
from CVS can be found by going to the Savannah project page at the
-following URL and then clicking on the CVS link in the navigation bar at
-the top.
+following URL and then clicking on the CVS link in the navigation bar
+at the top.
@noindent
@uref{http://savannah.gnu.org/projects/tramp/}
@end example
@noindent
-You should now have a directory @file{~/@value{emacs-dir}/tramp} containing the latest
-version of @tramp{}. You can fetch the latest updates from the repository
-by issuing the command:
+You should now have a directory @file{~/@value{emacs-dir}/tramp}
+containing the latest version of @tramp{}. You can fetch the latest
+updates from the repository by issuing the command:
@example
] @strong{cd ~/@value{emacs-dir}/tramp}
] @strong{cvs update -d}
@end example
+@noindent
+Once you've got updated files from the CVS repository, you need to run
+@command{autoconf} in order to get an up-to-date @file{configure}
+script:
+
+@example
+] @strong{cd ~/@value{emacs-dir}/tramp}
+] @strong{autoconf}
+@end example
+
@node History
@chapter History of @tramp{}
to rebuilding your machine from scratch. ;)
Seriously though, the installation should be a fairly simple matter.
-
The easiest way to proceed is as follows:
@itemize @bullet
@item
Choose a directory, say @file{~/@value{emacs-dir}/}. Change into that
directory and unpack the tarball. This will give you a directory
-@file{~/@value{emacs-dir}/tramp/} which contains subdirectories
-@file{lisp} for the Lisp code and @file{texi} for the documentation.
-
-@item
-Optionally byte-compile all files in the Lisp directory,
-@file{~/@value{emacs-dir}/tramp/lisp/}, by issuing a command like the
-following from the top level directory
-@file{~/@value{emacs-dir}/tramp/}:
+@file{~/@value{emacs-dir}/tramp-@trampver{}/} which contains
+subdirectories @file{lisp} for the Lisp code and @file{texi} for the
+documentation. Make a symbolic link:
@example
-make EMACS=@value{emacs-dir} all
+ln -s tramp-@trampver{} tramp
@end example
-If there are missing libraries reported it is likely they are provided
-in the @file{~/@value{emacs-dir}/tramp/contrib/} directory. This
-case, you need to call @command{make} like this:
+@item
+@command{cd} to @file{~/@value{emacs-dir}/tramp/} and type
+@command{./configure} to configure Tramp for your system.
-@example
-make EMACS=@value{emacs-dir} USE_CONTRIB=1 all
-@end example
+Running `configure' takes awhile. While running, it prints some
+messages telling which features it is checking for.
+
+@item
+Type @command{make} to build the byte-compiled Lisp files as well as
+the Info manual.
+
+@item
+Type @command{make install} to install the Tramp Lisp files and Info
+manual.
+
+@item
+You can remove the byte-compiled Lisp files and the Info manual from
+the source directory by typing @command{make clean}. To also remove
+the files that @command{configure} created, type @command{make
+distclean}.
@item
NOTE: If you run into problems running the example @command{make}
Something similar can be done to create the info manual. Just change
to directory @file{~/@value{emacs-dir}/tramp/texi} and load the
@file{tramp.texi} file in @value{emacs-name}. Then press @kbd{M-x
-texinfo-format-buffer @key{RET}} to generate @file{tramp.info}.
+texinfo-format-buffer @key{RET}} to generate
+@file{~/@value{emacs-dir}/tramp/info/tramp}.
+@end itemize
-@item
-Tell @value{emacs-name} about the new Lisp directory and the
-@tramp{} package with the following lines in @file{~/.emacs}:
+@menu
+* Installation parameters:: Parameters in order to control installation.
+* Load paths:: How to plug-in @tramp{} into your environment.
+@end menu
+
+@node Installation parameters
+@section Parameters in order to control installation.
+@cindex installation
+
+By default, @command{make install} will install @tramp{}'s files in
+@file{@value{lispdir}} and @file{@value{infodir}}. You can specify an
+installation prefix other than @file{@value{prefix}} by giving
+@command{configure} the option @command{--prefix=PATH}.
+
+If your installed copy of Emacs is named something other than
+@command{@value{emacs-dir}}, you will need to tell `make' where to find it so
+that it can correctly byte-compile the @tramp{} sources.
+
+For example, to force the use of @value{emacs-other-name} you might do
+this:
+
+@example
+./configure --with-@value{emacs-other-dir}
+make
+make install
+@end example
+
+or this:
+
+@example
+./configure
+make EMACS=/usr/bin/@value{emacs-other-dir}-21.4
+make install
+@end example
+
+The syntax of @tramp{} file names is different for @value{emacs-name}
+and @value{emacs-other-name}. The Info manual will be generated for
+the Emacs flavor choosen in the @command{configure} phase. If you want
+the Info manual for the other version, you need to set the variable
+@command{EMACS_INFO} to @command{make}:
+
+@example
+./configure --with-@value{emacs-dir}
+make EMACS_INFO=@value{emacs-other-dir}
+@end example
+
+Also, the @command{--prefix=PATH} option to @command{configure} may
+not be general enough to set the paths you want. If not, you can pass
+variables to the @command{make} command to control the installation.
+For a complete list of tweakable variables, look in the makefile.
+
+For example, to put the Lisp files in @file{~/elisp} and the Info file
+in @file{~/info}, you would type:
+
+@example
+./configure
+make
+make lispdir=~/elisp infodir=~/info install
+@end example
+
+@tramp{} has some packages in its @file{contrib} directory which are
+missing in older Emacsen. If you want to use them, you must use the
+@command{USE_CONTRIB} environment variable:
+
+@example
+make USE_CONTRIB=1
+make USE_CONTRIB=1 install
+@end example
+
+@node Load paths
+@section How to plug-in @tramp{} into your environment.
+@cindex installation
+
+If you don't install @tramp{} into the intended directories, but prefer
+to use from the source directory, you need to add the following lines
+into your @file{.emacs}:
@lisp
(add-to-list 'load-path "~/@value{emacs-dir}/tramp/lisp/")
(require 'tramp)
@end lisp
-The second @command{add-to-list} must be used only if you've compiled
-with the @command{USE_CONTRIB} parameter.
+The second load-path must be used only if you've applied the
+@command{USE_CONTRIB} parameter.
+
+@ifset xemacs
+NOTE: For @value{emacs-name}, the package @file{fsf-compat} must be
+installed. For details on package installation, see @ref{Packages, ,
+,xemacs}.
+@ifhtml
+(If the previous link doesn't work, try the @value{emacs-name}
+documentation at
+@uref{http://www.xemacs.org/Documentation/packageGuide.html,the
+@value{emacs-name} site}.)
+@end ifhtml
+@end ifset
-@item
To be able to read the Info documentation, create a file
-@file{~/@value{emacs-dir}/tramp/texi/dir} using the
+@file{~/@value{emacs-dir}/tramp/info/dir} using the
@command{install-info} command, and add the directory to the search
path for Info.
NOTE:
On systems using the @cite{gnu} version of @command{install-info}, the
@command{install-info} syntax is very direct and simple. One can
-change to directory @file{~/@value{emacs-dir}/tramp/texi} and type:
+change to directory @file{~/@value{emacs-dir}/tramp/info} and type:
@example
-install-info tramp.info dir
+install-info tramp dir
@end example
and a @file{dir} file will be created with the @tramp{}
@value{emacs-name} at @file{/usr/info/dir}. Copy the top of this file
down to the first occurrence of @code{* Menu} including that line plus
one more blank line, to your working directory
-@file{~/@value{emacs-dir}/tramp/texi}, or use the sample
+@file{~/@value{emacs-dir}/tramp/info}, or use the sample
@file{~/@value{emacs-dir}/tramp/texi/dir_sample}.
Once a @file{dir} file is in place, this command will make the entry:
@example
-install-info --infodir=. tramp.info
+install-info --infodir=. tramp
@end example
If you want it in a specific category see @kbd{man install-info} for
further details.
If the environment variable @env{INFOPATH} is set, add the directory
-@file{~/@value{emacs-dir}/tramp/texi/} to it. Else, add the directory to
+@file{~/@value{emacs-dir}/tramp/info/} to it. Else, add the directory to
@ifset emacs
@code{Info-default-directory-list}, as follows:
@lisp
-(add-to-list 'Info-default-directory-list "~/@value{emacs-dir}/tramp/texi/")
+(add-to-list 'Info-default-directory-list "~/@value{emacs-dir}/tramp/info/")
@end lisp
@end ifset
@ifset xemacs
@code{Info-directory-list}, as follows:
@lisp
-(add-to-list 'Info-directory-list "~/@value{emacs-dir}/tramp/texi/")
+(add-to-list 'Info-directory-list "~/@value{emacs-dir}/tramp/info/")
@end lisp
@end ifset
-@end itemize
-
-@ifset xemacs
-For @value{emacs-name}, the package @file{fsf-compat} must be installed.
-For details on package installation, see @ref{Packages, , ,xemacs}.
-@ifhtml
-(If the previous link doesn't work, try the @value{emacs-name}
-documentation at
-@uref{http://www.xemacs.org/Documentation/packageGuide.html,the
-@value{emacs-name} site}.)
-@end ifhtml
-@end ifset
-
@node Configuration
@chapter Configuring @tramp{} for use
@cindex configuration
* Remote Programs:: How @tramp{} finds and uses programs on the remote machine.
* Remote shell setup:: Remote shell setup hints.
* Windows setup hints:: Issues with Cygwin ssh.
+* Auto-save and Backup:: Auto-save and Backup.
@end menu
@end table
+@node Auto-save and Backup
+@section Auto-save and Backup configuration
+@cindex auto-save
+@cindex backup
+@vindex backup-directory-alist
+
+Explaining auto-save is still to do.
+
+Normally, Emacs writes backup files to the same directory as the
+original files, but this behavior can be changed via the variable
+@code{backup-directory-alist}. In connection with @tramp{}, this can
+have unexpected side effects. Suppose that you specify that all backups
+should go to the directory @file{~/.emacs.d/backups/}, and then you edit
+the file @file{/su:root@@localhost:/etc/secretfile}. The effect is that
+the backup file will be owned by you and not by root, thus possibly
+enabling others to see it even if they were not intended to see it.
+
+When @code{backup-directory-alist} is nil (the default), such problems
+do not occur.
+
+If you wish to customize the variable, the workaround is to include
+special settings for Tramp files. For example, the following statement
+effectively `turns off' the effect of @code{backup-directory-alist} for
+@tramp{} files:
+
+@lisp
+(require 'tramp)
+(add-to-list 'backup-directory-alist
+ (cons tramp-file-name-regexp nil))
+@end lisp
+
+
@node Windows setup hints
@section Issues with Cygwin ssh
@cindex Cygwin, issues
@tramp{} is available under the URL below.
@noindent
-@uref{ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/tramp.tar.gz}
+@uref{http://savannah.nongnu.org/download/tramp/}
@noindent
There is also a Savannah project page.