@lisp
@group
-@c `with-eval-after-load' has been introduced with Emacs 24.4. Shall
-@c be used when appropriate.
-(eval-after-load "filecache"
- '(file-cache-add-directory
+(with-eval-after-load 'filecache
+ (file-cache-add-directory
"@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}"))
@end group
@end lisp
@c Copyright (C) 2003-2019 Free Software Foundation, Inc.
@c See file doclicense.texi for copying conditions.
-@c In the Tramp GIT, the version number is auto-frobbed from tramp.el,
-@c and the bug report address is auto-frobbed from configure.ac.
+@c In the Tramp GIT, the version numbers are auto-frobbed from
+@c tramp.el, and the bug report address is auto-frobbed from
+@c configure.ac.
@set trampver 2.4.2-pre
@set tramp-bug-report-address tramp-devel@@gnu.org
+@set emacsver 24.4
@c Other flags from configuration.
@set instprefix /usr/local
(setq thisstep (pop steps))
(tramp-message
v 5 "Check %s"
- (mapconcat #'identity
- (append '("") (reverse result) (list thisstep))
- "/"))
+ (string-join
+ (append '("") (reverse result) (list thisstep)) "/"))
(setq symlink-target
(tramp-compat-file-attribute-type
(file-attributes
(tramp-make-tramp-file-name
- v (mapconcat #'identity
- (append
- '("") (reverse result) (list thisstep))
- "/")))))
+ v
+ (string-join
+ (append '("") (reverse result) (list thisstep)) "/")))))
(cond ((string= "." thisstep)
(tramp-message v 5 "Ignoring step `.'"))
((string= ".." thisstep)
;; Combine list to form string.
(setq result
(if result
- (mapconcat #'identity (cons "" result) "/")
+ (string-join (cons "" result) "/")
"/"))
- (when (and is-dir (or (string= "" result)
+ (when (and is-dir (or (string-empty-p result)
(not (string= (substring result -1) "/"))))
(setq result (concat result "/"))))
#'tramp-adb-ls-output-time-less-p
#'tramp-adb-ls-output-name-less-p))))
(delete-region (point-min) (point-max))
- (insert " " (mapconcat #'identity sorted-lines "\n ")))
+ (insert " " (string-join sorted-lines "\n ")))
;; Add final newline.
(goto-char (point-max))
(unless (bolp) (insert "\n"))))
(prompt (md5 (concat (prin1-to-string process-environment)
(current-time-string)))))
(tramp-message
- vec 6 "%s" (mapconcat #'identity (process-command p) " "))
+ vec 6 "%s" (string-join (process-command p) " "))
;; Wait for initial prompt. On some devices, it needs an
;; initial RET, in order to get it.
(sleep-for 0.1)
;; `connection-local-set-profile-variables' and
;; `connection-local-set-profiles' exists since Emacs 26.1.
-(eval-after-load "shell"
- '(progn
- (tramp-compat-funcall
- 'connection-local-set-profile-variables
- 'tramp-adb-connection-local-default-profile
- tramp-adb-connection-local-default-profile)
- (tramp-compat-funcall
- 'connection-local-set-profiles
- `(:application tramp :protocol ,tramp-adb-method)
- 'tramp-adb-connection-local-default-profile)))
+(with-eval-after-load 'shell
+ (progn
+ (tramp-compat-funcall
+ 'connection-local-set-profile-variables
+ 'tramp-adb-connection-local-default-profile
+ tramp-adb-connection-local-default-profile)
+ (tramp-compat-funcall
+ 'connection-local-set-profiles
+ `(:application tramp :protocol ,tramp-adb-method)
+ 'tramp-adb-connection-local-default-profile)))
(add-hook 'tramp-unload-hook
(lambda ()
;; `tramp-archive-file-name-handler' must be placed before `url-file-handler'.
(when url-handler-mode (tramp-register-file-name-handlers))
-(eval-after-load 'url-handler
- '(progn
- (add-hook 'url-handler-mode-hook #'tramp-register-file-name-handlers)
- (add-hook
- 'tramp-archive-unload-hook
- (lambda ()
- (remove-hook
- 'url-handler-mode-hook #'tramp-register-file-name-handlers)))))
+(with-eval-after-load 'url-handler
+ (progn
+ (add-hook 'url-handler-mode-hook #'tramp-register-file-name-handlers)
+ (add-hook
+ 'tramp-archive-unload-hook
+ (lambda ()
+ (remove-hook
+ 'url-handler-mode-hook #'tramp-register-file-name-handlers)))))
\f
;; File name conversions.
(delete-process (tramp-get-connection-process vec)))
(tramp-flush-connection-properties vec)
+ ;; Cancel timer.
+ (dolist (timer timer-list)
+ (when (and (eq (timer--function timer) 'tramp-timeout-session)
+ (tramp-file-name-equal-p vec (car (timer--args timer))))
+ (cancel-timer timer)))
+
;; Remove buffers.
(dolist
(buf (list (get-buffer (tramp-buffer-name vec))
(delete (car proxies) tramp-default-proxies-alist)
proxies tramp-default-proxies-alist)
(setq proxies (cdr proxies)))))
- (when (and tramp-default-proxies-alist tramp-save-ad-hoc-proxies)
- (customize-save-variable
- 'tramp-default-proxies-alist tramp-default-proxies-alist))
+ (when (and tramp-default-proxies-alist tramp-save-ad-hoc-proxies)
+ (customize-save-variable
+ 'tramp-default-proxies-alist tramp-default-proxies-alist))
+
+ ;; Cancel timers.
+ (cancel-function-timers 'tramp-timeout-session)
;; Remove buffers.
(dolist (name (tramp-list-tramp-buffers))
(require 'ls-lisp) ;; Due to `tramp-handle-insert-directory'.
(require 'parse-time)
(require 'shell)
+(require 'subr-x)
(declare-function tramp-handle-temporary-file-directory "tramp")
((fboundp 'w32-window-exists-p)
(tramp-compat-funcall 'w32-window-exists-p process-name process-name))
- ;; GNU Emacs 23.
+ ;; GNU Emacs 23+.
((and (fboundp 'list-system-processes) (fboundp 'process-attributes))
(let (result)
(dolist (pid (tramp-compat-funcall 'list-system-processes) result)
process-name))))
(setq result t)))))))))
-;; `default-toplevel-value' has been declared in Emacs 24.4.
-(unless (fboundp 'default-toplevel-value)
- (defalias 'default-toplevel-value #'symbol-value))
-
;; `file-attribute-*' are introduced in Emacs 25.1.
(defalias 'tramp-compat-file-attribute-type
(provide 'tramp-compat)
-;;; TODO:
-
-;; * When we get rid of Emacs 24, replace "(mapconcat #'identity" by
-;; "(string-join".
-
;;; tramp-compat.el ends here
(setq file-name-handler-alist
(delete a1 (delete a2 file-name-handler-alist)))))
-(eval-after-load "ange-ftp"
- '(tramp-disable-ange-ftp))
+(with-eval-after-load 'ange-ftp
+ (tramp-disable-ange-ftp))
;;;###tramp-autoload
(defun tramp-ftp-enable-ange-ftp ()
(tramp-message tramp-gvfs-dbus-event-vector 6 "%S" event)
(tramp-error tramp-gvfs-dbus-event-vector 'file-error "%s" (cadr err))))
-;; `dbus-event-error-hooks' has been renamed to
-;; `dbus-event-error-functions' in Emacs 24.3.
-(add-hook
- (if (boundp 'dbus-event-error-functions)
- 'dbus-event-error-functions 'dbus-event-error-hooks)
- #'tramp-gvfs-dbus-event-error)
+(add-hook 'dbus-event-error-functions #'tramp-gvfs-dbus-event-error)
\f
;; File name primitives.
;; Send command.
(tramp-gvfs-send-command
v "gvfs-ls" "-h" "-n" "-a"
- (mapconcat #'identity tramp-gvfs-file-attributes ",")
+ (string-join tramp-gvfs-file-attributes ",")
(tramp-gvfs-url-file-name directory))
;; Parse output.
(with-current-buffer (tramp-get-connection-buffer v)
(tramp-error
v 'file-notify-error "Monitoring not supported for `%s'" file-name)
(tramp-message
- v 6 "Run `%s', %S" (mapconcat #'identity (process-command p) " ") p)
+ v 6 "Run `%s', %S" (string-join (process-command p) " ") p)
(process-put p 'vector v)
(process-put p 'events events)
(process-put p 'watch-name localname)
(list user host)))
(zeroconf-list-services service)))
-;; We use the TRIM argument of `split-string', which exist since Emacs
-;; 24.4. I mask this for older Emacs versions, there is no harm.
(defun tramp-gvfs-parse-device-names (service)
"Return a list of (user host) tuples allowed to access.
This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi."
(let ((result
(ignore-errors
- (tramp-compat-funcall
- 'split-string
+ (split-string
(shell-command-to-string (format "avahi-browse -trkp %s" service))
"[\n\r]+" 'omit "^\\+;.*$"))))
(delete-dups
(lambda (x)
(let* ((list (split-string x ";"))
(host (nth 6 list))
- (text (tramp-compat-funcall
- 'split-string (nth 9 list) "\" \"" 'omit "\""))
+ (text (split-string (nth 9 list) "\" \"" 'omit "\""))
user)
;; A user is marked in a TXT field like "u=guest".
(while text
(mapconcat
#'identity (butlast (tramp-compat-exec-path)) path-separator)))
-(eval-after-load "esh-util"
- '(progn
- (add-hook 'eshell-mode-hook
- #'tramp-eshell-directory-change)
- (add-hook 'eshell-directory-change-hook
- #'tramp-eshell-directory-change)
- (add-hook 'tramp-integration-unload-hook
- (lambda ()
- (remove-hook 'eshell-mode-hook
- #'tramp-eshell-directory-change)
- (remove-hook 'eshell-directory-change-hook
- #'tramp-eshell-directory-change)))))
+(with-eval-after-load 'esh-util
+ (progn
+ (add-hook 'eshell-mode-hook
+ #'tramp-eshell-directory-change)
+ (add-hook 'eshell-directory-change-hook
+ #'tramp-eshell-directory-change)
+ (add-hook 'tramp-integration-unload-hook
+ (lambda ()
+ (remove-hook 'eshell-mode-hook
+ #'tramp-eshell-directory-change)
+ (remove-hook 'eshell-directory-change-hook
+ #'tramp-eshell-directory-change)))))
;;; Integration of recentf.el:
(let ((recentf-exclude '(file-remote-p)))
(recentf-cleanup))))
-(eval-after-load "recentf"
- '(progn
- (add-hook 'tramp-cleanup-connection-hook
- #'tramp-recentf-cleanup)
- (add-hook 'tramp-cleanup-all-connections-hook
- #'tramp-recentf-cleanup-all)
- (add-hook 'tramp-integration-unload-hook
- (lambda ()
- (remove-hook 'tramp-cleanup-connection-hook
- #'tramp-recentf-cleanup)
- (remove-hook 'tramp-cleanup-all-connections-hook
- #'tramp-recentf-cleanup-all)))))
+(with-eval-after-load 'recentf
+ (progn
+ (add-hook 'tramp-cleanup-connection-hook
+ #'tramp-recentf-cleanup)
+ (add-hook 'tramp-cleanup-all-connections-hook
+ #'tramp-recentf-cleanup-all)
+ (add-hook 'tramp-integration-unload-hook
+ (lambda ()
+ (remove-hook 'tramp-cleanup-connection-hook
+ #'tramp-recentf-cleanup)
+ (remove-hook 'tramp-cleanup-all-connections-hook
+ #'tramp-recentf-cleanup-all)))))
;;; Default connection-local variables for Tramp:
;; `connection-local-set-profile-variables' and
;; `connection-local-set-profiles' exists since Emacs 26.1.
-(eval-after-load "shell"
- '(progn
- (tramp-compat-funcall
- 'connection-local-set-profile-variables
- 'tramp-connection-local-default-profile
- tramp-connection-local-default-profile)
- (tramp-compat-funcall
- 'connection-local-set-profiles
- `(:application tramp)
- 'tramp-connection-local-default-profile)))
+(with-eval-after-load 'shell
+ (progn
+ (tramp-compat-funcall
+ 'connection-local-set-profile-variables
+ 'tramp-connection-local-default-profile
+ tramp-connection-local-default-profile)
+ (tramp-compat-funcall
+ 'connection-local-set-profiles
+ `(:application tramp)
+ 'tramp-connection-local-default-profile)))
(add-hook 'tramp-unload-hook
(lambda () (unload-feature 'tramp-integration 'force)))
(setq thisstep (pop steps))
(tramp-message
v 5 "Check %s"
- (mapconcat #'identity
- (append '("") (reverse result) (list thisstep))
- "/"))
+ (string-join
+ (append '("") (reverse result) (list thisstep)) "/"))
(setq symlink-target
(tramp-compat-file-attribute-type
(file-attributes
(tramp-make-tramp-file-name
v
- (mapconcat #'identity
- (append '("")
- (reverse result)
- (list thisstep))
- "/")
+ (string-join
+ (append '("") (reverse result) (list thisstep)) "/")
'nohop))))
(cond ((string= "." thisstep)
(tramp-message v 5 "Ignoring step `.'"))
"Maximum number (%d) of symlinks exceeded" numchase-limit))
(setq result (reverse result))
;; Combine list to form string.
- (setq result
- (if result
- (mapconcat #'identity (cons "" result) "/")
- "/"))
- (when (string= "" result)
- (setq result "/")))))
+ (setq result (if result (string-join (cons "" result) "/") "/"))
+ (when (string-empty-p result) (setq result "/")))))
;; Detect cycle.
(when (and (file-symlink-p filename)
(t2 (tramp-tramp-file-p newname))
(length (tramp-compat-file-attribute-size
(file-attributes (file-truename filename))))
- ;; `file-extended-attributes' exists since Emacs 24.4.
(attributes (and preserve-extended-attributes
(apply #'file-extended-attributes (list filename)))))
;; Handle `preserve-extended-attributes'. We ignore possible
;; errors, because ACL strings could be incompatible.
- ;; `set-file-extended-attributes' exists since Emacs 24.4.
(when attributes
(ignore-errors
(apply #'set-file-extended-attributes (list newname attributes))))
(mapcar
(lambda (x)
(setq x (mapcar (lambda (y) (format-spec y spec)) x))
- (unless (member "" x) (mapconcat #'identity x " ")))
+ (unless (member "" x) (string-join x " ")))
(tramp-get-method-parameter v 'tramp-copy-env)))
remote-copy-program
(tramp-error
v 'file-notify-error
"`%s' failed to start on remote host"
- (mapconcat #'identity sequence " "))
- (tramp-message v 6 "Run `%s', %S" (mapconcat #'identity sequence " ") p)
+ (string-join sequence " "))
+ (tramp-message v 6 "Run `%s', %S" (string-join sequence " ") p)
(process-put p 'vector v)
;; Needed for process filter.
(process-put p 'events events)
"%s\n%s"))
progname progname progname
tramp-end-of-heredoc
- (mapconcat #'identity dirlist "\n")
+ (string-join dirlist "\n")
tramp-end-of-heredoc))
(goto-char (point-max))
(when (search-backward "tramp_executable " nil t)
whether it exists and if so, it is added to the environment
variable PATH."
(let ((command
- (format "PATH=%s; export PATH"
- (mapconcat #'identity (tramp-get-remote-path vec) ":")))
+ (format
+ "PATH=%s; export PATH" (string-join (tramp-get-remote-path vec) ":")))
(pipe-buf
(or (with-tramp-connection-property vec "pipe-buf"
(tramp-send-command-and-read
(append `(,(tramp-get-remote-locale vec))
(copy-sequence tramp-remote-process-environment))))
(setq item (split-string item "=" 'omit))
- (setcdr item (mapconcat #'identity (cdr item) "="))
+ (setcdr item (string-join (cdr item) "="))
(if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
(push (format "%s %s" (car item) (cdr item)) vars)
(push (car item) unset)))
(format
"while read var val; do export $var=\"$val\"; done <<'%s'\n%s\n%s"
tramp-end-of-heredoc
- (mapconcat #'identity vars "\n")
+ (string-join vars "\n")
tramp-end-of-heredoc)
t))
(when unset
(tramp-send-command
- vec (format "unset %s" (mapconcat #'identity unset " ")) t)))))
+ vec (format "unset %s" (string-join unset " ")) t)))))
;; Old text from documentation of tramp-methods:
;; Using a uuencode/uudecode inline method is discouraged, please use one
(set-process-query-on-exit-flag p nil)
(setq tramp-current-connection (cons vec (current-time)))
- (tramp-message
- vec 6 "%s" (mapconcat #'identity (process-command p) " "))
+ (tramp-message vec 6 "%s" (string-join (process-command p) " "))
;; Check whether process is alive.
(tramp-barf-if-no-shell-prompt
(mapcar
(lambda (x)
(setq x (mapcar (lambda (y) (format-spec y spec)) x))
- (unless (member "" x) (mapconcat #'identity x " ")))
+ (unless (member "" x) (string-join x " ")))
login-env))
(while login-env
(setq command
(mapconcat
(lambda (x)
(setq x (mapcar (lambda (y) (format-spec y spec)) x))
- (unless (member "" x) (mapconcat #'identity x " ")))
+ (unless (member "" x) (string-join x " ")))
login-args " ")
;; Local shell could be a Windows COMSPEC. It
;; doesn't know the ";" syntax, but we must exit
;; `tramp-echo-mark', so the remote shell sees two consecutive
;; trailing line endings and sends two prompts after executing
;; the command, which confuses `tramp-wait-for-output'.
- (when (and (not (string= command ""))
+ (when (and (not (string-empty-p command))
(string-equal (substring command -1) "\n"))
(setq command (substring command 0 -1)))
;; No need to restore a trailing newline here since `tramp-send-string'
tramp-smb-program args)))
(tramp-message
- v 6 "%s" (mapconcat #'identity (process-command p) " "))
+ v 6 "%s" (string-join (process-command p) " "))
(process-put p 'vector v)
(process-put p 'adjust-window-size-function #'ignore)
(set-process-query-on-exit-flag p nil)
tramp-smb-acl-program args)))
(tramp-message
- v 6 "%s" (mapconcat #'identity (process-command p) " "))
+ v 6 "%s" (string-join (process-command p) " "))
(process-put p 'vector v)
(process-put p 'adjust-window-size-function #'ignore)
(set-process-query-on-exit-flag p nil)
(setq outbuf (current-buffer))))
;; Construct command.
- (setq command (mapconcat #'identity (cons program args) " ")
+ (setq command (string-join (cons program args) " ")
command (if input
(format
"get-content %s | & %s"
(tramp-get-connection-buffer v)
tramp-smb-acl-program args)))
- (tramp-message
- v 6 "%s" (mapconcat #'identity (process-command p) " "))
+ (tramp-message v 6 "%s" (string-join (process-command p) " "))
(process-put p 'vector v)
(process-put p 'adjust-window-size-function #'ignore)
(set-process-query-on-exit-flag p nil)
(get-buffer-create buffer)
;; BUFFER can be nil. We use a temporary buffer.
(generate-new-buffer tramp-temp-buffer-name)))
- (command (mapconcat #'identity (cons program args) " "))
+ (command (string-join (cons program args) " "))
(bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
(name1 name)
(i 0))
tramp-smb-winexe-program tramp-smb-program)
args))))
- (tramp-message
- vec 6 "%s" (mapconcat #'identity (process-command p) " "))
+ (tramp-message vec 6 "%s" (string-join (process-command p) " "))
(process-put p 'vector vec)
(process-put p 'adjust-window-size-function #'ignore)
(set-process-query-on-exit-flag p nil)
;; Read pending output.
(while (not (re-search-forward tramp-smb-prompt nil t))
- (while (tramp-accept-process-output p 0)
- (goto-char (point-min))))
+ (while (tramp-accept-process-output p 0))
+ (goto-char (point-min)))
(tramp-message vec 6 "\n%s" (buffer-string))
;; Remove prompt.
(file-times (tramp-compat-file-attribute-modification-time
(file-attributes filename)))
(file-modes (tramp-default-file-modes filename))
- ;; `file-extended-attributes' exists since Emacs 24.4.
(attributes (and preserve-extended-attributes
(apply #'file-extended-attributes (list filename))))
(sudoedit-operation
;; Handle `preserve-extended-attributes'. We ignore possible
;; errors, because ACL strings could be incompatible.
- ;; `set-file-extended-attributes' exists since Emacs 24.4.
(when attributes
(ignore-errors
(apply #'set-file-extended-attributes (list newname attributes))))
(with-parsed-tramp-file-name (expand-file-name filename) nil
(when (and (stringp acl-string) (tramp-sudoedit-remote-acl-p v))
;; Massage `acl-string'.
- (setq acl-string
- (mapconcat #'identity (split-string acl-string "\n" 'omit) ","))
+ (setq acl-string (string-join (split-string acl-string "\n" 'omit) ","))
(prog1
(tramp-sudoedit-send-command
v "setfacl" "-m"
(tramp-verbose (if (= tramp-verbose 3) 2 tramp-verbose))
;; We do not want to save the password.
auth-source-save-behavior)
- (tramp-message vec 6 "%s" (mapconcat #'identity (process-command p) " "))
+ (tramp-message vec 6 "%s" (string-join (process-command p) " "))
;; Avoid process status message in output buffer.
(set-process-sentinel p #'ignore)
(process-put p 'vector vec)
;; Keywords: comm, processes
;; Package: tramp
;; Version: 2.4.2-pre
-;; Package-Requires: ((emacs "24.1"))
+;; Package-Requires: ((emacs "24.4"))
;; URL: https://savannah.gnu.org/projects/tramp
;; This file is part of GNU Emacs.
:type 'regexp)
(defcustom tramp-password-prompt-regexp
- (format "^.*\\(%s\\).*:\^@? *"
- ;; `password-word-equivalents' has been introduced with Emacs 24.4.
- (regexp-opt (or (bound-and-true-p password-word-equivalents)
- '("password" "passphrase"))))
+ (format "^.*\\(%s\\).*:\^@? *" (regexp-opt password-word-equivalents))
"Regexp matching password-like prompts.
The regexp should match at end of buffer.
(defun tramp-user-error (vec-or-proc fmt-string &rest arguments)
"Signal a user error (or \"pilot error\")."
(unwind-protect
- (apply
- #'tramp-error vec-or-proc
- ;; `user-error' has appeared in Emacs 24.3.
- (if (fboundp 'user-error) 'user-error 'error) fmt-string arguments)
+ (apply #'tramp-error vec-or-proc 'user-error fmt-string arguments)
;; Save exit.
(when (and tramp-message-show-message
(not (zerop tramp-verbose))
(defun tramp-replace-environment-variables (filename)
"Replace environment variables in FILENAME.
Return the string with the replaced variables."
- (or (ignore-errors
- ;; Optional arg has been introduced with Emacs 24.4.
- (tramp-compat-funcall 'substitute-env-vars filename 'only-defined))
- ;; We need an own implementation.
- (save-match-data
- (let ((idx (string-match "\\$\\(\\w+\\)" filename)))
- ;; `$' is coded as `$$'.
- (when (and idx
- (or (zerop idx) (not (eq ?$ (aref filename (1- idx)))))
- (getenv (match-string 1 filename)))
- (setq filename
- (replace-match
- (substitute-in-file-name (match-string 0 filename))
- t nil filename)))
- filename))))
+ (substitute-env-vars filename 'only-defined))
(defun tramp-find-file-name-coding-system-alist (filename tmpname)
"Like `find-operation-coding-system' for Tramp filenames.
Expects the output of PROC to be sent to the current buffer. Returns
the string that matched, or nil. Waits indefinitely if TIMEOUT is
nil."
- (with-current-buffer (process-buffer proc)
- (let ((found (tramp-check-for-regexp proc regexp)))
- (cond (timeout
- (with-timeout (timeout)
- (while (not found)
- (tramp-accept-process-output proc)
- (unless (process-live-p proc)
- (tramp-error-with-buffer
- nil proc 'file-error "Process has died"))
- (setq found (tramp-check-for-regexp proc regexp)))))
- (t
+ (let ((found (tramp-check-for-regexp proc regexp)))
+ (cond (timeout
+ (with-timeout (timeout)
(while (not found)
(tramp-accept-process-output proc)
(unless (process-live-p proc)
(tramp-error-with-buffer
nil proc 'file-error "Process has died"))
(setq found (tramp-check-for-regexp proc regexp)))))
- (tramp-message proc 6 "\n%s" (buffer-string))
- (unless found
- (if timeout
- (tramp-error
- proc 'file-error "[[Regexp `%s' not found in %d secs]]"
- regexp timeout)
- (tramp-error proc 'file-error "[[Regexp `%s' not found]]" regexp)))
- found)))
+ (t
+ (while (not found)
+ (tramp-accept-process-output proc)
+ (unless (process-live-p proc)
+ (tramp-error-with-buffer
+ nil proc 'file-error "Process has died"))
+ (setq found (tramp-check-for-regexp proc regexp)))))
+ ;; The process could have timed out, for example due to session
+ ;; timeout of sudo. The process buffer does not exist any longer then.
+ (ignore-errors
+ (with-current-buffer (process-buffer proc)
+ (tramp-message proc 6 "\n%s" (buffer-string))))
+ (unless found
+ (if timeout
+ (tramp-error
+ proc 'file-error "[[Regexp `%s' not found in %d secs]]"
+ regexp timeout)
+ (tramp-error proc 'file-error "[[Regexp `%s' not found]]" regexp)))
+ found))
;; It seems that Tru64 Unix does not like it if long strings are sent
;; to it in one go. (This happens when sending the Perl
(setq string
(mapconcat
#'identity (split-string string "\n") tramp-rsh-end-of-line))
- (unless (or (string= string "")
+ (unless (or (string-empty-p string)
(string-equal (substring string -1) tramp-rsh-end-of-line))
(setq string (concat string tramp-rsh-end-of-line)))
;; Send the string.
;; We use key nil for local connection properties.
(with-tramp-connection-property nil (format "gid-%s" id-format)
(cond
- ;; `group-gid' has been introduced with Emacs 24.4.
- ((and (fboundp 'group-gid) (equal id-format 'integer))
- (tramp-compat-funcall 'group-gid))
+ ((equal id-format 'integer) (group-gid))
;; `group-name' has been introduced with Emacs 27.1.
((and (fboundp 'group-name) (equal id-format 'string))
- (tramp-compat-funcall 'group-name (tramp-compat-funcall 'group-gid)))
+ (tramp-compat-funcall 'group-name (group-gid)))
((tramp-compat-file-attribute-group-id
(file-attributes "~/" id-format))))))
output error result)
(tramp-message
vec 6 "`%s %s' %s %s"
- program (mapconcat #'identity args " ") infile destination)
+ program (string-join args " ") infile destination)
(condition-case err
(with-temp-buffer
(setq result
result)
(tramp-message
vec 6 "`%s %s' %s %s %s %s"
- program (mapconcat #'identity args " ") start end delete buffer)
+ program (string-join args " ") start end delete buffer)
(condition-case err
(progn
(setq result
(vec (or vec (car tramp-current-connection)))
result)
(if args
- (tramp-message vec 6 "%s %s" program (mapconcat #'identity args " "))
+ (tramp-message vec 6 "%s %s" program (string-join args " "))
(tramp-message vec 6 "%s" program))
(setq result
(condition-case err
"The repository revision of the Tramp sources.")
;; Check for Emacs version.
-(let ((x (if (not (string-lessp emacs-version "24.1"))
+(let ((x (if (not (string-lessp emacs-version "24.4"))
"ok"
(format "Tramp 2.4.2-pre is not fit for %s"
(replace-regexp-in-string "\n" "" (emacs-version))))))
;;; Commentary:
-;; The tests require a recent ert.el from Emacs 24.4.
-
;; Some of the tests require access to a remote host files. Since
;; this could be problematic, a mock-up connection method "mock" is
;; used. Emulating a remote connection, it simply calls "sh -i".
(ert-deftest tramp-test02-file-name-dissect ()
"Check remote file name components."
- ;; `user-error' has appeared in Emacs 24.3.
- (skip-unless (fboundp 'user-error))
-
(let ((tramp-default-method "default-method")
(tramp-default-user "default-user")
(tramp-default-host "default-host")
(ert-deftest tramp-test02-file-name-dissect-simplified ()
"Check simplified file name components."
:tags '(:expensive-test)
- ;; `user-error' has appeared in Emacs 24.3.
- (skip-unless (fboundp 'user-error))
-
(let ((tramp-default-method "default-method")
(tramp-default-user "default-user")
(tramp-default-host "default-host")
(ert-deftest tramp-test02-file-name-dissect-separate ()
"Check separate file name components."
:tags '(:expensive-test)
- ;; `user-error' has appeared in Emacs 24.3.
- (skip-unless (fboundp 'user-error))
-
(let ((tramp-default-method "default-method")
(tramp-default-user "default-user")
(tramp-default-host "default-host")
"Check host name rules for host-less methods."
(skip-unless (tramp--test-enabled))
(skip-unless (tramp--test-sh-p))
- ;; `user-error' has appeared in Emacs 24.3.
- (skip-unless (fboundp 'user-error))
;; Host names must match rules in case the command template of a
;; method doesn't use them.
(ert-deftest tramp-test03-file-name-method-rules ()
"Check file name rules for some methods."
(skip-unless (tramp--test-enabled))
- ;; `user-error' has appeared in Emacs 24.3.
- (skip-unless (fboundp 'user-error))
;; Multi hops are allowed for inline methods only.
(should-error