• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/net/

Lines Matching +defs:add +defs:name +defs:to +defs:file

7 ;; (copyright statements below in code to be updated with the above notice)
13 ;; This file is part of GNU Emacs.
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
32 ;; This package provides remote file editing, similar to ange-ftp.
33 ;; The difference is that ange-ftp uses FTP to transfer files between
37 ;; For more detailed instructions, please see the info file.
44 ;; 19 is reported to have other problems. For XEmacs 21, you need the
51 ;; Also see the todo list at the bottom of this file.
56 ;; There's a mailing list for this, as well. Its name is:
58 ;; You can use the Web to subscribe, under the following URL:
66 ;; Don't forget to put on your asbestos longjohns, first!
72 (add-hook 'tramp-unload-hook
89 ;; feature even if implemented in C, but it appears to be necessary
99 (add-hook 'tramp-unload-hook
109 ;; Tramp is required in addition to EFS. (But why can't Tramp just
113 ;; Tramp only knows how to deal with `file-name-handler-alist', not
117 "Non-nil means to use unified Ange-FTP/Tramp filename syntax.
128 (add-hook 'tramp-unload-hook
136 (add-hook 'tramp-unload-hook
144 ;; UNC file names like "//host/share/localname".
149 (add-hook 'tramp-unload-hook
173 ;; to pacify Emacs byte-compiler.
191 "*Whether to send all commands and responses to a debug buffer."
201 in `backup-directory-alist'. If a Tramp file is backed up, and DIRECTORY
202 is a local file name, the backup directory is prepended with Tramp file
203 name prefix \(multi-method, method, user, host\) of file.
211 (directory :tag "Backup directory name"))))))
220 `backup-dir'. If a Tramp file is backed up, and BACKUP-DIR is a local
221 file name, the backup directory is prepended with Tramp file name prefix
222 \(multi-method, method, user, host\) of file.
234 (const prepend-name)
240 The idea is to use a local directory so that auto-saving is faster."
250 This shell is used to execute the encoding and decoding command on the
251 local host, so if you want to use `~' in those commands, you should
259 This variable can be used to change the \"/bin/sh\" part. See the
261 variable `tramp-encoding-reads-stdin' to specify whether the commands read
262 standard input or a file.
265 mechanisms in tramp.el which automatically determine the right shell to
268 :type '(file :must-match t))
283 Note that the commands always must write to standard output."
290 This variable is similar to `tramp-encoding-shell', but it is only used
292 commands sent to this shell is quite restricted, and if you are
293 careful it works to use CMD.EXE under Windows (instead of a Bourne-ish
299 This variable defaults to the value of `tramp-encoding-shell'."
301 :type '(file :must-match t))
306 ;; out to be necessary there, something will need to be done.
307 ;;-(defcustom tramp-file-name-quote-list
311 ;;-because it means something special to the shell. This takes effect
312 ;;-when sending file and directory names to the remote shell.
314 ;;-See `comint-file-name-quote-list' for details."
518 (tramp-login-args ("-ssh")) ;optionally add "-v"
527 (tramp-login-args ("-1" "-ssh")) ;optionally add "-v"
555 This specifies the function to use to connect to the remote host.
560 This specifies the Bourne shell to use on the remote host. This
561 MUST be a Bourne-like shell. It is normally not necessary to set
562 this to any value other than \"/bin/sh\": tramp wants to use a shell
565 the value that you decide to use. You Have Been Warned.
567 This specifies the name of the program to use for logging in to the
569 the name of rsh or a workalike program (when
571 name of telnet or a workalike (for `tramp-open-connection-telnet'),
572 or the name of su or a workalike (for `tramp-open-connection-su').
574 This specifies the list of arguments to pass to the above
576 that is, normally you don't want to put \"-a -b\" or \"-f foo\"
580 \"%u\" in this list is replaced by the user name, and \"%%\" can
581 be used to obtain a literal percent character.
582 \"%t\" is replaced by the temporary file name for `scp'-like methods.
584 This specifies the name of the program to use for remotely copying
585 the file; this might be the absolute filename of rcp or the name of
588 This specifies the list of parameters to pass to the above mentioned
591 This specifies the parameter to use for the copying program when the
592 timestamp of the original file should be kept. For `rcp', use `-p', for
595 This specifies the string to use for terminating the line after
600 not have to be newline or carriage return characters. Other login
605 for all methods; this program is used to log in to the remote site. Then,
606 there are two ways to actually transfer the files between the local and the
608 to do this, set `tramp-copy-program' in the method.
610 Another possibility for file transfer is inline transfer, i.e. the
611 file is passed through the same buffer used by `tramp-login-program'. In
612 this case, the file contents need to be protected since the
614 be eight-bit clean. Therefore, file contents are encoded for transit.
617 So, to summarize: if the method is an out-of-band method, then you
626 When using `tramp-open-connection-su' the phrase `open connection to a
628 consistency. No connection is opened to a remote host, but `su' is
629 started on the local host. You are not allowed to specify a remote
630 host other than `localhost' or the name of the local host."
658 Each entry in this list should be a method name as mentioned in the
673 where METHOD is the name as used in the file name, FUNCTION is the
674 function to be executed, and COMMAND is the shell command used for
678 user name, `%h' will be replaced with the host name, and `%n' will be
689 ;; An external copy method seems to be preferred, because it is much
722 "*Default method to use for transferring files.
730 "*Default method to use for specific user/host pairs.
732 specifies the method to use for a file name which does not specify a
737 If the file name does not specify the user, lookup is done using the
738 empty string for the user name.
751 "Default list of (FUNCTION FILE) pairs to be examined for rsh methods.")
768 "Default list of (FUNCTION FILE) pairs to be examined for ssh methods.")
774 "Default list of (FUNCTION FILE) pairs to be examined for telnet methods.")
780 "Default list of (FUNCTION FILE) pairs to be examined for su methods.")
786 \(FUNCTION FILE). FUNCTION is responsible to extract user names and host
858 I don't think this ever needs to be changed, so please tell me about it
859 if you need to change this.
871 It seems that people using plink under Windows need to send
876 The default value is to use the same value as `tramp-rsh-end-of-line'."
886 "*List of directories to search for executables on remote host.
887 Please notify me about other semi-standard directories to include here.
899 Sometimes the prompt is reported to look like \"login as:\"."
905 "Regexp to match prompts from remote shell.
906 Normally, Tramp expects you to configure `shell-prompt-pattern'
907 correctly, but sometimes it happens that you are connecting to a
911 variable is similar to the default value of `shell-prompt-pattern',
921 The `sudo' program appears to insert a `^@' character into the prompt."
949 (regexp-opt '("Are you sure you want to continue connecting (yes/no)?") t)
951 "Regular expression matching all yes/no queries which need to be confirmed.
963 "Regular expression matching all y/n queries which need to be confirmed.
994 "not a regular file"
996 "No such file or directory") t)
1005 In fact this expression is empty by intention, it will be used only to
1012 (defcustom tramp-temp-name-prefix "tramp."
1013 "*Prefix to use for temporary files.
1014 If this is a relative file name (such as \"tramp.\"), it is considered
1015 relative to the directory name returned by the function
1016 `tramp-temporary-file-directory' (which see). It may also be an
1017 absolute file name; don't forget to include a prefix for the filename
1023 "*If non-nil, try to discard garbage sent by remote shell.
1029 "*Alist specifying extra arguments to pass to the remote shell.
1031 matching the shell file name and ARGS is a string specifying the
1034 This variable is only used when Tramp needs to start up another shell
1036 shell from reading its init file."
1038 ;; This might be the wrong way to test whether the widget type
1039 ;; `alist' is available. Who knows the right way to test it?
1046 "*String matching the very beginning of tramp file names.
1047 Used in `tramp-make-tramp-file-name' and `tramp-make-tramp-multi-file-name'."
1053 "*Regexp matching the very beginning of tramp file names.
1070 Used in `tramp-make-tramp-file-name'."
1086 Used in `tramp-make-tramp-multi-file-name'."
1102 Used in `tramp-make-tramp-multi-file-name'."
1123 Used in `tramp-make-tramp-file-name' and `tramp-make-tramp-multi-file-name'."
1149 Used in `tramp-make-tramp-file-name' and `tramp-make-tramp-multi-file-name'."
1166 ;; File name format.
1168 (defcustom tramp-file-name-structure
1179 the tramp file name structure.
1181 The first element REGEXP is a regular expression matching a tramp file
1182 name. The regex should contain parentheses around the method name,
1183 the user name, the host name, and the file name parts.
1186 parentheses matches the method name. The third element USER is
1187 similar, but for the user name. The fourth element HOST is similar,
1188 but for the host name. The fifth element FILE is for the file name.
1189 These numbers are passed directly to `match-string', which see. That
1190 means the opening parentheses are counted to identify the pair.
1192 See also `tramp-file-name-regexp'."
1194 :type '(list (regexp :tag "File name regexp")
1195 (integer :tag "Paren pair for method name")
1196 (integer :tag "Paren pair for user name ")
1197 (integer :tag "Paren pair for host name ")
1198 (integer :tag "Paren pair for file name ")))
1201 (defconst tramp-file-name-regexp-unified
1203 "Value for `tramp-file-name-regexp' for unified remoting.
1205 Tramp. See `tramp-file-name-structure-unified' for more explanations.")
1208 (defconst tramp-file-name-regexp-separate
1210 "Value for `tramp-file-name-regexp' for separate remoting.
1212 See `tramp-file-name-structure-separate' for more explanations.")
1215 (defcustom tramp-file-name-regexp
1217 tramp-file-name-regexp-unified
1218 tramp-file-name-regexp-separate)
1219 "*Regular expression matching file names handled by tramp.
1220 This regexp should match tramp file names but no other file names.
1221 \(When tramp.el is loaded, this regular expression is prepended to
1222 `file-name-handler-alist', and that is searched sequentially. Thus,
1223 if the tramp entry appears rather early in the `file-name-handler-alist'
1227 Please note that the entry in `file-name-handler-alist' is made when
1228 this file (tramp.el) is loaded. This means that this variable must be set
1229 before loading tramp.el. Alternatively, `file-name-handler-alist' can be
1232 Also see `tramp-file-name-structure'."
1237 (defconst tramp-completion-file-name-regexp-unified
1239 "Value for `tramp-completion-file-name-regexp' for unified remoting.
1241 Tramp. See `tramp-file-name-structure-unified' for more explanations.")
1244 (defconst tramp-completion-file-name-regexp-separate
1246 "Value for `tramp-completion-file-name-regexp' for separate remoting.
1248 See `tramp-file-name-structure-separate' for more explanations.")
1251 (defcustom tramp-completion-file-name-regexp
1253 tramp-completion-file-name-regexp-unified
1254 tramp-completion-file-name-regexp-separate)
1255 "*Regular expression matching file names handled by tramp completion.
1256 This regexp should match partial tramp file names only.
1258 Please note that the entry in `file-name-handler-alist' is made when
1259 this file (tramp.el) is loaded. This means that this variable must be set
1260 before loading tramp.el. Alternatively, `file-name-handler-alist' can be
1263 Also see `tramp-file-name-structure'."
1267 (defcustom tramp-multi-file-name-structure
1275 "*Describes the file name structure of `multi' files.
1276 Multi files allow you to contact a remote host in several hops.
1279 The first element, REGEXP, gives a regular expression to match against
1280 the file name. In this regular expression, `%s' is replaced with the
1281 value of `tramp-multi-file-name-hop-structure'. (Note: in order to
1282 allow multiple hops, you normally want to use something like
1287 paren pair which matches the method name. HOP gives the number of the
1291 LOCALNAME can also be negative, which means to count from the end. Ie, a
1297 :type '(list (regexp :tag "File name regexp")
1298 (integer :tag "Paren pair for method name")
1300 (integer :tag "Paren pair to match localname")))
1302 (defcustom tramp-multi-file-name-hop-structure
1311 element REGEXP is used to match against the hop. Pair number METHOD
1318 (integer :tag "Paren pair for method name")
1319 (integer :tag "Paren pair for user name")
1320 (integer :tag "Paren pair for host name")))
1322 (defcustom tramp-make-multi-tramp-file-format
1330 "*Describes how to construct a `multi' file name.
1333 The first element PREFIX says how to construct the prefix, the second
1335 LOCALNAME says how to construct the localname (pathname).
1337 In PREFIX, `%%' means `%' and `%m' means the method name.
1344 The resulting file name always contains one copy of PREFIX and one
1345 copy of LOCALNAME, but there is one copy of HOP for each hop in the file
1346 name.
1348 Note: the current implementation requires the prefix to contain the
1349 method name, followed by all the hops, and the localname must come
1355 "*Value of TERM environment variable for logging in to remote host.
1356 Because Tramp wants to parse the output of the remote shell, it is easily
1367 completion is possible (subject to the variable `completion-ignore-case'),
1387 variable gives the regular expression to search for. Note that the
1389 appended to it.
1424 "List of commands to send to the first remote shell that we see.
1425 These commands will be sent to any shell, and thus they should be
1426 designed to work in such circumstances. Also, restrict the commands
1427 to the bare necessity for getting the remote shell into a state
1428 where it is possible to execute the Bourne-ish shell.
1430 At the moment, the command to execute the Bourne-ish shell uses strange
1431 quoting which `tcsh' tries to correct, so we send the command \"unset
1432 autocorrect\" to the remote host."
1436 ;; Chunked sending kluge. We set this to 500 for black-listed constellations
1437 ;; known to have a bug in `process-send-string'; some ssh connections appear
1438 ;; to drop bytes when data is sent too quickly. There is also a connection
1447 ;; `open-paren-in-column-0-is-defun-start' set to t.
1448 "*If non-nil, chunksize for sending input to local process.
1460 (let ((proc (start-process (buffer-name) (current-buffer)
1470 (setq received (string-to-number (match-string 0)))
1475 (message \"You should set `tramp-chunksize' to a maximum of %s\"
1482 \(replace \"xxx\" and \"yyy\" by the remote user and host name,
1486 \"ssh\" to run without password query, see ssh-agent(1).
1488 You will see the number of bytes sent successfully to the remote host.
1497 When it is necessary to set `tramp-chunksize', you might consider to
1499 \(like \"ssh\"), because setting `tramp-chunksize' to non-nil decreases
1503 this variable to be set as well."
1507 ;; Logging in to a remote host normally requires obtaining a pty. But
1508 ;; Emacs on MacOS X has process-connection-type set to nil by default,
1513 Tramp binds process-connection-type to the value given here before
1514 opening a connection to a remote host."
1520 (defvar tramp-buffer-file-attributes nil
1522 This variable is local to each buffer. It is not used if the remote
1524 the visited file modtime.")
1525 (make-variable-buffer-local 'tramp-buffer-file-attributes)
1533 "Function to call for running the MD5 algorithm.")
1539 (prin1-to-string process-environment)
1541 ;; (prin1-to-string
1545 ;; (tramp-temporary-file-directory)))
1548 ;; (cons x (file-attributes x)))
1550 ;; (tramp-temporary-file-directory))
1553 "String used to recognize end of output.")
1617 "This command is used to get a long listing with numeric user and group ids.
1618 This variable is automatically made buffer-local to each rsh process buffer
1623 This variable is automatically made buffer-local to each rsh process buffer
1628 This variable is automatically made buffer-local to each rsh process buffer
1632 "Remote login name for this *tramp* buffer.
1633 This variable is automatically made buffer-local to each rsh process buffer
1638 This variable is automatically made buffer-local to each rsh process buffer
1643 \(`test A -nt B' tests if file A is newer than file B.)
1644 This variable is automatically made buffer-local to each rsh process buffer
1647 (defvar tramp-file-exists-command nil
1648 "Command to use for checking if a file exists.
1649 This variable is automatically made buffer-local to each rsh process buffer
1658 "Shell function to implement `uudecode' to standard output.
1663 ;; Perl script to implement `file-attributes' in a Lisp `read'able
1668 ;; device number set in `tramp-handle-file-attributes'
1669 (defconst tramp-perl-file-attributes "\
1703 "Perl script to produce output suitable for use with `file-attributes'
1704 on the remote file system.")
1707 chdir($ARGV[0]) or printf(\"\\\"Cannot change to $ARGV[0]: $''!''\\\"\\n\"), exit();
1767 ;; "Perl program to use for encoding a file.
1768 ;; Escape sequence %s is replaced with name of Perl binary.")
1773 ;; "Perl program to use for decoding a file.
1774 ;; Escape sequence %s is replaced with name of Perl binary.")
1779 "Perl program to use for encoding a file.
1780 Escape sequence %s is replaced with name of Perl binary.
1781 This string is passed to `format', so percent characters need to be doubled.
1782 This implementation requires the MIME::Base64 Perl module to be installed
1787 "Perl program to use for decoding a file.
1788 Escape sequence %s is replaced with name of Perl binary.
1789 This string is passed to `format', so percent characters need to be doubled.
1790 This implementation requires the MIME::Base64 Perl module to be installed
1808 # We read in chunks of 54 bytes, to generate output lines
1821 # Not the fastest method, but it is simple: unpack to binary string, split
1822 # by groups of 6 bits and convert back from binary to byte; then map into
1832 "Perl program to use for encoding a file.
1833 Escape sequence %s is replaced with name of Perl binary.
1834 This string is passed to `format', so percent characters need to be doubled.")
1853 # We are going to accumulate into $pending to accept any line length
1861 # any following data is to be discarded
1869 # Easy method: translate from chars to (pregenerated) six-bit packets, join,
1870 # split in 8-bit chunks and convert back to char.
1878 "Perl program to use for decoding a file.
1879 Escape sequence %s is replaced with name of Perl binary.
1880 This string is passed to `format', so percent characters need to be doubled.")
1882 (defconst tramp-file-mode-type-map '((0 . "-") ; Normal file (SVID-v2 and XPG2)
1887 (5 . "?") ; Named special file (XENIX)
1890 (8 . "-") ; regular file
1891 (9 . "n") ; network special file (HP-UX)
1897 "A list of file types returned from the `stat' system call.
1898 This is used to map a mode number to a permission string.")
1913 "Whether to process echoes from the remote shell.")
1924 (let ((file-coding-system-alist '(("test" emacs-mule))))
1927 "Internal variable to say if `write-region' chooses the right coding.
1932 ;; handled using the normal primitives: file-name-as-directory,
1933 ;; file-name-directory, file-name-nondirectory,
1934 ;; file-name-sans-versions, get-file-buffer.
1935 (defconst tramp-file-name-handler-alist
1939 (file-name-directory . tramp-handle-file-name-directory)
1940 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
1941 (file-truename . tramp-handle-file-truename)
1942 (file-exists-p . tramp-handle-file-exists-p)
1943 (file-directory-p . tramp-handle-file-directory-p)
1944 (file-executable-p . tramp-handle-file-executable-p)
1945 (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
1946 (file-readable-p . tramp-handle-file-readable-p)
1947 (file-regular-p . tramp-handle-file-regular-p)
1948 (file-symlink-p . tramp-handle-file-symlink-p)
1949 (file-writable-p . tramp-handle-file-writable-p)
1950 (file-ownership-preserved-p . tramp-handle-file-ownership-preserved-p)
1951 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
1952 (file-attributes . tramp-handle-file-attributes)
1953 (file-modes . tramp-handle-file-modes)
1956 (file-name-all-completions . tramp-handle-file-name-all-completions)
1957 (file-name-completion . tramp-handle-file-name-completion)
1958 (add-name-to-file . tramp-handle-add-name-to-file)
1959 (copy-file . tramp-handle-copy-file)
1960 (rename-file . tramp-handle-rename-file)
1961 (set-file-modes . tramp-handle-set-file-modes)
1964 (delete-file . tramp-handle-delete-file)
1965 (directory-file-name . tramp-handle-directory-file-name)
1967 (process-file . tramp-handle-process-file)
1969 (expand-file-name . tramp-handle-expand-file-name)
1970 (file-local-copy . tramp-handle-file-local-copy)
1971 (file-remote-p . tramp-handle-file-remote-p)
1972 (insert-file-contents . tramp-handle-insert-file-contents)
1974 (find-backup-file-name . tramp-handle-find-backup-file-name)
1975 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
1976 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
1977 (dired-compress-file . tramp-handle-dired-compress-file)
1981 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
1982 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime))
1986 ;; Handlers for partial tramp file names. For Emacs just
1987 ;; `file-name-all-completions' is needed.
1989 (defconst tramp-completion-file-name-handler-alist
1990 '((file-name-all-completions . tramp-completion-handle-file-name-all-completions)
1991 (file-name-completion . tramp-completion-handle-file-name-completion))
1993 Used for file names matching `tramp-file-name-regexp'. Operations not
1994 mentioned here will be handled by `tramp-file-name-handler-alist' or the
1998 (defvar tramp-foreign-file-name-handler-alist
1999 ;; (identity . tramp-sh-file-name-handler) should always be the last
2001 '((identity . tramp-sh-file-name-handler))
2003 If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by
2010 First arg LEVEL says to be quiet if `tramp-verbose' is less than LEVEL. The
2011 message is emitted only if `tramp-verbose' is greater than or equal to LEVEL.
2013 ARGS to actually emit the message (if applicable).
2015 This function expects to be called from the tramp buffer only!"
2033 "Like `tramp-message' but temporarily switches to the tramp buffer.
2034 First three args METHOD, USER, and HOST identify the tramp buffer to use,
2035 remaining args passed to `tramp-message'."
2049 (defmacro with-parsed-tramp-file-name (filename var &rest body)
2053 Second arg VAR is a symbol. It is used as a variable name to hold
2056 `foo' will be bound to the whole structure, `foo-multi-method' will
2057 be bound to the multi-method component, and so on for `foo-method',
2060 Remaining args are Lisp expressions to be evaluated (inside an implicit
2063 If VAR is nil, then we bind `v' to the structure and `multi-method',
2064 `method', `user', `host', `localname' to the components."
2065 `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
2066 (,(if var (intern (concat (symbol-name var) "-multi-method")) 'multi-method)
2067 (tramp-file-name-multi-method ,(or var 'v)))
2068 (,(if var (intern (concat (symbol-name var) "-method")) 'method)
2069 (tramp-file-name-method ,(or var 'v)))
2070 (,(if var (intern (concat (symbol-name var) "-user")) 'user)
2071 (tramp-file-name-user ,(or var 'v)))
2072 (,(if var (intern (concat (symbol-name var) "-host")) 'host)
2073 (tramp-file-name-host ,(or var 'v)))
2074 (,(if var (intern (concat (symbol-name var) "-localname")) 'localname)
2075 (tramp-file-name-localname ,(or var 'v))))
2078 (put 'with-parsed-tramp-file-name 'lisp-indent-function 2)
2080 (def-edebug-spec with-parsed-tramp-file-name (form symbolp body))
2082 (when (functionp 'font-lock-add-keywords)
2083 (funcall 'font-lock-add-keywords
2084 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>")))
2087 "Let-bind VARIABLE to VALUE in BODY, but only if VARIABLE is not obsolete.
2089 The intent is to protect against `obsolete variable' warnings."
2102 The FUNCTION is intended to parse FILE according its syntax.
2125 ;; Check for function and file
2127 (file-exists-p (nth 1 (car v))))
2132 (add-to-list 'tramp-completion-function-alist
2145 If LINKNAME is a non-Tramp file, it is used verbatim as the target of
2146 the symlink. If LINKNAME is a Tramp file, only the localname component is
2149 If LINKNAME is a Tramp file and the localname component is relative, then
2153 (with-parsed-tramp-file-name linkname l
2155 (cwd (file-name-directory l-localname)))
2157 (signal 'file-error
2162 (when (file-exists-p linkname)
2163 ;; What to do?
2164 (if (or (null ok-if-already-exists) ; not allowed to exist
2170 (signal 'file-already-exists (list "File already exists" l-localname))
2171 (delete-file linkname)))
2173 ;; If FILENAME is a Tramp name, use just the localname component.
2174 (when (tramp-tramp-file-p filename)
2175 (setq filename (tramp-file-name-localname
2176 (tramp-dissect-file-name
2177 (expand-file-name filename)))))
2181 ;; that FILENAME belongs to.
2192 (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
2194 (unless (file-name-absolute-p file)
2195 (error "Tramp cannot `load' files without absolute file name"))
2196 (with-parsed-tramp-file-name file nil
2198 (cond ((file-exists-p (concat file ".elc"))
2199 (setq file (concat file ".elc")))
2200 ((file-exists-p (concat file ".el"))
2201 (setq file (concat file ".el")))))
2203 ;; The first condition is always true for absolute file names.
2205 (unless (or (file-name-directory file)
2206 (string-match "\\.elc?\\'" file))
2208 file)))
2210 (when (not (file-exists-p file))
2211 (error "Cannot load nonexistent file `%s'" file)))
2212 (if (not (file-exists-p file))
2215 (message "Loading %s..." file))
2216 (let ((local-copy (file-local-copy file)))
2217 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
2219 (delete-file local-copy))
2221 (message "Loading %s...done" file))
2225 (defun tramp-handle-file-name-directory (file)
2226 "Like `file-name-directory' but aware of TRAMP files."
2228 (with-parsed-tramp-file-name file nil
2230 (tramp-make-tramp-file-name
2231 multi-method method user host (file-name-directory (or localname "")))))
2233 (defun tramp-handle-file-name-nondirectory (file)
2234 "Like `file-name-nondirectory' but aware of TRAMP files."
2235 (with-parsed-tramp-file-name file nil
2236 (file-name-nondirectory localname)))
2238 (defun tramp-handle-file-truename (filename &optional counter prev-dirs)
2239 "Like `file-truename' for tramp files."
2240 (with-parsed-tramp-file-name (expand-file-name filename) nil
2243 (file-name-as-directory localname)))
2250 ;; is hung. Of course, correctness has to come first.
2256 10 "Finding true name for `%s'" filename)
2266 (nth 0 (file-attributes
2267 (tramp-make-tramp-file-name
2285 10 "Follow symlink to %s" symlink-target)
2287 (when (file-name-absolute-p symlink-target)
2292 (when (tramp-tramp-file-p symlink-target)
2293 (with-parsed-tramp-file-name symlink-target sym
2303 ;; It's a file.
2308 ;; Combine list to form string.
2318 10 "True name of `%s' is `%s'" filename result)
2319 (tramp-make-tramp-file-name
2324 (defun tramp-handle-file-exists-p (filename)
2325 "Like `file-exists-p' for tramp files."
2326 (with-parsed-tramp-file-name filename nil
2331 (tramp-get-file-exists-command multi-method method user host)
2334 ;; Devices must distinguish physical file systems. The device numbers
2337 ;; EFS use device number "-1". In order to be different, we use device number
2345 (defun tramp-handle-file-attributes (filename &optional id-format)
2346 "Like `file-attributes' for tramp files."
2347 (when (file-exists-p filename)
2348 ;; file exists, find out stuff
2350 (with-parsed-tramp-file-name filename nil
2352 (tramp-convert-file-attributes
2355 (tramp-handle-file-attributes-with-perl multi-method method user host
2357 (tramp-handle-file-attributes-with-ls multi-method method user host
2360 (defun tramp-handle-file-attributes-with-ls
2362 "Implement `file-attributes' for tramp files using the ls(1) command."
2367 "file attributes with ls: %s"
2368 (tramp-make-tramp-file-name
2394 ;; ... file mode flags
2395 (setq res-filemodes (symbol-name (read (current-buffer))))
2406 ;; From the file modes, figure out other stuff.
2409 ;; if symlink, find out file name pointed to
2417 ;; 0. t for directory, string (name linked to) for symbolic
2420 ;; 1. Number of links to file.
2431 '(0 0) '(0 0) '(0 0) ;CCC how to find out?
2436 ;; 9. t iff file's gid would change if file were deleted and
2437 ;; recreated. Will be set in `tramp-convert-file-attributes'
2445 (defun tramp-handle-file-attributes-with-perl
2447 "Implement `file-attributes' for tramp files using a Perl script."
2449 "file attributes with perl: %s"
2450 (tramp-make-tramp-file-name
2453 tramp-perl-file-attributes
2461 (defun tramp-handle-set-visited-file-modtime (&optional time-list)
2462 "Like `set-visited-file-modtime' for tramp files."
2463 (unless (buffer-file-name)
2464 (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file"
2465 (buffer-name)))
2467 (tramp-run-real-handler 'set-visited-file-modtime (list time-list))
2468 (let ((f (buffer-file-name))
2470 (with-parsed-tramp-file-name f nil
2471 (let* ((attr (file-attributes f))
2472 ;; '(-1 65535) means file doesn't exists yet.
2477 ;; `tramp-handle-file-attributes-with-ls'.
2479 (tramp-run-real-handler 'set-visited-file-modtime (list modtime))
2489 (setq tramp-buffer-file-attributes attr))
2497 ;; `tramp-handle-set-visited-file-modtime'.
2498 (defun tramp-handle-verify-visited-file-modtime (buf)
2499 "Like `verify-visited-file-modtime' for tramp files.
2500 At the time `verify-visited-file-modtime' calls this function, we
2501 already know that the buffer is visiting a file and that
2502 `visited-file-modtime' does not return 0. Do not call this
2506 ;; There is no file visiting the buffer, or the buffer has no
2508 (if (or (not (buffer-file-name))
2509 (eq (visited-file-modtime) 0))
2511 (let ((f (buffer-file-name)))
2512 (with-parsed-tramp-file-name f nil
2513 (let* ((attr (file-attributes f))
2515 (mt (visited-file-modtime)))
2518 ;; file exists, and has a known modtime.
2524 ;; return values of `visited-file-modtime'.
2540 (equal tramp-buffer-file-attributes attr))
2541 ;; If file does not exist, say it is not modified
2545 (defun tramp-handle-set-file-modes (filename mode)
2546 "Like `set-file-modes' for tramp files."
2547 (with-parsed-tramp-file-name filename nil
2552 (tramp-decimal-to-octal mode)
2554 (signal 'file-error
2557 "error while changing file's mode"
2562 (defun tramp-handle-file-executable-p (filename)
2563 "Like `file-executable-p' for tramp files."
2564 (with-parsed-tramp-file-name filename nil
2567 (defun tramp-handle-file-readable-p (filename)
2568 "Like `file-readable-p' for tramp files."
2569 (with-parsed-tramp-file-name filename nil
2572 (defun tramp-handle-file-accessible-directory-p (filename)
2573 "Like `file-accessible-directory-p' for tramp files."
2574 (with-parsed-tramp-file-name filename nil
2582 ;; newer than). If this breaks, tell me about it and I'll try to do
2584 (defun tramp-handle-file-newer-than-file-p (file1 file2)
2585 "Like `file-newer-than-file-p' for tramp files."
2586 (cond ((not (file-exists-p file1))
2588 ((not (file-exists-p file2))
2593 ;; We try to get the mtime of both files. If they are not
2594 ;; equal to the "dont-know" value, then we subtract the times
2596 (let ((fa1 (file-attributes file1))
2597 (fa2 (file-attributes file2)))
2602 ;; still try to run a shell command on the remote host.
2606 (unless (and (tramp-tramp-file-p file1)
2607 (tramp-tramp-file-p file2))
2609 'file-error
2611 "Cannot check if Tramp file is newer than non-Tramp file"
2613 (with-parsed-tramp-file-name file1 v1
2614 (with-parsed-tramp-file-name file2 v2
2619 (signal 'file-error
2622 (unless (and (tramp-tramp-file-p file1)
2623 (tramp-tramp-file-p file2))
2624 (signal 'file-error
2635 (defun tramp-handle-file-modes (filename)
2636 "Like `file-modes' for tramp files."
2637 (with-parsed-tramp-file-name filename nil
2638 (when (file-exists-p filename)
2639 (tramp-mode-string-to-int
2640 (nth 8 (file-attributes filename))))))
2642 (defun tramp-handle-file-directory-p (filename)
2643 "Like `file-directory-p' for tramp files."
2645 ;; pointing to directories. Surely the most obvious implementation
2652 (with-parsed-tramp-file-name filename nil
2661 (defun tramp-handle-file-regular-p (filename)
2662 "Like `file-regular-p' for tramp files."
2663 (with-parsed-tramp-file-name filename nil
2664 (and (file-exists-p filename)
2665 (eq ?- (aref (nth 8 (file-attributes filename)) 0)))))
2667 (defun tramp-handle-file-symlink-p (filename)
2668 "Like `file-symlink-p' for tramp files."
2669 (with-parsed-tramp-file-name filename nil
2670 (let ((x (car (file-attributes filename))))
2672 ;; When Tramp is running on VMS, then `file-name-absolute-p'
2674 (if (file-name-absolute-p x)
2675 (tramp-make-tramp-file-name
2679 (defun tramp-handle-file-writable-p (filename)
2680 "Like `file-writable-p' for tramp files."
2681 (with-parsed-tramp-file-name filename nil
2682 (if (file-exists-p filename)
2685 ;; If file doesn't exist, check if directory is writable.
2687 "-d" (file-name-directory filename)))
2689 "-w" (file-name-directory filename)))))))
2691 (defun tramp-handle-file-ownership-preserved-p (filename)
2692 "Like `file-ownership-preserved-p' for tramp files."
2693 (with-parsed-tramp-file-name filename nil
2694 (let ((attributes (file-attributes filename)))
2695 ;; Return t if the file doesn't exist, since it's true that no
2701 ;; Other file name ops.
2704 ;; (defun tramp-handle-directory-file-name (directory)
2705 ;; "Like `directory-file-name' for tramp files."
2712 ;; (defun tramp-handle-directory-file-name (directory)
2713 ;; "Like `directory-file-name' for tramp files."
2714 ;; (with-parsed-tramp-file-name directory nil
2718 ;; (eq (string-match tramp-file-name-regexp directory) 0)
2723 (defun tramp-handle-directory-file-name (directory)
2724 "Like `directory-file-name' for tramp files."
2727 ;; Method, host, etc, are unchanged. Does it make sense to try
2728 ;; to avoid parsing the filename?
2729 (with-parsed-tramp-file-name directory nil
2741 (with-parsed-tramp-file-name directory nil
2748 'file-error
2762 (push (concat (file-name-as-directory directory)
2771 ;; tramp-handle-file-name-all-completions.
2780 (when (file-regular-p item)
2785 (when (file-directory-p item)
2792 (when (tramp-handle-file-exists-p directory)
2794 (setq directory (tramp-handle-expand-file-name directory))
2795 (with-parsed-tramp-file-name directory nil
2816 (tramp-convert-file-attributes multi-method method user host
2818 ;; If FULL, make file name absolute
2825 ;; files. We use `ls -ad' to get a list of files (including
2826 ;; directories), and `find . -type d \! -name . -prune' to get a list
2828 (defun tramp-handle-file-name-all-completions (filename directory)
2829 "Like `file-name-all-completions' for tramp files."
2830 (with-parsed-tramp-file-name directory nil
2838 nil 'file-error
2839 "tramp-handle-file-name-all-completions: Couldn't `cd %s'"
2874 (defun tramp-handle-file-name-completion
2876 "Like `file-name-completion' for tramp files."
2877 (unless (tramp-tramp-file-p directory)
2879 "tramp-handle-file-name-completion invoked on non-tramp directory `%s'"
2883 (mapcar 'list (file-name-all-completions filename directory))
2885 (lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
2889 (defun tramp-handle-add-name-to-file
2891 "Like `add-name-to-file' for tramp files."
2892 (with-parsed-tramp-file-name filename v1
2893 (with-parsed-tramp-file-name newname v2
2901 (error "add-name-to-file: %s"
2904 (file-exists-p newname)
2908 "File %s already exists; make it a new name anyway? "
2910 (error "add-name-to-file: file %s already exists" newname))
2915 nil 'file-error
2916 "error with add-name-to-file, see buffer `%s' for details"
2917 (buffer-name))))))
2919 (defun tramp-handle-copy-file
2921 "Like `copy-file' for tramp files."
2922 ;; Check if both files are local -- invoke normal copy-file.
2924 (setq filename (expand-file-name filename))
2925 (setq newname (expand-file-name newname))
2926 ;; At least one file a tramp file?
2927 (if (or (tramp-tramp-file-p filename)
2928 (tramp-tramp-file-p newname))
2929 (tramp-do-copy-or-rename-file
2932 'copy-file
2935 (defun tramp-handle-rename-file
2937 "Like `rename-file' for tramp files."
2938 ;; Check if both files are local -- invoke normal rename-file.
2940 (setq filename (expand-file-name filename))
2941 (setq newname (expand-file-name newname))
2942 ;; At least one file a tramp file?
2943 (if (or (tramp-tramp-file-p filename)
2944 (tramp-tramp-file-p newname))
2945 (tramp-do-copy-or-rename-file
2947 (tramp-run-real-handler 'rename-file
2950 (defun tramp-do-copy-or-rename-file
2952 "Copy or rename a remote file.
2953 OP must be `copy' or `rename' and indicates the operation to perform.
2954 FILENAME specifies the file to copy or rename, NEWNAME is the name of
2955 the new file (for copy) or the new name of the file (for rename).
2957 KEEP-DATE means to make sure that NEWNAME has the same timestamp
2960 This function is invoked by `tramp-handle-copy-file' and
2961 `tramp-handle-rename-file'. It is an error if OP is neither of `copy'
2962 and `rename'. FILENAME and NEWNAME must be absolute file names."
2966 (when (file-exists-p newname)
2967 (signal 'file-already-exists
2969 (let ((t1 (tramp-tramp-file-p filename))
2970 (t2 (tramp-tramp-file-p newname))
2975 ;; We cannot invoke `with-parsed-tramp-file-name';
2976 ;; it fails if the file isn't a Tramp file name.
2978 (with-parsed-tramp-file-name filename l
2986 (with-parsed-tramp-file-name newname l
3005 (tramp-do-copy-or-rename-file-directly
3011 ;; default-directory should point to a local
3012 ;; directory if we want to invoke rcp.
3020 (tramp-do-copy-or-rename-file-out-of-band
3023 ;; file first. If the operation was `rename', we go
3024 ;; back and delete the original file (if the copy was
3027 ;; source file into it, then write out the buffer to
3028 ;; the target file. The advantage is that it doesn't
3030 ;; source and target file.
3032 (tramp-do-copy-or-rename-file-via-buffer
3035 ;; One file is a Tramp file, the other one is local.
3037 ;; If the Tramp file has an out-of-band method, the corresponding
3045 (tramp-do-copy-or-rename-file-out-of-band
3048 (tramp-do-copy-or-rename-file-via-buffer
3052 ;; One of them must be a Tramp file.
3055 (defun tramp-do-copy-or-rename-file-via-buffer (op filename newname keep-date)
3056 "Use an Emacs buffer to copy or rename a file.
3058 FILENAME is the source file, NEWNAME the target file.
3061 (modtime (nth 5 (file-attributes filename))))
3064 1 (concat "Warning: cannot preserve file time stamp"
3068 (insert-file-contents-literally filename)
3069 ;; We don't want the target file to be compressed, so we let-bind
3070 ;; `jka-compr-inhibit' to t.
3080 (set-file-modes newname (file-modes filename)))
3081 ;; If the operation was `rename', delete the original file.
3083 (delete-file filename))))
3085 (defun tramp-do-copy-or-rename-file-directly
3092 ;; CCC: What happens to the timestamp when renaming?
3115 (pop-to-buffer (current-buffer))
3116 (signal 'file-error
3118 (buffer-name)))))
3123 (set-file-modes
3124 (tramp-make-tramp-file-name multi-method method user host localname2)
3125 (file-modes
3126 (tramp-make-tramp-file-name
3129 (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date)
3130 "Invoke rcp program to copy.
3131 One of FILENAME and NEWNAME must be a Tramp name, the other must
3133 (let ((t1 (tramp-tramp-file-p filename))
3134 (t2 (tramp-tramp-file-p newname))
3141 ;; We cannot invoke `with-parsed-tramp-file-name';
3142 ;; it fails if the file isn't a Tramp file name.
3144 (with-parsed-tramp-file-name filename l
3164 (with-parsed-tramp-file-name newname l
3184 ;; mechanism to parse extra host args.
3191 (tramp-make-copy-program-file-name
3201 (tramp-make-copy-program-file-name
3210 x `((?t . ,(format "/tmp/%s" tramp-temp-name-prefix)))))
3229 (tramp-buffer-name multi-method method user host)))
3244 (message "Transferring %s to %s..." filename newname)
3246 ;; Use rcp-like program for file transfer.
3250 (file-accessible-directory-p default-directory))
3252 (tramp-temporary-file-directory)))
3253 (p (apply 'start-process (buffer-name trampbuf) trampbuf
3259 (message "Transferring %s to %s...done" filename newname)
3263 (set-file-modes newname (file-modes filename))))
3265 ;; If the operation was `rename', delete the original file.
3267 (delete-file filename))))
3272 (setq dir (expand-file-name dir))
3273 (with-parsed-tramp-file-name dir nil
3280 nil 'file-error
3286 (setq directory (expand-file-name directory))
3287 (with-parsed-tramp-file-name directory nil
3295 (defun tramp-handle-delete-file (filename)
3296 "Like `delete-file' for tramp files."
3297 (setq filename (expand-file-name filename))
3298 (with-parsed-tramp-file-name filename nil
3304 (signal 'file-error "Couldn't delete Tramp file")))))
3308 ;; CCC: This does not seem to be enough. Something dies when
3313 (with-parsed-tramp-file-name filename nil
3316 (or (file-exists-p filename)
3318 'file-error
3319 (list "Removing old file name" "no such directory" filename)))
3323 ;; Wait for the remote system to return to us...
3327 (and (file-exists-p filename)
3328 (error "Failed to recursively delete %s" filename))))
3332 (with-parsed-tramp-file-name default-directory nil
3337 nil 'file-error
3346 ;; changes its contents before insertion due to calling
3347 ;; `expand-file' and alike.
3358 (defun tramp-handle-dired-compress-file (file &rest ok-flag)
3359 "Like `dired-compress-file' for tramp files."
3362 (with-parsed-tramp-file-name file nil
3367 (symbol-value 'dired-compress-file-suffixes)
3369 ;; transformed into `dired-compress-file-suffixes' structure.
3377 ;; See if any suffix rule matches this file name.
3384 (cond ((file-symlink-p file)
3388 (message "Uncompressing %s..." file)
3392 (message "Uncompressing %s...done" file)
3393 ;; `dired-remove-file' is not defined in XEmacs
3394 (funcall (symbol-function 'dired-remove-file) file)
3395 (string-match (car suffix) file)
3396 (concat (substring file 0 (match-beginning 0)))))
3398 ;; We don't recognize the file as compressed, so compress it.
3400 (message "Compressing %s..." file)
3404 (message "Compressing %s...done" file)
3405 ;; `dired-remove-file' is not defined in XEmacs
3406 (funcall (symbol-function 'dired-remove-file) file)
3407 (cond ((file-exists-p (concat file ".gz"))
3408 (concat file ".gz"))
3409 ((file-exists-p (concat file ".z"))
3410 (concat file ".z"))
3414 ;; not sure at all that this is the right way to do it, but let's hope
3415 ;; it works for now, and wait for a guru to point out the Right Way to
3438 (setq filename (expand-file-name filename))
3439 (with-parsed-tramp-file-name filename nil
3446 (setq wildcard (file-name-nondirectory localname))
3447 (setq localname (file-name-directory localname)))
3456 ;; Else we chdir to the parent directory, then say `ls -ld BASENAME'.
3469 (file-name-directory localname)))
3470 nil 'file-error
3472 (tramp-shell-quote-argument (file-name-directory localname)))
3480 (if (zerop (length (file-name-nondirectory localname)))
3483 (file-name-nondirectory localname)))))))
3487 ;; out. Let's leave the let-binding in for a while to see
3492 ;; changes its contents before insertion due to calling
3493 ;; `expand-file' and alike.
3498 ;; On XEmacs, we want to call (exchange-point-and-mark t), but
3500 ;; Since zmacs-region-stays doesn't exist in Emacs, this ought to
3501 ;; be safe. Thanks to Daniel Pittman <daniel@danann.net>.
3508 ;; Please test it on various XEmacs versions to see if it works.
3509 ;; ;; Another XEmacs specialty follows. What's the right way to do
3518 ;; Continuation of kluge to pacify byte-compiler.
3523 ;; CCC is this the right thing to do?
3524 (defun tramp-handle-unhandled-file-name-directory (filename)
3525 "Like `unhandled-file-name-directory' for tramp files."
3526 (with-parsed-tramp-file-name filename nil
3527 (expand-file-name "~/")))
3529 ;; Canonicalization of file names.
3531 (defun tramp-drop-volume-letter (name)
3532 "Cut off unnecessary drive letter from file NAME.
3533 The function `tramp-handle-expand-file-name' calls `expand-file-name'
3534 locally on a remote file name. When the local system is a W32 system
3536 letter into the file name. This function removes it.
3539 (if (and (> (length name) 1)
3540 (char-equal (aref name 1) ?:)
3541 (let ((c1 (aref name 0)))
3544 (substring name 2)
3545 name))
3547 (defun tramp-handle-expand-file-name (name &optional dir)
3548 "Like `expand-file-name' for tramp files.
3554 (unless (file-name-absolute-p name)
3555 (setq name (concat (file-name-as-directory dir) name)))
3556 ;; If NAME is not a tramp file, run the real handler
3557 (if (not (tramp-tramp-file-p name))
3558 (tramp-run-real-handler 'expand-file-name
3559 (list name nil))
3561 (with-parsed-tramp-file-name name nil
3562 (unless (file-name-absolute-p localname)
3567 ;; supposed to find such a shell on the remote host. Please
3573 ;; expanded to the local user home directory but to the
3575 ;; the default user name for tilde expansion is not
3577 ;; use a user name from the config file.
3596 ;; expands to "/". Remove this.
3599 ;; No tilde characters in file name, do normal
3600 ;; expand-file-name (this does "/./" and "/../"). We bind
3602 ;; otherwise use backslash. `default-directory' is bound to
3607 (tramp-make-tramp-file-name
3611 (tramp-run-real-handler 'expand-file-name
3614 ;; old version follows. it uses ".." to cross file handler
3617 ;; ;; the case, then we return a local name instead of a remote name.
3619 ;; (expand-file-name (substring localname 3))
3620 ;; ;; No tilde characters in file name, do normal
3621 ;; ;; expand-file-name (this does "/./" and "/../"). We bind
3625 ;; (tramp-make-tramp-file-name
3628 ;; (tramp-run-real-handler 'expand-file-name
3638 "Whether to display output buffer of `shell-command'.
3639 This is necessary for handling DISPLAY of `process-file'.")
3646 ;; for `find-grep-dired' and `find-name-dired' in Emacs 22.
3647 (if (tramp-tramp-file-p default-directory)
3648 (with-parsed-tramp-file-name default-directory nil
3670 tramp-async-proc (start-process (buffer-name output-buffer)
3676 nil 'file-error
3690 ;; Hand-over output to asynchronous process.
3712 ;; changes its contents before insertion due to calling
3713 ;; `expand-file' and alike.
3761 (defun tramp-handle-process-file (program &optional infile buffer display &rest args)
3762 "Like `process-file' for Tramp files."
3763 (when infile (error "Implementation does not handle input from file"))
3774 (defsubst tramp-make-temp-file (filename)
3776 (funcall (if (fboundp 'make-temp-file) 'make-temp-file 'make-temp-name)
3777 (expand-file-name tramp-temp-name-prefix
3778 (tramp-temporary-file-directory)))
3779 (file-name-extension filename t)))
3781 (defun tramp-handle-file-local-copy (filename)
3782 "Like `file-local-copy' for tramp files."
3783 (with-parsed-tramp-file-name filename nil
3785 ;; We used to bind the following as late as possible.
3796 (unless (file-exists-p filename)
3797 (error "Cannot make local copy of non-existing file `%s'"
3799 (setq tmpfil (tramp-make-temp-file filename))
3802 ;; `copy-file' handles out-of-band methods
3803 (copy-file filename tmpfil t t))
3806 ;; Use inline encoding for file transfer.
3811 (tramp-message 5 "Encoding remote file %s..." filename)
3815 nil 'file-error
3816 "Encoding remote file failed, see buffer `%s' for details"
3822 (tramp-message 5 "Decoding remote file %s..." filename)
3824 ;; Here is where loc-enc and loc-dec used to be let-bound.
3837 6 "Decoding remote file %s with function %s..."
3841 ;; says that we need to strip tramp_exit_status
3842 ;; line from the output here. Go to point-max,
3851 (let ((tmpfil2 (tramp-make-temp-file filename)))
3854 6 "Decoding remote file %s with command %s..."
3858 (delete-file tmpfil2)))
3861 5 "Decoding remote file %s...done" filename)
3863 (set-file-modes tmpfil (file-modes filename))))
3868 (defun tramp-handle-file-remote-p (filename)
3869 "Like `file-remote-p' for tramp files."
3870 (when (tramp-tramp-file-p filename)
3871 (with-parsed-tramp-file-name filename nil
3872 (make-tramp-file-name
3879 (defun tramp-handle-insert-file-contents
3881 "Like `insert-file-contents' for tramp files."
3883 (setq filename (expand-file-name filename))
3884 (with-parsed-tramp-file-name filename nil
3885 (if (not (file-exists-p filename))
3888 (setq buffer-file-name filename)
3889 (set-visited-file-modtime)
3891 (signal 'file-error
3893 (list (expand-file-name filename) 0))
3894 ;; `insert-file-contents-literally' takes care to avoid calling
3895 ;; jka-compr. By let-binding inhibit-file-name-operation, we
3896 ;; propagate that care to the file-local-copy operation.
3898 (let ((inhibit-file-name-operation
3899 (when (eq inhibit-file-name-operation
3900 'insert-file-contents)
3901 'file-local-copy)))
3902 (file-local-copy filename)))
3905 (setq buffer-file-name filename)
3906 (set-visited-file-modtime)
3910 9 "Inserting local temp file `%s'..." local-copy)
3911 (setq result (insert-file-contents local-copy nil beg end replace))
3917 9 "Inserting local temp file `%s'...done" local-copy)
3918 (delete-file local-copy)
3921 (list (expand-file-name filename)
3925 (defun tramp-handle-find-backup-file-name (filename)
3926 "Like `find-backup-file-name' for tramp files."
3927 (with-parsed-tramp-file-name filename nil
3939 (file-name-absolute-p (cdr x))
3940 (not (tramp-file-name-p (cdr x))))
3941 (tramp-make-tramp-file-name
3957 (file-name-absolute-p (car (cdr x)))
3958 (not (tramp-file-name-p (car (cdr x)))))
3959 (tramp-make-tramp-file-name
3966 (tramp-run-real-handler 'find-backup-file-name (list filename)))))
3968 (defun tramp-handle-make-auto-save-file-name ()
3969 "Like `make-auto-save-file-name' for tramp files.
3970 Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3972 ;; File name must be unique. This is ensured with Emacs 22 (see
3973 ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for
3975 (when (boundp 'auto-save-file-name-transforms)
3978 (when (and (string-match (car x) buffer-file-name)
3981 (or tramp-auto-save-directory temporary-file-directory))))
3982 (symbol-value 'auto-save-file-name-transforms)))
3985 (unless (file-exists-p tramp-auto-save-directory)
3987 ;; jka-compr doesn't like auto-saving, so by appending "~" to the
3988 ;; file name we make sure that jka-compr isn't used for the
3989 ;; auto-save file.
3990 (let ((buffer-file-name
3992 (expand-file-name
4000 (buffer-file-name))
4002 (buffer-file-name))))
4003 ;; Run plain `make-auto-save-file-name'. There might be an advice when
4004 ;; it is not a magic file name operation (since Emacs 22).
4006 (if (not (ad-is-active 'make-auto-save-file-name))
4008 'make-auto-save-file-name nil)
4010 (ad-deactivate 'make-auto-save-file-name)
4013 'make-auto-save-file-name nil)
4014 (ad-activate 'make-auto-save-file-name))))))
4022 (error "Cannot append to file using tramp (`%s')" filename))
4023 (setq filename (expand-file-name filename))
4024 ;; Following part commented out because we don't know what to do about
4025 ;; file locking, and it does not appear to be a problem to ignore it.
4028 ;; (setq lockname (expand-file-name lockname)))
4035 confirm (file-exists-p filename))
4039 (with-parsed-tramp-file-name filename nil
4046 (modes (file-modes filename))
4047 ;; We use this to save the value of `last-coding-system-used'
4048 ;; after writing the tmp file. At the end of the function,
4049 ;; we set `last-coding-system-used' to this saved value.
4051 ;; talking to the remote shell or suchlike won't hose this
4055 ;; Write region into a tmp file. This isn't really needed if we
4058 (setq tmpfil (tramp-make-temp-file filename))
4059 ;; Set current buffer. If connection wasn't open, `file-modes' has
4062 ;; We say `no-message' here because we don't want the visited file
4063 ;; modtime data to be clobbered from the temp file. We call
4064 ;; `set-visited-file-modtime' ourselves later on.
4073 ;; The permissions of the temporary file should be set. If
4074 ;; filename does not exist (eq modes nil) it has been renamed to
4075 ;; the backup file. This case `save-buffer' handles
4077 (when modes (set-file-modes tmpfil modes))
4078 ;; This is a bit lengthy due to the different methods possible for
4079 ;; file transfer. First, we check whether the method uses an rcp
4083 ;; encoding the contents of the tmp file.
4085 ;; `copy-file' handles out-of-band methods
4086 (copy-file tmpfil filename t t))
4089 ;; Use inline file transfer
4090 (let ((tmpbuf (get-buffer-create " *tramp file transfer*")))
4103 (symbol-name loc-enc))
4104 (insert-file-contents-literally tmpfil)
4108 ;; satisfied, it tries to write to a local file
4111 ;; (CALL-PROCESS-REGION can't write to remote
4112 ;; files, it seems.) The file in question is a
4113 ;; tmp file anyway.
4115 (tramp-temporary-file-directory)))
4125 (pop-to-buffer trampbuf)
4126 (error (concat "Cannot write to `%s', local encoding"
4130 ;; writes to remote file. Because this happens on the
4134 5 "Decoding region into remote file %s..." filename)
4143 6 "Sending data to remote host...")
4146 ;; wait for remote decoding to complete
4154 "Waiting for remote host to process data...")
4158 multi-method method user host nil nil 'file-error
4159 (concat "Couldn't write region to `%s',"
4162 (tramp-message 5 "Decoding region into remote file %s...done"
4170 (delete-file tmpfil)
4172 (error "Buffer has changed from `%s' to `%s'"
4175 (set-visited-file-modtime
4177 ;; from (buffer-file-name), f.e. if `file-precious-flag' is set.
4178 (nth 5 (file-attributes filename))))
4187 ;; Call down to the real handler.
4189 ;; TRAMP file name) it is needed to disable efs as well as tramp for the
4192 ;; Other than that, this is the canon file-handler code that the doco
4196 ;; efs-sifn-handler-function to handle any filename with environment
4199 ;; 2) That TRAMP might want to do the same thing.
4205 ;; "Invoke normal file name handler for OPERATION.
4207 ;; First arg specifies the OPERATION, remaining ARGS are passed to the
4209 ;; (let ((inhibit-file-name-handlers
4210 ;; (list 'tramp-file-name-handler
4211 ;; 'efs-file-handler-function
4213 ;; (and (eq inhibit-file-name-operation operation)
4214 ;; inhibit-file-name-handlers)))
4215 ;; (inhibit-file-name-operation operation))
4220 "Invoke normal file name handler for OPERATION.
4221 First arg specifies the OPERATION, second arg is a list of arguments to
4222 pass to the OPERATION."
4223 (let* ((inhibit-file-name-handlers
4224 `(tramp-file-name-handler
4225 tramp-completion-file-name-handler
4226 cygwin-mount-name-hook-function
4229 ,(and (eq inhibit-file-name-operation operation)
4230 inhibit-file-name-handlers)))
4231 (inhibit-file-name-operation operation))
4234 ;; This function is used from `tramp-completion-file-name-handler' functions
4240 "Invoke `tramp-file-name-handler' for OPERATION.
4241 First arg specifies the OPERATION, second arg is a list of arguments to
4242 pass to the OPERATION."
4243 (let* ((inhibit-file-name-handlers
4244 `(tramp-completion-file-name-handler
4245 cygwin-mount-name-hook-function
4248 ,(and (eq inhibit-file-name-operation operation)
4249 inhibit-file-name-handlers)))
4250 (inhibit-file-name-operation operation))
4253 ;; We handle here all file primitives. Most of them have the file
4254 ;; name as first parameter; nevertheless we check for them explicitly
4255 ;; in order to be signalled if a new primitive appears. This
4256 ;; scenario is needed because there isn't a way to decide by
4258 ;; ease the life if `file-name-handler-alist' would support a decision
4260 (defun tramp-file-name-for-operation (operation &rest args)
4261 "Return file name related to OPERATION file primitive.
4266 (list 'access-file 'byte-compiler-base-file-name 'delete-directory
4267 'delete-file 'diff-latest-backup-file 'directory-file-name
4269 'dired-compress-file 'dired-uncache
4270 'file-accessible-directory-p 'file-attributes
4271 'file-directory-p 'file-executable-p 'file-exists-p
4272 'file-local-copy 'file-remote-p 'file-modes
4273 'file-name-as-directory 'file-name-directory
4274 'file-name-nondirectory 'file-name-sans-versions
4275 'file-ownership-preserved-p 'file-readable-p
4276 'file-regular-p 'file-symlink-p 'file-truename
4277 'file-writable-p 'find-backup-file-name 'find-file-noselect
4278 'get-file-buffer 'insert-directory 'insert-file-contents
4280 'set-file-modes 'substitute-in-file-name
4281 'unhandled-file-name-directory 'vc-registered
4283 'abbreviate-file-name 'create-file-buffer
4284 'dired-file-modtime 'dired-make-compressed-filename
4285 'dired-recursive-delete-directory 'dired-set-file-modtime
4286 'dired-shell-unhandle-file-name 'dired-uucode-file
4287 'insert-file-contents-literally 'recover-file
4289 (if (file-name-absolute-p (nth 0 args))
4291 (expand-file-name (nth 0 args))))
4294 (list 'add-name-to-file 'copy-file 'expand-file-name
4295 'file-name-all-completions 'file-name-completion
4296 'file-newer-than-file-p 'make-symbolic-link 'rename-file
4302 ((string-match tramp-file-name-regexp (nth 0 args)) (nth 0 args))
4303 ((string-match tramp-file-name-regexp (nth 1 args)) (nth 1 args))
4304 (t (buffer-file-name (current-buffer))))))
4310 (list 'make-auto-save-file-name
4311 'set-visited-file-modtime 'verify-visited-file-modtime
4314 (buffer-file-name
4322 'process-file
4324 'dired-print-file 'dired-shell-call-process))
4326 ; unknown file primitive
4327 (t (error "unknown file I/O primitive: %s" operation))))
4329 (defun tramp-find-foreign-file-name-handler (filename)
4330 "Return foreign file name handler if exists."
4331 (when (tramp-tramp-file-p filename)
4334 (handler-alist tramp-foreign-file-name-handler-alist))
4345 (defun tramp-file-name-handler (operation &rest args)
4346 "Invoke Tramp file name handler.
4347 Falls back to normal file name handler if no tramp file name handler exists."
4349 ;; (edebug-trace "%s" (with-output-to-string (backtrace)))
4351 (let* ((filename (apply 'tramp-file-name-for-operation operation args))
4353 (foreign (tramp-find-foreign-file-name-handler filename)))
4354 (with-parsed-tramp-file-name filename nil
4358 ((and completion (memq operation '(expand-file-name)))
4361 (memq operation '(file-exists-p file-directory-p)))
4365 ;; Nothing to do for us.
4369 ;; In Emacs, there is some concurrency due to timers. If a timer
4370 ;; interrupts Tramp and wishes to use the same connection buffer as
4372 ;; buffer. Therefore, we need to make sure that a timer does not use
4376 ;; `tramp-locked' and `tramp-locker'. `tramp-locked' is set to true
4377 ;; (with setq) to indicate a lock. But Tramp also calls itself during
4378 ;; processing of a single file operation, so we need to allow
4380 ;; -- it is let-bound to t during the execution of the current
4396 (defun tramp-sh-file-name-handler (operation &rest args)
4397 "Invoke remote-shell Tramp file name handler.
4398 Fall back to normal file name handler if no Tramp handler exists."
4400 (signal 'file-error "Forbidden reentrant call of Tramp"))
4407 (let ((fn (assoc operation tramp-file-name-handler-alist)))
4414 (progn (defun tramp-completion-file-name-handler (operation &rest args)
4415 "Invoke tramp file name completion handler.
4416 Falls back to normal file name handler if no tramp file name handler exists."
4418 ;; (edebug-trace "%s" (with-output-to-string (backtrace)))
4419 (let ((fn (assoc operation tramp-completion-file-name-handler-alist)))
4425 (defsubst tramp-register-file-name-handler ()
4426 "Add tramp file name handler to `file-name-handler-alist'."
4427 (add-to-list 'file-name-handler-alist
4428 (cons tramp-file-name-regexp 'tramp-file-name-handler))
4429 ;; If jka-compr is already loaded, move it to the front of
4430 ;; `file-name-handler-alist'.
4431 (let ((jka (rassoc 'jka-compr-handler file-name-handler-alist)))
4433 (setq file-name-handler-alist
4434 (cons jka (delete jka file-name-handler-alist))))))
4437 (defsubst tramp-register-completion-file-name-handler ()
4438 "Add tramp completion file name handler to `file-name-handler-alist'."
4441 ;; user/host name completion shall be bound to `partial-completion-mode'.
4445 (add-to-list 'file-name-handler-alist
4446 (cons tramp-completion-file-name-regexp
4447 'tramp-completion-file-name-handler))
4448 (put 'tramp-completion-file-name-handler 'safe-magic t))
4449 ;; If jka-compr is already loaded, move it to the front of
4450 ;; `file-name-handler-alist'.
4451 (let ((jka (rassoc 'jka-compr-handler file-name-handler-alist)))
4453 (setq file-name-handler-alist
4454 (cons jka (delete jka file-name-handler-alist))))))
4456 ;; `tramp-file-name-handler' must be registered before evaluation of
4459 ;;;###autoload(tramp-register-file-name-handler)
4462 ;; `tramp-completion-file-name-handler' will be delayed.
4463 ;;;###autoload(add-hook
4465 ;;;###autoload '(lambda () (tramp-register-completion-file-name-handler)))
4466 (tramp-register-file-name-handler)
4467 (tramp-register-completion-file-name-handler)
4470 (defun tramp-unload-file-name-handlers ()
4471 (setq file-name-handler-alist
4472 (delete (rassoc 'tramp-file-name-handler
4473 file-name-handler-alist)
4474 (delete (rassoc 'tramp-completion-file-name-handler
4475 file-name-handler-alist)
4476 file-name-handler-alist))))
4478 (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers)
4486 (defun tramp-handle-expand-many-files (name)
4488 (with-parsed-tramp-file-name name nil
4490 (if (or (string-match "\\*" name)
4491 (string-match "\\?" name)
4492 (string-match "\\[.*\\]" name))
4496 ;; in the file name, but since the echo command is going to
4497 ;; break anyway when there are spaces in the file names, we
4499 ;;-(let ((comint-file-name-quote-list
4500 ;;- (set-difference tramp-file-name-quote-list
4524 (tramp-make-tramp-file-name multi-method method
4527 (list (expand-file-name name))))))
4532 (around tramp-advice-PC-expand-many-files (name) activate)
4534 (if (tramp-tramp-file-p name)
4535 (setq ad-return-value (tramp-handle-expand-many-files name))
4537 (add-hook 'tramp-unload-hook
4540 ;;; File name handler functions for completion mode
4543 "If non-nil, we are in file name completion mode.")
4545 ;; Necessary because `tramp-file-name-regexp-unified' and
4546 ;; `tramp-completion-file-name-regexp-unified' aren't different.
4547 ;; If nil, `tramp-completion-run-real-handler' is called (i.e. forwarding to
4548 ;; `tramp-file-name-handler'). Otherwise, it takes `tramp-run-real-handler'.
4549 ;; Using `last-input-event' is a little bit risky, because completing a file
4552 ;; shouldn't have partial tramp file name syntax. Maybe another variable should
4554 ;; file name syntax in order to avoid ambiguities, like in XEmacs ...
4555 ;; In case of non unified file names it can be always true (and wouldn't be
4557 (defun tramp-completion-mode (file)
4558 "Checks whether method / user name / host name completion is active."
4561 ((string-match "^/.*:.*:$" file) nil)
4565 file)
4566 (member (match-string 1 file) (mapcar 'car tramp-methods)))
4581 (funcall (symbol-function 'event-to-character)
4585 (funcall (symbol-function 'event-to-character)
4588 (funcall (symbol-function 'event-to-character)
4592 ;; Method, host name and user name completion.
4593 ;; `tramp-completion-dissect-file-name' returns a list of
4594 ;; tramp-file-name structures. For all of them we return possible completions.
4596 (defun tramp-completion-handle-file-name-all-completions (filename directory)
4597 "Like `file-name-all-completions' for partial tramp files."
4600 ;; We need to reset `tramp-completion-mode'.
4606 (v (tramp-completion-dissect-file-name fullname))
4611 (multi-method (tramp-file-name-multi-method car))
4612 (method (tramp-file-name-method car))
4613 (user (tramp-file-name-user car))
4614 (host (tramp-file-name-host car))
4615 (localname (tramp-file-name-localname car))
4621 localname) ;; Nothing to complete
4650 (when car (add-to-list
4659 ;; "/ssh:" does not need to be expanded as hostname.
4661 'file-name-all-completions (list filename directory))
4662 ;; No method/user/host found to be expanded.
4664 'file-name-all-completions (list filename directory)))
4669 ;; Method, host name and user name completion for a file.
4671 (defun tramp-completion-handle-file-name-completion
4673 "Like `file-name-completion' for tramp files."
4676 (mapcar 'list (file-name-all-completions filename directory))
4678 (lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
4680 ;; I misuse a little bit the tramp-file-name structure in order to handle
4682 ;; Return value is a list of tramp-file-name structures according to possible
4703 (defun tramp-completion-dissect-file-name (name)
4704 "Returns a list of `tramp-file-name' structures.
4705 They are collected by `tramp-completion-dissect-file-name1'."
4710 (tramp-completion-file-name-structure1
4714 (tramp-completion-file-name-structure2
4718 (tramp-completion-file-name-structure3
4722 (tramp-completion-file-name-structure4
4728 (tramp-completion-file-name-structure5
4734 (tramp-completion-file-name-structure6
4740 (tramp-completion-file-name-structure7
4748 (add-to-list 'result
4749 (tramp-completion-dissect-file-name1 regexp name)))
4751 tramp-completion-file-name-structure1
4752 tramp-completion-file-name-structure2
4753 tramp-completion-file-name-structure3
4754 tramp-completion-file-name-structure4
4755 tramp-completion-file-name-structure5
4756 tramp-completion-file-name-structure6
4757 tramp-completion-file-name-structure7
4758 tramp-file-name-structure))
4762 (defun tramp-completion-dissect-file-name1 (structure name)
4763 "Returns a `tramp-file-name' structure matching STRUCTURE.
4769 (when (string-match (nth 0 structure) name)
4771 (match-string (nth 1 structure) name)))
4774 (make-tramp-file-name
4781 (match-string (nth 2 structure) name)))
4783 (match-string (nth 3 structure) name)))
4785 (match-string (nth 4 structure) name))))
4786 (make-tramp-file-name
4801 (tramp-make-tramp-file-name nil method nil nil nil)))
4806 "Returns the most expanded string for user and host name completion.
4834 (tramp-make-tramp-file-name nil method user host nil)))
4837 "Return a list of (user host) tuples allowed to access.
4841 (when (file-readable-p filename)
4843 (insert-file-contents filename)
4857 "Return a (user host) tuple allowed to access.
4866 (narrow-to-region (point) (tramp-point-at-eol))
4874 "Return a list of (user host) tuples allowed to access.
4878 (when (file-readable-p filename)
4880 (insert-file-contents filename)
4887 "Return a (user host) tuple allowed to access.
4893 (narrow-to-region (point) (tramp-point-at-eol))
4903 "Return a list of (user host) tuples allowed to access.
4907 (when (file-readable-p filename)
4909 (insert-file-contents filename)
4916 "Return a (user host) tuple allowed to access.
4922 (narrow-to-region (point) (tramp-point-at-eol))
4932 "Return a list of (user host) tuples allowed to access.
4936 (files (when (file-directory-p dirname) (directory-files dirname)))
4946 "Return a list of (user host) tuples allowed to access.
4951 (files (when (file-directory-p dirname) (directory-files dirname)))
4961 "Return a list of (user host) tuples allowed to access.
4965 (when (file-readable-p filename)
4967 (insert-file-contents filename)
4974 "Return a (user host) tuple allowed to access.
4980 (narrow-to-region (point) (tramp-point-at-eol))
4990 ;; For su-alike methods it would be desirable to return "root@localhost"
4991 ;; as default. Unfortunately, we have no information whether any user name
4993 ;; assuming it is set in `tramp-completion-handle-file-name-all-completions'.
4995 "Return a list of (user host) tuples allowed to access.
5001 (when (file-readable-p filename)
5003 (insert-file-contents filename)
5010 "Return a (user host) tuple allowed to access.
5016 (narrow-to-region (point) (tramp-point-at-eol))
5024 "Return a list of (user host) tuples allowed to access.
5028 (when (file-readable-p filename)
5030 (insert-file-contents filename)
5037 "Return a (user host) tuple allowed to access.
5046 (narrow-to-region (point) (tramp-point-at-eol))
5055 (defun tramp-maybe-send-perl-script (multi-method method user host script name)
5063 (unless (memq name perl-scripts)
5065 (tramp-message 5 (concat "Sending the Perl script `" name "'..."))
5067 (concat name
5074 (tramp-set-connection-property "perl-scripts" (cons name perl-scripts)
5076 (tramp-message 5 (concat "Sending the Perl script `" name "'...done.")))))))
5079 (when (and (buffer-file-name)
5080 (tramp-tramp-file-p (buffer-file-name))
5082 (eq (tramp-find-foreign-file-name-handler (buffer-file-name))
5083 'tramp-sh-file-name-handler)
5086 (add-hook 'find-file-hooks 'tramp-set-auto-save t)
5087 (add-hook 'tramp-unload-hook
5089 (remove-hook 'find-file-hooks 'tramp-set-auto-save)))
5094 (let ((v (tramp-dissect-file-name filename)))
5097 (tramp-file-name-multi-method v) (tramp-file-name-method v)
5098 (tramp-file-name-user v) (tramp-file-name-host v)
5100 (tramp-shell-quote-argument (tramp-file-name-localname v)))))))
5107 (let* ((v1 (tramp-dissect-file-name file1))
5108 (v2 (tramp-dissect-file-name file2))
5109 (mmethod1 (tramp-file-name-multi-method v1))
5110 (mmethod2 (tramp-file-name-multi-method v2))
5111 (method1 (tramp-file-name-method v1))
5112 (method2 (tramp-file-name-method v2))
5113 (user1 (tramp-file-name-user v1))
5114 (user2 (tramp-file-name-user v2))
5115 (host1 (tramp-file-name-host v1))
5116 (host2 (tramp-file-name-host v2))
5117 (localname1 (tramp-file-name-localname v1))
5118 (localname2 (tramp-file-name-localname v2)))
5135 (defun tramp-touch (file time)
5136 "Set the last-modified timestamp of the given file.
5148 (if (tramp-tramp-file-p file)
5149 (with-parsed-tramp-file-name file nil
5158 (pop-to-buffer buf)
5161 ;; It's a local file
5164 "touch" nil (current-buffer) nil "-t" touch-time file))
5165 (pop-to-buffer (current-buffer))
5168 (defun tramp-buffer-name (multi-method method user host)
5169 "A name for the connection buffer for USER at HOST using METHOD."
5171 (tramp-buffer-name-multi-method "tramp" multi-method method user host)
5177 (defun tramp-buffer-name-multi-method (prefix multi-method method user host)
5178 "A name for the multi method connection buffer.
5200 "Get the connection buffer to be used for USER at HOST using METHOD."
5202 (get-buffer-create (tramp-buffer-name multi-method method user host))
5206 (defun tramp-debug-buffer-name (multi-method method user host)
5207 "A name for the debug buffer for USER at HOST using METHOD."
5209 (tramp-buffer-name-multi-method "debug tramp"
5220 (tramp-debug-buffer-name multi-method method user host))
5228 is the program to search for, and DIRLIST gives the list of directories
5229 to search. If IGNORE-TILDE is non-nil, directory names starting
5232 Returns the absolute file name of PROGNAME, if found, and nil otherwise.
5234 This function expects to be in the right *tramp* buffer."
5238 ;; `remove' is in CL, and we want to avoid CL dependencies.
5265 "Sets the remote environment VAR to existing directories from DIRLIST.
5267 so, it is added to the environment variable VAR."
5272 (file-exists-p
5273 (tramp-make-tramp-file-name multi-method method user host x))
5274 (file-directory-p
5275 (tramp-make-tramp-file-name multi-method method user host x)))
5287 (defun tramp-find-file-exists-command (multi-method method user host)
5288 "Find a command on the remote host for checking if a file exists.
5290 file exists and nonzero exit status otherwise."
5291 (make-local-variable 'tramp-file-exists-command)
5292 (tramp-message 9 "Finding command to check if file exists")
5294 (tramp-make-tramp-file-name
5296 "/")) ;assume this file always exists
5298 (tramp-make-tramp-file-name
5300 "/ this file does not exist "))) ;assume this never exists
5304 ;; `$cmd /this\ file\ does\ not\ exist', hoping that the file indeed
5306 ;; command we find that seems to work.
5307 ;; The list of commands to try is as follows:
5319 (and (setq tramp-file-exists-command "test -e %s")
5320 (file-exists-p existing)
5321 (not (file-exists-p nonexisting)))
5322 (and (setq tramp-file-exists-command "/bin/test -e %s")
5323 (file-exists-p existing)
5324 (not (file-exists-p nonexisting)))
5325 (and (setq tramp-file-exists-command "/usr/bin/test -e %s")
5326 (file-exists-p existing)
5327 (not (file-exists-p nonexisting)))
5328 (and (setq tramp-file-exists-command "ls -d %s")
5329 (file-exists-p existing)
5330 (not (file-exists-p nonexisting))))
5331 (error "Couldn't find command to check if file exists"))))
5369 ;; last tramp-rsh-end-of-line, Douglas wanted to replace that,
5386 METHOD, USER and HOST specify the connection, CMD (the absolute file name of)
5390 (when (file-executable-p
5391 (tramp-make-tramp-file-name multi-method method user host cmd))
5410 ;; It would be better to use the CL function `find', but
5413 (let ((x (concat (file-name-as-directory (car dl)) cmd)))
5432 ;; The following functions are actions to be taken when seeing certain
5437 "Send the login name."
5438 (tramp-message 9 "Sending login name `%s'"
5439 (or user (user-login-name)))
5441 (process-send-string nil (concat (or user (user-login-name))
5448 (tramp-make-tramp-file-name
5461 (pop-to-buffer (tramp-get-buffer multi-method method user host))
5473 Send \"yes\" to remote process on confirmation, abort otherwise.
5476 (pop-to-buffer (tramp-get-buffer multi-method method user host))
5486 Send \"y\" to remote process on confirmation, abort otherwise.
5489 (pop-to-buffer (tramp-get-buffer multi-method method user host))
5497 "Tell the remote host which terminal type to use.
5534 "Send the login name."
5535 (tramp-message 9 "Sending login name `%s'" user)
5543 (tramp-make-tramp-file-name
5644 ;; Functions to execute when we have seen the remote shell prompt but
5646 ;; might be sent to any shell, not just a Bourne-ish shell. This
5647 ;; means that the commands need to work in all shells. (It is also
5648 ;; okay for some commands to just fail with an error message, but
5654 "Send list of commands to remote host, in order."
5659 (tramp-message 10 "Sending command to remote shell: %s"
5671 login prompt, then sends the user name USER, then waits for a remote
5673 password to the remote host.
5675 If USER is nil, uses value returned by `(user-login-name)' instead.
5681 Please note that it is NOT possible to use this connection method
5685 Maybe the different regular expressions need to be tuned.
5687 * Actually, the telnet program as well as the args to be used can be
5697 (or user (user-login-name)) host method)
5701 (let* ((default-directory (tramp-temporary-file-directory))
5709 (tramp-buffer-name multi-method method user host)
5736 queried for a password, this function sends the password to the remote
5745 Kludgy feature: if HOST has the form \"xx#yy\", then yy is assumed to
5746 be a port number for ssh, and \"-p yy\" will be added to the list of
5747 arguments, and xx will be used as the host name to connect to.
5749 * Actually, the rsh program to be used can be specified in the
5760 (bufnam (tramp-buffer-name multi-method method user host))
5769 x `((?t . ,(format "/tmp/%s" tramp-temp-name-prefix)))))
5776 ;; mechanism to parse extra host args.
5782 (let* ((default-directory (tramp-temporary-file-directory))
5808 name must be equal to the local host name or to `localhost'.
5810 If USER is nil, uses value returned by user-login-name instead.
5822 (system-name))
5826 "Cannot connect to different host `%s' with `su' connection method"
5834 (let* ((default-directory (tramp-temporary-file-directory))
5842 (tramp-buffer-name multi-method method user host)
5866 ;; HHH: Not Changed. Multi method. It is not clear to me how this can
5867 ;; handle not giving a user name in the "file name".
5872 ;; name is different than the "original" name (or different from
5876 This uses a slightly changed file name syntax. The idea is to say
5877 [multi/telnet:u1@h1/rsh:u2@h2]/path/to/file
5878 This will use telnet to log in as u1 to h1, then use rsh from there to
5879 log in as u2 to h2."
5899 (let* ((default-directory (tramp-temporary-file-directory))
5906 (p (start-process (tramp-buffer-name multi-method method user host)
5912 (tramp-message 9 "Waiting 60s for local shell to come up...")
5916 (pop-to-buffer (buffer-name))
5927 ;; The multi-funcs don't need to do save-match-data, as that
5936 ;; HHH: Changed. Multi method. Don't know how to handle this in the case
5937 ;; of no user name provided. Hack to make it work as it did before:
5938 ;; changed `user' to `(or user (user-login-name))' in the places where
5942 Uses shell COMMAND to issue a `telnet' command to log in as USER to
5944 the host name, and `%n' is replaced with an end of line character, as
5948 If USER is nil, uses the return value of (user-login-name) instead."
5959 ;; HHH: Changed. Multi method. Don't know how to handle this in the case
5960 ;; of no user name provided. Hack to make it work as it did before:
5961 ;; changed `user' to `(or user (user-login-name))' in the places where
5965 Uses shell COMMAND to issue an `rlogin' command to log in as USER to
5967 with the user name, `%h' will be replaced with the host name, and `%n'
5969 `%%' if you want to use a literal percent character.
5971 If USER is nil, uses the return value of (user-login-name) instead."
5973 (?u . ,(or user (user-login-name)))
5976 (?u . ,(or user (user-login-name)))
5985 ;; HHH: Changed. Multi method. Don't know how to handle this in the case
5986 ;; of no user name provided. Hack to make it work as it did before:
5987 ;; changed `user' to `(or user (user-login-name))' in the places where
5991 Uses shell COMMAND to issue a `su' command to log in as USER on
5992 HOST. The HOST name is ignored, this just changes the user id on the
5993 host currently logged in to.
5995 If USER is nil, uses the return value of (user-login-name) instead.
5998 user name, and `%n' is replaced with the value of
6001 (let ((cmd (format-spec command `((?u . ,(or user (user-login-name)))
6003 (cmd1 (format-spec command `((?u . ,(or user (user-login-name)))
6017 This is needed in order to hide `last-coding-system-used', which is set
6023 "Wait for a REGEXP to appear from process PROC within TIMEOUT seconds.
6024 Expects the output of PROC to be sent to the current buffer. Returns
6032 ;; to polling for buggy XEmacsen, but oh, well.
6051 (append-to-buffer
6067 "Wait for the shell prompt to appear from process PROC within TIMEOUT seconds.
6078 Looks at process PROC to see if a shell prompt appears in TIMEOUT
6081 (pop-to-buffer (buffer-name))
6085 "Prompt for a password and send it to the remote end.
6086 Uses PROMPT as a prompt and sends the password to process P."
6100 ;; given in the "File name" very poorly. Then, the local
6101 ;; variable tramp-current-user will be set to nil.
6118 to set up. METHOD, USER and HOST specify the connection."
6126 ;; It is useful to set the prompt in the following command because
6131 ;; sign. The following command line sets $PS1 to a sane value, and
6136 ;; called as sh) on startup; this way, we avoid the startup file
6143 (format "remote `%s' to come up"
6150 (buffer-name))
6164 ;; This is known for FreeBSD (see comment in `send_process', file process.c).
6176 ;; Try to set up the coding system correctly.
6177 ;; CCC this can't be the right way to do it. Hm.
6185 ;; Use MULE to select the right EOL convention for communicating
6232 ;; the last time we sent a command, to avoid tramp-send-command to send
6244 "Prepare a remote shell before being able to work on it.
6247 tries to find an `ls' command which groks the `-n' option, sets the
6248 locale to C and sets up the remote shell search path."
6250 ;; checks if a file exists. This is done because Tramp wants to use
6251 ;; "test foo; echo $?" to check if various conditions hold, and
6260 ;; output of (tramp-find-shell) to show up along with the output of
6272 (tramp-find-file-exists-command multi-method method user host)
6293 ;; Tell remote shell to use standard time format, needed for
6304 ;; Unalias ls(1) to work around issues with those silly people who make it
6388 ;; Find the right encoding/decoding commands to use.
6392 ;; If encoding/decoding command are given, test to see if they work.
6393 ;; CCC: Maybe it would be useful to run the encoder both locally and
6394 ;; remotely to see if they produce the same result.
6406 "Checking to see if encoding/decoding commands work on remote host...")
6415 (buffer-name)))
6418 5 "Checking to see if encoding/decoding commands work on remote host...done"))))
6422 ;; alternative is to use the Perl version of UU encoding. But then
6431 ;; Unices, in particular AIX and Irix. For AIX, you might want to use
6463 plain file on standard input and writing the encoded file to standard
6465 accepting an encoded file on standard input and writing the decoded
6466 file to standard output.
6476 and end of region, and are expected to replace the region contents
6495 ;; found. Note that we do not redirect stdout to /dev/null,
6498 ;; redirecting "mimencode" output to /dev/null, then as root
6520 ;; corresponding command has to work locally.
6559 If CMD contains \"%s\", provide input file INPUT there in command.
6578 "Maybe open a connection to HOST, logging in as USER, using METHOD.
6588 ;; tries to send some data to the remote end. So that's why we
6589 ;; try to send a command from time to time, then look again
6615 "Send the COMMAND to USER at HOST (logged in using METHOD).
6618 If optional seventh arg NEVEROPEN is non-nil, never try to open the
6619 connection. This is meant to be used from
6639 "Send command to remote host and wait for success.
6646 "Couldn't `%s', see buffer `%s'" command (buffer-name)))
6698 ;; Add output to debug buffer if appropriate.
6700 (append-to-buffer
6720 MULTI-METHOD and METHOD specify how to log in (as USER) to the remote HOST.
6742 Similar to `tramp-send-command-and-check' but accepts two more arguments
6743 FMT and ARGS which are passed to `error'."
6746 ;; CCC: really pop-to-buffer? Maybe it's appropriate to be more
6748 (pop-to-buffer (current-buffer))
6752 ;; to it in one go. (This happens when sending the Perl
6753 ;; `file-attributes' implementation, for instance.) Therefore, we
6757 "Send the STRING to USER at HOST using METHOD.
6759 The STRING is expected to use Unix line-endings, but the lines sent to
6765 (error "Can't send string to remote host -- not logged in"))
6787 "Sending chunk from %s to %s"
6796 "Send EOF to the remote end.
6801 (error "Can't send EOF to remote host -- not logged in"))
6825 (defun tramp-mode-string-to-int (mode-string)
6827 (let* ((mode-chars (string-to-vector mode-string))
6840 (?r (tramp-octal-to-decimal "00400")) (?- 0)
6843 (?w (tramp-octal-to-decimal "00200")) (?- 0)
6846 (?x (tramp-octal-to-decimal "00100"))
6847 (?S (tramp-octal-to-decimal "04000"))
6848 (?s (tramp-octal-to-decimal "04100"))
6853 (?r (tramp-octal-to-decimal "00040")) (?- 0)
6856 (?w (tramp-octal-to-decimal "00020")) (?- 0)
6859 (?x (tramp-octal-to-decimal "00010"))
6860 (?S (tramp-octal-to-decimal "02000"))
6861 (?s (tramp-octal-to-decimal "02010"))
6866 (?r (tramp-octal-to-decimal "00004")) (?- 0)
6869 (?w (tramp-octal-to-decimal "00002")) (?- 0)
6872 (?x (tramp-octal-to-decimal "00001"))
6873 (?T (tramp-octal-to-decimal "01000"))
6874 (?t (tramp-octal-to-decimal "01001"))
6879 (defun tramp-convert-file-attributes (multi-method method user host attr)
6880 "Convert file-attributes ATTR generated by perl script or ls.
6881 Convert file mode bits to string and set virtual device number.
6883 ;; Convert file mode bits to string.
6885 (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr))))
6886 ;; Set file's gid change bit. Possible only when id-format is 'integer.
6899 (let ((string (tramp-make-tramp-file-name multi-method method user host "")))
6901 (add-to-list 'tramp-devices
6905 (defun tramp-file-mode-from-int (mode)
6906 "Turn an integer representing a file mode into an ls(1)-like string."
6907 (let ((type (cdr (assoc (logand (lsh mode -12) 15) tramp-file-mode-type-map)))
6914 (setq user (tramp-file-mode-permissions user suid "s"))
6915 (setq group (tramp-file-mode-permissions group sgid "s"))
6916 (setq other (tramp-file-mode-permissions other sticky "t"))
6920 (defun tramp-file-mode-permissions (perm suid suid-text)
6922 This is used internally by `tramp-file-mode-from-int'."
6933 (defun tramp-decimal-to-octal (i)
6936 (cond ((< i 0) (error "Cannot convert negative number to octal"))
6937 ((not (integerp i)) (error "Cannot convert non-integer to octal"))
6939 (t (concat (tramp-decimal-to-octal (/ i 8))
6940 (number-to-string (% i 8))))))
6943 ;;(defun tramp-octal-to-decimal (ostr)
6952 ;; (+ (- last ?0) (* 8 (tramp-octal-to-decimal rest)))))))
6953 ;; Kudos to Gerd Moellmann for this suggestion.
6954 (defun tramp-octal-to-decimal (ostr)
6957 ;; `save-match' is in `tramp-mode-string-to-int' which calls this.
6960 (string-to-number ostr 8)))
6963 "Converts STRING to shell glob pattern which ignores case."
6974 ;; -- TRAMP file names --
6980 (defstruct tramp-file-name multi-method method user host localname)
6982 (defun tramp-tramp-file-p (name)
6983 "Return t iff NAME is a tramp file."
6985 (string-match tramp-file-name-regexp name)))
6987 ;; HHH: Changed. Used to assign the return value of (user-login-name)
6988 ;; to the `user' part of the structure if a user name was not
6990 (defun tramp-dissect-file-name (name)
6991 "Return an `tramp-file-name' structure.
6993 localname (file name on remote host)."
6995 (let* ((match (string-match (nth 0 tramp-file-name-structure) name))
6998 (if match (match-string (nth 1 tramp-file-name-structure) name)
7001 (format (nth 0 tramp-multi-file-name-structure)
7002 (nth 0 tramp-multi-file-name-hop-structure)) name)
7003 (match-string (nth 1 tramp-multi-file-name-structure) name))))
7005 ;; If it's a multi method, the file name structure contains
7007 (tramp-dissect-multi-file-name name)
7009 (unless match (error "Not a tramp file name: %s" name))
7010 (let ((user (match-string (nth 2 tramp-file-name-structure) name))
7011 (host (match-string (nth 3 tramp-file-name-structure) name))
7012 (localname (match-string (nth 4 tramp-file-name-structure) name)))
7013 (make-tramp-file-name
7021 "Look up the right method to use in `tramp-default-method-alist'."
7034 "Return the right method string to use.
7041 ;; a user name is not provided in the "file name" very well.
7042 (defun tramp-dissect-multi-file-name (name)
7044 (let ((regexp (nth 0 tramp-multi-file-name-structure))
7045 (method-index (nth 1 tramp-multi-file-name-structure))
7046 (hops-index (nth 2 tramp-multi-file-name-structure))
7047 (localname-index (nth 3 tramp-multi-file-name-structure))
7048 (hop-regexp (nth 0 tramp-multi-file-name-hop-structure))
7049 (hop-method-index (nth 1 tramp-multi-file-name-hop-structure))
7050 (hop-user-index (nth 2 tramp-multi-file-name-hop-structure))
7051 (hop-host-index (nth 3 tramp-multi-file-name-hop-structure))
7053 (unless (string-match (format regexp hop-regexp) name)
7054 (error "Not a multi tramp file name: %s" name))
7055 (setq method (match-string method-index name))
7056 (setq hops (match-string hops-index name))
7059 (setq localname (match-string localname-index name))
7069 (make-tramp-file-name
7076 (defun tramp-make-tramp-file-name (multi-method method user host localname)
7077 "Constructs a tramp file name from METHOD, USER, HOST and LOCALNAME."
7079 (tramp-make-tramp-multi-file-name multi-method method user host localname)
7090 (defun tramp-make-tramp-multi-file-name (multi-method method user host localname)
7091 "Constructs a tramp file name for a multi-hop method."
7092 (unless tramp-make-multi-tramp-file-format
7093 (error "`tramp-make-multi-tramp-file-format' is nil"))
7094 (let* ((prefix-format (nth 0 tramp-make-multi-tramp-file-format))
7095 (hop-format (nth 1 tramp-make-multi-tramp-file-format))
7096 (localname-format (nth 2 tramp-make-multi-tramp-file-format))
7109 (defun tramp-make-copy-program-file-name (user host localname)
7110 "Create a file name suitable to be passed to `rcp' and workalikes."
7122 ;; Variables local to connection.
7138 (defun tramp-get-file-exists-command (multi-method method user host)
7143 tramp-file-exists-command)
7225 ;; Auto saving to a special directory.
7227 (defun tramp-exists-file-name-handler (operation &rest args)
7228 (let ((buffer-file-name "/")
7229 (fnha file-name-handler-alist)
7230 (check-file-name-operation operation)
7231 (file-name-handler-alist
7235 "Returns OPERATION if it is the one to be checked"
7236 (if (equal check-file-name-operation operation)
7238 (let ((file-name-handler-alist fnha))
7242 (unless (tramp-exists-file-name-handler 'make-auto-save-file-name)
7243 (defadvice make-auto-save-file-name
7244 (around tramp-advice-make-auto-save-file-name () activate)
7245 "Invoke `tramp-handle-make-auto-save-file-name' for tramp files."
7246 (if (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))
7247 (setq ad-return-value (tramp-handle-make-auto-save-file-name))
7249 (add-hook 'tramp-unload-hook
7250 '(lambda () (ad-unadvise 'make-auto-save-file-name))))
7255 (defun tramp-set-auto-save-file-modes ()
7256 "Set permissions of autosaved remote files to the original permissions."
7257 (let ((bfn (buffer-file-name)))
7259 (tramp-tramp-file-p bfn)
7260 (stringp buffer-auto-save-file-name)
7261 (not (equal bfn buffer-auto-save-file-name)))
7262 (unless (file-exists-p buffer-auto-save-file-name)
7263 (write-region "" nil buffer-auto-save-file-name))
7265 ;; auto-saved file belonging to another original file. This could
7267 (set-file-modes buffer-auto-save-file-name
7268 (or (file-modes bfn) (tramp-octal-to-decimal "0600"))))))
7274 (add-hook 'auto-save-hook 'tramp-set-auto-save-file-modes)
7275 (add-hook 'tramp-unload-hook
7277 (remove-hook 'auto-save-hook 'tramp-set-auto-save-file-modes))))
7286 (to (cdr pr)))
7288 (setq string (replace-match to t t string)))
7296 (add-text-properties start (point) (list 'face face))))
7302 (defun tramp-temporary-file-directory ()
7303 "Return name of directory for temporary files (compat function).
7304 For Emacs, this is the variable `temporary-file-directory', for XEmacs
7306 (cond ((boundp 'temporary-file-directory)
7307 (symbol-value 'temporary-file-directory))
7310 ((let ((d (getenv "TEMP"))) (and d (file-directory-p d)))
7311 (file-name-as-directory (getenv "TEMP")))
7312 ((let ((d (getenv "TMP"))) (and d (file-directory-p d)))
7313 (file-name-as-directory (getenv "TMP")))
7314 ((let ((d (getenv "TMPDIR"))) (and d (file-directory-p d)))
7315 (file-name-as-directory (getenv "TMPDIR")))
7316 ((file-exists-p "c:/temp") (file-name-as-directory "c:/temp"))
7317 (t (message (concat "Neither `temporary-file-directory' nor "
7319 (file-name-as-directory "/tmp"))))
7325 (let* ((key (concat (or user (user-login-name)) "@" host))
7327 (apply #'password-cache-add (list key password))
7332 "Clear password cache for connection related to current-buffer."
7334 (let ((filename (or buffer-file-name list-buffers-directory "")))
7336 (or (and user host) (tramp-tramp-file-p filename)))
7337 (let* ((v (when (tramp-tramp-file-p filename)
7338 (tramp-dissect-file-name filename)))
7339 (luser (or user (tramp-file-name-user v) (user-login-name)))
7340 (lhost (or host (tramp-file-name-host v) (system-name)))
7353 (fboundp 'time-to-seconds))
7354 (funcall (symbol-function 'time-to-seconds)
7362 ;; time-to-seconds and subtract-time
7395 Note: this function has been written for `tramp-handle-file-truename'.
7396 If you want to use it for something else, you'll have to check whether
7418 ;; is passed to a shell, the shell will expand this into "ab",
7420 ;; It does not appear to be possible to make the function
7434 ;; Thanks to Mario DeWeerd for the hint that it is sufficient for this
7435 ;; function to work with Bourne-like shells.
7441 "Similar to `shell-quote-argument', but groks newlines.
7455 ;; ;; EFS hooks itself into the file name handling stuff in more places
7456 ;; ;; than just `file-name-handler-alist'. The following tells EFS to stay
7457 ;; ;; away from tramp.el file names.
7461 ;; ;; connection to help it's dired process. Not that I have any real
7462 ;; ;; idea *why* this is helpful to dired.
7469 ;; ;; not to call defadvice unless it's necessary. How do we find out whether
7473 ;; "Cause efs-ftp-path to fail when the path is a TRAMP localname."
7474 ;; (if (tramp-tramp-file-p (ad-get-arg 0))
7479 ;; This means that Emacs wants to expand wildcards if
7480 ;; `find-file-wildcards' is non-nil, and then barfs because no
7482 ;; something really awful: we have `file-expand-wildcards' return the
7488 (defadvice file-expand-wildcards (around tramp-fix activate)
7489 (let ((name (ad-get-arg 0)))
7490 (if (tramp-tramp-file-p name)
7491 ;; If it's a Tramp file, dissect it and look if wildcards
7492 ;; need to be expanded at all.
7493 (let ((v (tramp-dissect-file-name name)))
7494 (if (string-match "[[*?]" (tramp-file-name-localname v))
7496 (setq ad-return-value (or res (list name))))
7497 (setq ad-return-value (list name))))
7498 ;; If it is not a Tramp file, just run the original function.
7500 (setq ad-return-value (or res (list name)))))))
7501 (add-hook 'tramp-unload-hook
7502 '(lambda () (ad-unadvise 'file-expand-wildcards))))
7518 "Submit a bug report to the TRAMP developers."
7524 tramp-bug-report-address ; to-address
7525 (format "tramp (%s)" tramp-version) ; package name and version
7530 tramp-file-exists-command
7537 tramp-auto-save-directory ; vars to dump
7549 tramp-temp-name-prefix
7550 tramp-file-name-structure
7551 tramp-file-name-regexp
7552 tramp-multi-file-name-structure
7553 tramp-multi-file-name-hop-structure
7587 file-name-handler-alist))
7593 possibly can about the problem, what you did to cause it and what the
7596 If you can give a simple set of instructions to make this bug happen
7600 Another useful thing to do is to put (setq tramp-debug-buffer t) in
7601 the ~/.emacs file and to repeat the bug. Then, include the contents
7615 ;; There are characters to be masked.
7636 (insert " ;; variable encoded due to non-printable characters\n"))
7639 ;; Reset VARSYM to old value.
7670 (when (string-match tramp-buf-regexp (buffer-name b)) b))
7676 (switch-to-buffer (list-buffers-noselect nil))
7688 The buffer(s) above will be appended to this message. If you don't want
7689 to append a buffer because it contains sensible data, or because the buffer
7697 Please note that you have set `tramp-verbose' to a value greater than 9.
7699 (add-text-properties start (point) (list 'face 'italic))))
7705 (if (y-or-n-p "Do you want to append the buffer(s)? ")
7709 (switch-to-buffer curbuf)
7715 'disposition "attachment" 'buffer (buffer-name buffer)
7716 'description (buffer-name buffer)))
7729 ;; - Reset `file-name-handler-alist'
7738 (tramp-unload-file-name-handlers)
7750 ;; When it is loaded, we need to pull in the integration module.
7756 (add-hook 'tramp-unload-hook
7764 ;; This should be implemented via a general mechanism to add
7768 ;; Another approach is to read a netrc file like ~/.authinfo
7775 ;; of `od -b'. For writing files to the remote host, we construct
7777 ;; and which writes the right bytes to the file. We can use printf(1)
7781 ;; two commands to write a null byte:
7789 ;; * Rewrite `tramp-shell-quote-argument' to abstain from using
7791 ;; * Completion gets confused when you leave out the method name.
7796 ;; * When logging in, keep looking for questions according to an alist
7799 ;; * Running CVS remotely doesn't appear to work right. It thinks
7804 ;; likely to produce long command lines, and some shells choke on
7812 ;; * How to deal with MULE in `insert-file-contents' and `write-region'?
7816 ;; * abbreviate-file-name
7818 ;; * Also allow to omit user names when doing multi-hop. Not sure yet
7819 ;; what the user names should default to, though.
7827 ;; transfer method to use. (Greg Stark)
7832 ;; to do it?
7834 ;; * Make it work for different encodings, and for different file name
7836 ;; * Change applicable functions to pass a struct tramp-file-name rather
7845 ;; * When editing a remote CVS controlled file as a different user, VC
7846 ;; gets confused about the file locking status. Try to find out why
7848 ;; * Change `copy-file' to grok the case where the filename handler
7849 ;; for the source and the target file are different. Right now,
7850 ;; it looks at the source file and then calls that handler, if
7852 ;; about Tramp, it does not do the right thing if the target file
7853 ;; name is a Tramp name.
7855 ;; ** If `partial-completion-mode' isn't loaded, "/foo:bla" tries to
7856 ;; connect to host "blabla" already if that host is unique. No idea
7857 ;; how to suppress. Maybe not an essential problem.
7858 ;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode'.
7862 ;; ** Decide whiche files to take for searching user/host names depending on
7869 ;; Functions for file-name-handler-alist:
7870 ;; diff-latest-backup-file -- in diff.el
7872 ;; file-name-as-directory -- use primitive?
7873 ;; file-name-sans-versions -- use primitive?
7874 ;; get-file-buffer -- use primitive