Commit a7985477 authored by Michael Albinus's avatar Michael Albinus

Add missing dcstrings in Tramp, remove chec for obsolee methods

* lisp/net/tramp.el (tramp-progress-reporter-update)
(tramp-unload-file-name-handlers, tramp-get-local-uid)
(tramp-get-local-gid, tramp-get-local-locale):
* lisp/net/tramp-adb.el (tramp-adb-ls-date-regexp)
(tramp-adb-ls-toolbox-regexp, tramp-adb-get-ls-command):
* lisp/net/tramp-compat.el (tramp-compat-funcall):
* lisp/net/tramp-ftp.el (tramp-ftp-enable-ange-ftp):
* lisp/net/tramp-gw.el (tramp-gw-process-filter):
* lisp/net/tramp-sh.el (tramp-get-remote-path)
(tramp-get-remote-locale, tramp-get-ls-command)
(tramp-get-ls-command-with-dired)
(tramp-get-ls-command-with-quoting-style)
(tramp-get-ls-command-with-w-option)
(tramp-get-test-nt-command, tramp-get-file-exists-command)
(tramp-get-remote-ln, tramp-get-remote-perl)
(tramp-get-remote-stat, tramp-get-remote-readlink)
(tramp-get-remote-trash, tramp-get-remote-touch)
(tramp-get-remote-gvfs-monitor-dir)
(tramp-get-remote-inotifywait, tramp-get-remote-id)
(tramp-get-remote-uid-with-id)
(tramp-get-remote-uid-with-perl, tramp-get-remote-python)
(tramp-get-remote-uid-with-python, tramp-get-remote-uid)
(tramp-get-remote-gid-with-id)
(tramp-get-remote-gid-with-perl)
(tramp-get-remote-gid-with-python, tramp-get-remote-gid)
(tramp-get-env-with-u-option): Add missing docstrings.

