:group 'tramp)
(defconst tramp-adb-ls-date-regexp
- "[[:space:]][0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9][[:space:]][0-9][0-9]:[0-9][0-9][[:space:]]")
+ "[[:space:]][0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9][[:space:]][0-9][0-9]:[0-9][0-9][[:space:]]"
+ "Regexp for date format in ls output.")
(defconst tramp-adb-ls-toolbox-regexp
(concat
"[[:space:]]+\\([^[:space:]]+\\)" ; \3 group
"[[:space:]]+\\([[:digit:]]+\\)" ; \4 size
"[[:space:]]+\\([-[:digit:]]+[[:space:]][:[:digit:]]+\\)" ; \5 date
- "[[:space:]]\\(.*\\)$")) ; \6 filename
+ "[[:space:]]\\(.*\\)$") ; \6 filename
+ "Regexp for ls output.")
;;;###tramp-autoload
(add-to-list 'tramp-methods
result)))))))))
(defun tramp-adb-get-ls-command (vec)
+ "Determine `ls' command at its arguments."
(with-tramp-connection-property vec "ls"
(tramp-message vec 5 "Finding a suitable `ls' command")
(if (tramp-adb-send-command-and-check vec "ls --color=never -al /dev/null")
"ls --color=never"
"ls")))
-(defun tramp-adb--gnu-switches-to-ash
- (switches)
+(defun tramp-adb--gnu-switches-to-ash (switches)
"Almquist shell can't handle multiple arguments.
Convert (\"-al\") to (\"-a\" \"-l\"). Remove arguments like \"--dired\"."
(split-string
(defun tramp-adb-handle-copy-file
(filename newname &optional ok-if-already-exists keep-date
- _preserve-uid-gid _preserve-extended-attributes)
+ _preserve-uid-gid _preserve-extended-attributes)
"Like `copy-file' for Tramp files.
PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(setq filename (expand-file-name filename)
(while (re-search-forward "\r+$" nil t)
(replace-match "" nil nil)))))
-(defun tramp-adb-send-command-and-check
- (vec command)
+(defun tramp-adb-send-command-and-check (vec command)
"Run COMMAND and check its exit status.
Sends `echo $?' along with the COMMAND for checking the exit
status. If COMMAND is nil, just sends `echo $?'. Returns nil if
;; side.
(unless (looking-at "^ok$")
(tramp-error
- v 'file-error
- "\
+ v 'file-error "\
tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
(tramp-shell-quote-argument localname) (buffer-string))))
(defun tramp-sh-handle-copy-file
(filename newname &optional ok-if-already-exists keep-date
- preserve-uid-gid preserve-extended-attributes)
+ preserve-uid-gid preserve-extended-attributes)
"Like `copy-file' for Tramp files."
(setq filename (expand-file-name filename))
(setq newname (expand-file-name newname))
(defun tramp-do-copy-or-rename-file
(op filename newname &optional ok-if-already-exists keep-date
- preserve-uid-gid preserve-extended-attributes)
+ preserve-uid-gid preserve-extended-attributes)
"Copy or rename a remote file.
OP must be `copy' or `rename' and indicates the operation to perform.
FILENAME specifies the file to copy or rename, NEWNAME is the name of
;; Variables local to connection.
(defun tramp-get-remote-path (vec)
+ "Compile list of remote directories for $PATH.
+Nonexisting directories are removed from spec."
(with-tramp-connection-property
;; When `tramp-own-remote-path' is in `tramp-remote-path', we
;; cache the result for the session only. Otherwise, the result
remote-path)))))
(defun tramp-get-remote-locale (vec)
+ "Determine remote locale, supporting UTF8 if possible."
(with-tramp-connection-property vec "locale"
(tramp-send-command vec "locale -a")
(let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8"))
(format "LC_ALL=%s" (or locale "C")))))
(defun tramp-get-ls-command (vec)
+ "Determine remote `ls' command."
(with-tramp-connection-property vec "ls"
(tramp-message vec 5 "Finding a suitable `ls' command")
(or
(tramp-error vec 'file-error "Couldn't find a proper `ls' command"))))
(defun tramp-get-ls-command-with-dired (vec)
+ "Check, whether the remote `ls' command supports the --dired option."
(save-match-data
(with-tramp-connection-property vec "ls-dired"
(tramp-message vec 5 "Checking, whether `ls --dired' works")
vec (format "%s --dired -al /dev/null" (tramp-get-ls-command vec))))))
(defun tramp-get-ls-command-with-quoting-style (vec)
+ "Check, whether the remote `ls' command supports the --quoting-style option."
(save-match-data
(with-tramp-connection-property vec "ls-quoting-style"
(tramp-message vec 5 "Checking, whether `ls --quoting-style=shell' works")
(tramp-get-ls-command vec))))))
(defun tramp-get-ls-command-with-w-option (vec)
+ "Check, whether the remote `ls' command supports the -w option."
(save-match-data
(with-tramp-connection-property vec "ls-w-option"
(tramp-message vec 5 "Checking, whether `ls -w' works")
vec (format "%s -alw" (tramp-get-ls-command vec))))))
(defun tramp-get-test-command (vec)
+ "Determine remote `test' command."
(with-tramp-connection-property vec "test"
(tramp-message vec 5 "Finding a suitable `test' command")
(if (tramp-send-command-and-check vec "test 0")
(tramp-find-executable vec "test" (tramp-get-remote-path vec)))))
(defun tramp-get-test-nt-command (vec)
+ "Check, whether the remote `test' command supports the -nt option."
;; Does `test A -nt B' work? Use abominable `find' construct if it
;; doesn't. BSD/OS 4.0 wants the parentheses around the command,
;; for otherwise the shell crashes.
"tramp_test_nt %s %s"))))
(defun tramp-get-file-exists-command (vec)
+ "Determine remote command for file existing check."
(with-tramp-connection-property vec "file-exists"
(tramp-message vec 5 "Finding command to check if file exists")
(tramp-find-file-exists-command vec)))
(defun tramp-get-remote-ln (vec)
+ "Determine remote `ln' command."
(with-tramp-connection-property vec "ln"
(tramp-message vec 5 "Finding a suitable `ln' command")
(tramp-find-executable vec "ln" (tramp-get-remote-path vec))))
(defun tramp-get-remote-perl (vec)
+ "Determine remote `perl' command."
(with-tramp-connection-property vec "perl"
(tramp-message vec 5 "Finding a suitable `perl' command")
(let ((result
result)))
(defun tramp-get-remote-stat (vec)
+ "Determine remote `stat' command."
(with-tramp-connection-property vec "stat"
(tramp-message vec 5 "Finding a suitable `stat' command")
(let ((result (tramp-find-executable
result)))
(defun tramp-get-remote-readlink (vec)
+ "Determine remote `readlink' command."
(with-tramp-connection-property vec "readlink"
(tramp-message vec 5 "Finding a suitable `readlink' command")
(let ((result (tramp-find-executable
result))))
(defun tramp-get-remote-trash (vec)
+ "Determine remote `trash' command."
(with-tramp-connection-property vec "trash"
(tramp-message vec 5 "Finding a suitable `trash' command")
(tramp-find-executable vec "trash" (tramp-get-remote-path vec))))
(defun tramp-get-remote-touch (vec)
+ "Determine remote `touch' command."
(with-tramp-connection-property vec "touch"
(tramp-message vec 5 "Finding a suitable `touch' command")
(let ((result (tramp-find-executable
result)))
(defun tramp-get-remote-gvfs-monitor-dir (vec)
+ "Determine remote `gvfs-monitor-dir' command."
(with-tramp-connection-property vec "gvfs-monitor-dir"
(tramp-message vec 5 "Finding a suitable `gvfs-monitor-dir' command")
(tramp-find-executable
vec "gvfs-monitor-dir" (tramp-get-remote-path vec) t t)))
(defun tramp-get-remote-inotifywait (vec)
+ "Determine remote `inotifywait' command."
(with-tramp-connection-property vec "inotifywait"
(tramp-message vec 5 "Finding a suitable `inotifywait' command")
(tramp-find-executable vec "inotifywait" (tramp-get-remote-path vec) t t)))
(defun tramp-get-remote-id (vec)
+ "Determine remote `id' command."
(with-tramp-connection-property vec "id"
(tramp-message vec 5 "Finding POSIX `id' command")
(catch 'id-found
(setq dl (cdr dl))))))))
(defun tramp-get-remote-uid-with-id (vec id-format)
+ "Implement `tramp-get-remote-uid' for Tramp files using `id'."
(tramp-send-command-and-read
vec
(format "%s -u%s %s"
"" "| sed -e s/^/\\\"/ -e s/\\$/\\\"/"))))
(defun tramp-get-remote-uid-with-perl (vec id-format)
+ "Implement `tramp-get-remote-uid' for Tramp files using a Perl script."
(tramp-send-command-and-read
vec
(format "%s -le '%s'"
"print \"\\\"\", scalar getpwuid($>), \"\\\"\""))))
(defun tramp-get-remote-python (vec)
+ "Determine remote `python' command."
(with-tramp-connection-property vec "python"
(tramp-message vec 5 "Finding a suitable `python' command")
(or (tramp-find-executable vec "python" (tramp-get-remote-path vec))
(tramp-find-executable vec "python3" (tramp-get-remote-path vec)))))
(defun tramp-get-remote-uid-with-python (vec id-format)
+ "Implement `tramp-get-remote-uid' for Tramp files using `python'."
(tramp-send-command-and-read
vec
(format "%s -c \"%s\""
"import os, pwd; print ('\\\"' + pwd.getpwuid(os.getuid())[0] + '\\\"')"))))
(defun tramp-get-remote-uid (vec id-format)
+ "The uid of the remote connection VEC, in ID-FORMAT.
+ID-FORMAT valid values are `string' and `integer'."
(with-tramp-connection-property vec (format "uid-%s" id-format)
(let ((res
(ignore-errors
(t res)))))
(defun tramp-get-remote-gid-with-id (vec id-format)
+ "Implement `tramp-get-remote-gid' for Tramp files using `id'."
(tramp-send-command-and-read
vec
(format "%s -g%s %s"
"" "| sed -e s/^/\\\"/ -e s/\\$/\\\"/"))))
(defun tramp-get-remote-gid-with-perl (vec id-format)
+ "Implement `tramp-get-remote-gid' for Tramp files using a Perl script."
(tramp-send-command-and-read
vec
(format "%s -le '%s'"
"print \"\\\"\", scalar getgrgid($)), \"\\\"\""))))
(defun tramp-get-remote-gid-with-python (vec id-format)
+ "Implement `tramp-get-remote-gid' for Tramp files using `python'."
(tramp-send-command-and-read
vec
(format "%s -c \"%s\""
"import os, grp; print ('\\\"' + grp.getgrgid(os.getgid())[0] + '\\\"')"))))
(defun tramp-get-remote-gid (vec id-format)
+ "The gid of the remote connection VEC, in ID-FORMAT.
+ID-FORMAT valid values are `string' and `integer'."
(with-tramp-connection-property vec (format "gid-%s" id-format)
(let ((res
(ignore-errors
(t res)))))
(defun tramp-get-env-with-u-option (vec)
+ "Check, whether the remote `env' command supports the -u option."
(with-tramp-connection-property vec "env-u-option"
(tramp-message vec 5 "Checking, whether `env -u' works")
;; Option "-u" is a GNU extension.
;; rsync).
;; * Keep a second connection open for out-of-band methods like scp or
;; rsync.
+;; * Implement completion for "/method:user@host:~<abc> TAB".
;;; tramp-sh.el ends here
tramp-prefix-ipv6-regexp "\\(?:" tramp-ipv6-regexp "\\)?"
tramp-postfix-ipv6-regexp "\\)"
"\\(?:" tramp-prefix-port-regexp tramp-port-regexp "\\)?" "\\)?")
-"Regular expression matching a Tramp file name between prefix and postfix.")
+ "Regular expression matching a Tramp file name between prefix and postfix.")
(defconst tramp-file-name-structure
(list
;;; Internal functions which must come first:
+;; `user-error' has appeared in Emacs 24.3.
(defsubst tramp-user-error (vec-or-proc format &rest args)
"Signal a pilot error."
(apply
(and (stringp name)
(string-match tramp-file-name-regexp name))))
-;; Obsoleted with Tramp 2.2.7.
-(defconst tramp-obsolete-methods
- '("ssh1" "ssh2" "scp1" "scp2" "scpc" "rsyncc" "plink1")
- "Obsolete methods.")
-
-(defvar tramp-warned-obsolete-methods nil
- "Which methods the user has been warned to be obsolete.")
-
(defun tramp-find-method (method user host)
"Return the right method string to use.
This is METHOD, if non-nil. Otherwise, do a lookup in
-`tramp-default-method-alist'. It maps also obsolete methods to
-their replacement."
+`tramp-default-method-alist'."
(let ((result
(or method
(let ((choices tramp-default-method-alist)
(setq choices nil)))
lmethod)
tramp-default-method)))
- ;; This is needed for a transition period only.
- (when (member result tramp-obsolete-methods)
- (unless (member result tramp-warned-obsolete-methods)
- (if noninteractive
- (warn "Method %s is obsolete, using %s"
- result (substring result 0 -1))
- (unless (y-or-n-p (format "Method \"%s\" is obsolete, use \"%s\"? "
- result (substring result 0 -1)))
- (tramp-user-error nil "Method \"%s\" not supported" result)))
- (add-to-list 'tramp-warned-obsolete-methods result))
- ;; This works with the current set of `tramp-obsolete-methods'.
- ;; Must be improved, if their are more sophisticated replacements.
- (setq result (substring result 0 -1)))
;; We must mark, whether a default value has been used.
(if (or method (null result))
result
(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>"))
(defun tramp-progress-reporter-update (reporter &optional value)
+ "Report progress of an operation for Tramp."
(let* ((parameters (cdr reporter))
(message (aref parameters 3)))
(when (string-match message (or (current-message) ""))
;;;###autoload
(defun tramp-unload-file-name-handlers ()
+ "Unload Tramp file name handlers from `file-name-handler-alist'."
(setq file-name-handler-alist
(delete (rassoc 'tramp-file-name-handler
file-name-handler-alist)
(p (tramp-get-connection-process v)))
(and p (processp p) (memq (process-status p) '(run open))))))))
-(defun tramp-completion-handle-expand-file-name
- (name &optional dir)
+(defun tramp-completion-handle-expand-file-name (name &optional dir)
"Like `expand-file-name' for Tramp files."
(if (tramp-completion-mode-p)
(progn
;;;###tramp-autoload
(defun tramp-get-local-uid (id-format)
+ "The uid of the local user, in ID-FORMAT.
+ID-FORMAT valid values are `string' and `integer'."
(if (equal id-format 'integer) (user-uid) (user-login-name)))
;;;###tramp-autoload
(defun tramp-get-local-gid (id-format)
+ "The gid of the local user, in ID-FORMAT.
+ID-FORMAT valid values are `string' and `integer'."
;; `group-gid' has been introduced with Emacs 24.4.
(if (and (fboundp 'group-gid) (equal id-format 'integer))
(tramp-compat-funcall 'group-gid)
(nth 3 (file-attributes "~/" id-format))))
(defun tramp-get-local-locale (&optional vec)
+ "Determine locale, supporting UTF8 if possible.
+VEC is used for tracing."
;; We use key nil for local connection properties.
(with-tramp-connection-property nil "locale"
(let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8"))