* lisp/net/tramp.el (tramp-obsolete-methods)
(tramp-warned-obsolete-methods): Remove.
(tramp-find-method): Do not check for obsolete methods any longer.
parent 37cef5fb
......@@ -63,7 +63,8 @@ It is used for TCP/IP devices."
: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
......@@ -72,7 +73,8 @@ It is used for TCP/IP devices."
"[[: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
......@@ -424,6 +426,7 @@ pass to the OPERATION."
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")
......@@ -433,8 +436,7 @@ pass to the OPERATION."
"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
......@@ -662,7 +664,7 @@ But handle the case, if the \"test\" command is not available."
(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)
......@@ -1082,8 +1084,7 @@ This happens for Android >= 4.0."
(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
......
......@@ -54,6 +54,7 @@
;; changed argument list, there are compiler warnings. We want to
;; avoid them in cases we know what we do.
(defmacro tramp-compat-funcall (function &rest arguments)
"Call FUNCTION if it exists. Do not raise compiler warnings."
`(when (or (subrp ,function) (functionp ,function))
(with-no-warnings (funcall ,function ,@arguments))))
......@@ -121,7 +122,7 @@ Add the extension of F, if existing."
;; (as PRESERVE-SELINUX-CONTEXT), and renamed in Emacs 24.3.
(defun tramp-compat-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 (compat function)."
(cond
(preserve-extended-attributes
......
......@@ -60,6 +60,7 @@ present for backward compatibility."
;;;###autoload
(defun tramp-ftp-enable-ange-ftp ()
"Reenable Ange-FTP, when Tramp is unloaded."
;; The following code is commented out in Ange-FTP.
;;; This regexp takes care of real ange-ftp file names (with a slash
......
......@@ -625,7 +625,7 @@ is no information where to trace the message.")
(defun tramp-gvfs-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
......@@ -720,7 +720,7 @@ file names."
(defun tramp-gvfs-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))
......
......@@ -125,6 +125,7 @@
(tramp-gw-process-filter tramp-gw-gw-proc s))))))
(defun tramp-gw-process-filter (proc string)
"Resend the string to the other pocess."
(let ((tramp-verbose 0))
;; The other process might have been stopped already. We don't
;; want to be interrupted then.
......
......@@ -1909,8 +1909,7 @@ be non-negative integers."
;; 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))))
......@@ -1954,7 +1953,7 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
(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))
......@@ -2038,7 +2037,7 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
(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
......@@ -5148,6 +5147,8 @@ Return ATTR."
;; 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
......@@ -5236,6 +5237,7 @@ Return ATTR."
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"))
......@@ -5252,6 +5254,7 @@ Return ATTR."
(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
......@@ -5277,6 +5280,7 @@ Return ATTR."
(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")
......@@ -5287,6 +5291,7 @@ Return ATTR."
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")
......@@ -5295,6 +5300,7 @@ Return ATTR."
(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")
......@@ -5305,6 +5311,7 @@ Return ATTR."
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")
......@@ -5312,6 +5319,7 @@ Return ATTR."
(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.
......@@ -5333,16 +5341,19 @@ Return ATTR."
"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
......@@ -5360,6 +5371,7 @@ Return ATTR."
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
......@@ -5380,6 +5392,7 @@ Return ATTR."
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
......@@ -5390,11 +5403,13 @@ Return ATTR."
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
......@@ -5419,17 +5434,20 @@ Return ATTR."
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
......@@ -5443,6 +5461,7 @@ Return ATTR."
(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"
......@@ -5452,6 +5471,7 @@ Return ATTR."
"" "| 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'"
......@@ -5461,6 +5481,7 @@ Return ATTR."
"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))
......@@ -5468,6 +5489,7 @@ Return ATTR."
(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\""
......@@ -5477,6 +5499,8 @@ Return ATTR."
"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
......@@ -5496,6 +5520,7 @@ Return ATTR."
(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"
......@@ -5505,6 +5530,7 @@ Return ATTR."
"" "| 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'"
......@@ -5514,6 +5540,7 @@ Return ATTR."
"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\""
......@@ -5523,6 +5550,8 @@ Return ATTR."
"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
......@@ -5542,6 +5571,7 @@ Return ATTR."
(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.
......@@ -5704,5 +5734,6 @@ function cell is returned to be applied on a buffer."
;; 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
......@@ -130,7 +130,7 @@ call, letting the SMB client use the default one."
;; Windows 4.0 (Windows NT), Windows 5.0 (Windows 2000),
;; Windows 5.1 (Windows XP), Windows 5.2 (Windows Server 2003),
;; Windows 6.0 (Windows Vista), Windows 6.1 (Windows 7),
;; Windows 6.3 (Windows 10).
;; Windows 6.3 (Windows Server 2012, Windows 10).
"NT_STATUS_ACCESS_DENIED"
"NT_STATUS_ACCOUNT_LOCKED_OUT"
"NT_STATUS_BAD_NETWORK_NAME"
......@@ -542,7 +542,7 @@ pass to the OPERATION."
(defun tramp-smb-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.
KEEP-DATE has no effect in case NEWNAME resides on an SMB server.
PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
......
......@@ -790,7 +790,7 @@ Derived from `tramp-postfix-host-format'.")
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
......@@ -1032,6 +1032,7 @@ calling HANDLER.")
;;; 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
......@@ -1128,19 +1129,10 @@ entry does not exist, return nil."
(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)
......@@ -1153,19 +1145,6 @@ their replacement."
(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
......@@ -1586,6 +1565,7 @@ If VAR is nil, then we bind `v' to the structure and `method', `user',
(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) ""))
......@@ -2214,6 +2194,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
;;;###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)
......@@ -2271,8 +2252,7 @@ not in completion mode."
(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
......@@ -3792,16 +3772,22 @@ This is used internally by `tramp-file-mode-from-int'."
;;;###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"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment