systems, such as @samp{windows-nt} and @samp{gnu/linux}. This option
ensures the correct name of the remote shell program.
-Starting with Emacs 24, when @option{explicit-shell-file-name} is
-equal to @code{nil}, calling @code{shell} interactively will prompt
-for a shell name.
+When @option{explicit-shell-file-name} is equal to @code{nil}, calling
+@code{shell} interactively will prompt for a shell name.
Starting with Emacs 26, you could use connection-local variables for
setting different values of @option{explicit-shell-file-name} for
@item
Which systems does it work on?
-The package works successfully on Emacs 23, Emacs 24, Emacs 25, and
-Emacs 26.
+The package works successfully on Emacs 24, Emacs 25, and Emacs 26.
While Unix and Unix-like systems are the primary remote targets,
@value{tramp} has equal success connecting to other platforms, such as
(tramp-message v 6 "%s" (mapconcat 'identity (process-command p) " "))
(process-put p 'adjust-window-size-function 'ignore)
(set-process-query-on-exit-flag p nil)
- (while (tramp-compat-process-live-p p)
+ (while (process-live-p p)
(accept-process-output p 0.1))
(accept-process-output p 0.1)
(tramp-message v 6 "\n%s" (buffer-string))
(when (and user (not (tramp-get-file-property vec "" "su-command-p" t)))
(tramp-error vec 'file-error "Cannot switch to user `%s'" user))
- (unless (tramp-compat-process-live-p p)
+ (unless (process-live-p p)
(save-match-data
(when (and p (processp p)) (delete-process p))
(if (zerop (length device))
vec 6 "%s" (mapconcat 'identity (process-command p) " "))
;; Wait for initial prompt.
(tramp-adb-wait-for-output p 30)
- (unless (tramp-compat-process-live-p p)
+ (unless (process-live-p p)
(tramp-error vec 'file-error "Terminated!"))
(tramp-set-connection-property p "vector" vec)
(process-put p 'adjust-window-size-function 'ignore)
(value
;; If the key is an auxiliary process object, check whether
;; the process is still alive.
- (if (and (processp key) (not (tramp-compat-process-live-p key)))
+ (if (and (processp key) (not (process-live-p key)))
default
(if (hash-table-p hash)
(gethash property hash default)
;;; Commentary:
;; Tramp's main Emacs version for development is Emacs 26. This
-;; package provides compatibility functions for Emacs 23, Emacs 24 and
-;; Emacs 25.
+;; package provides compatibility functions for Emacs 24 and Emacs 25.
;;; Code:
(require 'trampver)
(require 'tramp-loaddefs)
-;; `remote-file-name-inhibit-cache' has been introduced with Emacs
-;; 24.1. Besides t, nil, and integer, we use also timestamps (as
-;; returned by `current-time') internally.
-(unless (boundp 'remote-file-name-inhibit-cache)
- (defvar remote-file-name-inhibit-cache nil))
-
;; For not existing functions, obsolete functions, or functions with a
;; changed argument list, there are compiler warnings. We want to
;; avoid them in cases we know what we do.
'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards)
(ad-activate 'file-expand-wildcards))))
-;; `condition-case-unless-debug' is introduced with Emacs 24.
-(if (fboundp 'condition-case-unless-debug)
- (defalias 'tramp-compat-condition-case-unless-debug
- 'condition-case-unless-debug)
- (defmacro tramp-compat-condition-case-unless-debug
- (var bodyform &rest handlers)
- "Like `condition-case' except that it does not catch anything when debugging."
- (declare (debug condition-case) (indent 2))
- (let ((bodysym (make-symbol "body")))
- `(let ((,bodysym (lambda () ,bodyform)))
- (if debug-on-error
- (funcall ,bodysym)
- (condition-case ,var
- (funcall ,bodysym)
- ,@handlers))))))
-
(defsubst tramp-compat-temporary-file-directory ()
"Return name of directory for temporary files.
It is the default value of `temporary-file-directory'."
'temporary-file-directory
'tramp-handle-temporary-file-directory))
-;; PRESERVE-EXTENDED-ATTRIBUTES has been introduced with Emacs 24.1
-;; (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)
- "Like `copy-file' for Tramp files (compat function)."
- (cond
- (preserve-extended-attributes
- (condition-case nil
- (tramp-compat-funcall
- 'copy-file filename newname ok-if-already-exists keep-date
- preserve-uid-gid preserve-extended-attributes)
- (wrong-number-of-arguments
- (copy-file
- filename newname ok-if-already-exists keep-date preserve-uid-gid))))
- (t
- (copy-file
- filename newname ok-if-already-exists keep-date preserve-uid-gid))))
-
-;; COPY-CONTENTS has been introduced with Emacs 24.1.
-(defun tramp-compat-copy-directory
- (directory newname &optional keep-time parents copy-contents)
- "Make a copy of DIRECTORY (compat function)."
- (condition-case nil
- (tramp-compat-funcall
- 'copy-directory directory newname keep-time parents copy-contents)
-
- ;; `copy-directory' is either not implemented, or it does not
- ;; support the the COPY-CONTENTS flag. For the time being, we
- ;; ignore COPY-CONTENTS as well.
-
- (error
- ;; If `default-directory' is a remote directory, make sure we
- ;; find its `copy-directory' handler.
- (let ((handler (or (find-file-name-handler directory 'copy-directory)
- (find-file-name-handler newname 'copy-directory))))
- (if handler
- (funcall handler 'copy-directory directory newname keep-time parents)
-
- ;; Compute target name.
- (setq directory (directory-file-name (expand-file-name directory))
- newname (directory-file-name (expand-file-name newname)))
- (if (and (file-directory-p newname)
- (not (string-equal (file-name-nondirectory directory)
- (file-name-nondirectory newname))))
- (setq newname
- (expand-file-name
- (file-name-nondirectory directory) newname)))
- (if (not (file-directory-p newname)) (make-directory newname parents))
-
- ;; Copy recursively.
- (mapc
- (lambda (file)
- (if (file-directory-p file)
- (tramp-compat-copy-directory file newname keep-time parents)
- (copy-file file newname t keep-time)))
- ;; We do not want to delete "." and "..".
- (directory-files directory 'full directory-files-no-dot-files-regexp))
-
- ;; Set directory attributes.
- (set-file-modes newname (file-modes directory))
- (if keep-time
- (set-file-times newname (nth 5 (file-attributes directory)))))))))
-
-;; TRASH has been introduced with Emacs 24.1.
-(defun tramp-compat-delete-file (filename &optional trash)
- "Like `delete-file' for Tramp files (compat function)."
- (condition-case nil
- (tramp-compat-funcall 'delete-file filename trash)
- ;; This Emacs version does not support the TRASH flag.
- (wrong-number-of-arguments
- (let ((delete-by-moving-to-trash (and delete-by-moving-to-trash trash)))
- (delete-file filename)))))
-
-;; RECURSIVE has been introduced with Emacs 23.2. TRASH has been
-;; introduced with Emacs 24.1.
-(defun tramp-compat-delete-directory (directory &optional recursive trash)
- "Like `delete-directory' for Tramp files (compat function)."
- (condition-case nil
- (cond
- (trash
- (tramp-compat-funcall 'delete-directory directory recursive trash))
- (t
- (delete-directory directory recursive)))
- ;; This Emacs version does not support the TRASH flag. We use the
- ;; implementation from Emacs 23.2.
- (wrong-number-of-arguments
- (setq directory (directory-file-name (expand-file-name directory)))
- (when (not (file-symlink-p directory))
- (mapc (lambda (file)
- (if (eq t (car (file-attributes file)))
- (tramp-compat-delete-directory file recursive trash)
- (tramp-compat-delete-file file trash)))
- (directory-files
- directory 'full directory-files-no-dot-files-regexp)))
- (delete-directory directory))))
-
(defun tramp-compat-process-running-p (process-name)
"Returns t if system process PROCESS-NAME is running for `user-login-name'."
(when (stringp process-name)
process-name))))
(setq result t)))))))))
-;; `process-running-live-p' is introduced in Emacs 24.
-(defalias 'tramp-compat-process-live-p
- (if (fboundp 'process-running-live-p)
- 'process-running-live-p
- (lambda (process)
- "Returns non-nil if PROCESS is alive.
-A process is considered alive if its status is `run', `open',
-`listen', `connect' or `stop'. Value is nil if PROCESS is not a
-process."
- (and (processp process)
- (memq (process-status process)
- '(run open listen connect stop))))))
-
;; `user-error' has appeared in Emacs 24.3.
(defsubst tramp-compat-user-error (vec-or-proc format &rest args)
"Signal a pilot error."
This is a string of ten letters or dashes as in ls -l."
(nth 8 attributes)))
-;; `default-toplevel-value' has been declared in Emacs 24.
+;; `default-toplevel-value' has been declared in Emacs 24.4.
(unless (fboundp 'default-toplevel-value)
(defalias 'default-toplevel-value 'symbol-value))
-;; `format-message' is new in Emacs 25.
+;; `format-message' is new in Emacs 25.1.
(unless (fboundp 'format-message)
(defalias 'format-message 'format))
-;; `file-missing' is introduced in Emacs 26.
+;; `file-missing' is introduced in Emacs 26.1.
(defconst tramp-file-missing
(if (get 'file-missing 'error-conditions) 'file-missing 'file-error)
"The error symbol for the `file-missing' error.")
;; All actions to mount a remote location, and to retrieve mount
;; information, are performed by D-Bus messages. File operations
;; themselves are performed via the mounted filesystem in ~/.gvfs.
-;; Consequently, GNU Emacs 23.1 with enabled D-Bus bindings is a
+;; Consequently, GNU Emacs with enabled D-Bus bindings is a
;; precondition.
;; The GVFS D-Bus interface is said to be unstable. There were even
(defconst tramp-gvfs-service-daemon "org.gtk.vfs.Daemon"
"The well known name of the GVFS daemon.")
-;; D-Bus integration is available since Emacs 23 on some system types.
;; We don't call `dbus-ping', because this would load dbus.el.
(defconst tramp-gvfs-enabled
(ignore-errors
(and t2 (not (tramp-gvfs-file-name-p newname))))
;; We cannot copy or rename directly.
- ;; PRESERVE-EXTENDED-ATTRIBUTES has been introduced with
- ;; Emacs 24.1 (as PRESERVE-SELINUX-CONTEXT), and renamed
- ;; in Emacs 24.3.
(let ((tmpfile (tramp-compat-make-temp-file filename)))
- (cond
- (preserve-extended-attributes
- (funcall
- file-operation
- filename tmpfile t keep-date preserve-uid-gid
- preserve-extended-attributes))
- (t
- (funcall
- file-operation filename tmpfile t keep-date preserve-uid-gid)))
+ (funcall
+ file-operation filename tmpfile t keep-date preserve-uid-gid
+ preserve-extended-attributes)
(rename-file tmpfile newname ok-if-already-exists))
;; Direct action.
"Like `copy-file' for Tramp files."
(setq filename (expand-file-name filename))
(setq newname (expand-file-name newname))
- (cond
- ;; At least one file a Tramp file?
- ((or (tramp-tramp-file-p filename)
- (tramp-tramp-file-p newname))
- (tramp-gvfs-do-copy-or-rename-file
- 'copy filename newname ok-if-already-exists keep-date
- preserve-uid-gid preserve-extended-attributes))
- ;; Compat section. PRESERVE-EXTENDED-ATTRIBUTES has been
- ;; introduced with Emacs 24.1 (as PRESERVE-SELINUX-CONTEXT), and
- ;; renamed in Emacs 24.3.
- (preserve-extended-attributes
+ ;; At least one file a Tramp file?
+ (if (or (tramp-tramp-file-p filename)
+ (tramp-tramp-file-p newname))
+ (tramp-gvfs-do-copy-or-rename-file
+ 'copy filename newname ok-if-already-exists keep-date
+ preserve-uid-gid preserve-extended-attributes)
(tramp-run-real-handler
'copy-file
(list filename newname ok-if-already-exists keep-date
- preserve-uid-gid preserve-extended-attributes)))
- (t
- (tramp-run-real-handler
- 'copy-file
- (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))))
+ preserve-uid-gid preserve-extended-attributes))))
(defun tramp-gvfs-handle-delete-directory (directory &optional recursive trash)
"Like `delete-directory' for Tramp files."
(mapc (lambda (file)
(if (eq t (tramp-compat-file-attribute-type
(file-attributes file)))
- (tramp-compat-delete-directory file recursive trash)
- (tramp-compat-delete-file file trash)))
+ (delete-directory file recursive trash)
+ (delete-file file trash)))
(directory-files
directory 'full directory-files-no-dot-files-regexp))
(when (directory-files directory nil directory-files-no-dot-files-regexp)
;; There might be an error if the monitor is not supported.
;; Give the filter a chance to read the output.
(tramp-accept-process-output p 1)
- (unless (tramp-compat-process-live-p p)
+ (unless (process-live-p p)
(tramp-error
v 'file-notify-error "Monitoring not supported for `%s'" file-name))
p))))
(when (> (buffer-size) 0)
(goto-char (point-min))
;; ... inode
- (setq res-inode
- (condition-case err
- (read (current-buffer))
- ;; This error happens in Emacs 23. Starting with
- ;; Emacs 24, a large integer will be converted into
- ;; a float automatically during `read'.
- (overflow-error (string-to-number (cadr err)))))
+ (setq res-inode (read (current-buffer)))
;; ... file mode flags
(setq res-filemodes (symbol-name (read (current-buffer))))
;; ... number links
(filename newname &optional ok-if-already-exists keep-date
preserve-uid-gid preserve-extended-attributes)
"Like `copy-file' for Tramp files."
- (setq filename (expand-file-name filename))
- (setq newname (expand-file-name newname))
- (cond
- ;; At least one file a Tramp file?
- ((or (tramp-tramp-file-p filename)
- (tramp-tramp-file-p newname))
- (tramp-do-copy-or-rename-file
- 'copy filename newname ok-if-already-exists keep-date
- preserve-uid-gid preserve-extended-attributes))
- ;; Compat section. PRESERVE-EXTENDED-ATTRIBUTES has been
- ;; introduced with Emacs 24.1 (as PRESERVE-SELINUX-CONTEXT), and
- ;; renamed in Emacs 24.3.
- (preserve-extended-attributes
+ (setq filename (expand-file-name filename)
+ newname (expand-file-name newname))
+ (if (or (tramp-tramp-file-p filename)
+ (tramp-tramp-file-p newname))
+ (tramp-do-copy-or-rename-file
+ 'copy filename newname ok-if-already-exists keep-date
+ preserve-uid-gid preserve-extended-attributes)
(tramp-run-real-handler
'copy-file
(list filename newname ok-if-already-exists keep-date
- preserve-uid-gid preserve-extended-attributes)))
- (t
- (tramp-run-real-handler
- 'copy-file
- (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))))
+ preserve-uid-gid preserve-extended-attributes))))
(defun tramp-sh-handle-copy-directory
(dirname newname &optional keep-date parents copy-contents)
(defun tramp-process-sentinel (proc event)
"Flush file caches."
- (unless (tramp-compat-process-live-p proc)
+ (unless (process-live-p proc)
(let ((vec (tramp-get-connection-property proc "vector" nil)))
(when vec
(tramp-message vec 5 "Sentinel called: `%S' `%s'" proc event)
;; There might be an error if the monitor is not supported.
;; Give the filter a chance to read the output.
(tramp-accept-process-output p 1)
- (unless (tramp-compat-process-live-p p)
+ (unless (process-live-p p)
(tramp-error
v 'file-notify-error "Monitoring not supported for `%s'" file-name))
p))))
;; If Tramp opens the same connection within a short time frame,
;; there is a problem. We shall signal this.
- (unless (or (tramp-compat-process-live-p p)
+ (unless (or (process-live-p p)
(not (tramp-file-name-equal-p
vec (car tramp-current-connection)))
(> (tramp-time-diff
(tramp-get-connection-property
p "last-cmd-time" '(0 0 0)))
60)
- (tramp-compat-process-live-p p))
+ (process-live-p p))
(tramp-send-command vec "echo are you awake" t t)
- (unless (and (tramp-compat-process-live-p p)
+ (unless (and (process-live-p p)
(tramp-wait-for-output p 10))
;; The error will be caught locally.
(tramp-error vec 'file-error "Awake did fail")))
;; New connection must be opened.
(condition-case err
- (unless (tramp-compat-process-live-p p)
+ (unless (process-live-p p)
;; During completion, don't reopen a new connection. We
;; check this for the process related to
(defun tramp-smb-action-with-tar (proc vec)
"Untar from connection buffer."
- (if (not (tramp-compat-process-live-p proc))
+ (if (not (process-live-p proc))
(throw 'tramp-action 'process-died)
(with-current-buffer (tramp-get-connection-buffer vec)
(set-process-query-on-exit-flag p nil)
(tramp-process-actions p v nil tramp-smb-actions-with-tar)
- (while (tramp-compat-process-live-p p)
+ (while (process-live-p p)
(sit-for 0.1))
(tramp-message v 6 "\n%s" (buffer-string))))
0 (format "Copying %s to %s" filename newname)
(if (file-directory-p filename)
- (tramp-compat-copy-directory
+ (copy-directory
filename newname keep-date 'parents 'copy-contents)
(let ((tmpfile (file-local-copy filename)))
(defun tramp-smb-action-get-acl (proc vec)
"Read ACL data from connection buffer."
- (unless (tramp-compat-process-live-p proc)
+ (unless (process-live-p proc)
;; Accept pending output.
(while (tramp-accept-process-output proc 0.1))
(with-current-buffer (tramp-get-connection-buffer vec)
(narrow-to-region (point-max) (point-max))
(let ((p (tramp-get-connection-process v)))
(tramp-smb-send-command v "exit $lasterrorcode")
- (while (tramp-compat-process-live-p p)
+ (while (process-live-p p)
(sleep-for 0.1)
(setq ret (process-exit-status p))))
(delete-region (point-min) (point-max))
(defun tramp-smb-action-set-acl (proc vec)
"Read ACL data from connection buffer."
- (unless (tramp-compat-process-live-p proc)
+ (unless (process-live-p proc)
;; Accept pending output.
(while (tramp-accept-process-output proc 0.1))
(with-current-buffer (tramp-get-connection-buffer vec)
(defun tramp-smb-get-cifs-capabilities (vec)
"Check, whether the SMB server supports POSIX commands."
;; When we are not logged in yet, we return nil.
- (if (tramp-compat-process-live-p (tramp-get-connection-process vec))
+ (if (process-live-p (tramp-get-connection-process vec))
(with-tramp-connection-property
(tramp-get-connection-process vec) "cifs-capabilities"
(save-match-data
"Check, whether the SMB server supports the STAT command."
;; When we are not logged in yet, we return nil.
(if (and (tramp-smb-get-share vec)
- (tramp-compat-process-live-p (tramp-get-connection-process vec)))
+ (process-live-p (tramp-get-connection-process vec)))
(with-tramp-connection-property
(tramp-get-connection-process vec) "stat-capability"
(tramp-smb-send-command vec "stat \"/\""))))
(tramp-get-connection-property
p "last-cmd-time" '(0 0 0)))
60)
- (tramp-compat-process-live-p p)
+ (process-live-p p)
(re-search-forward tramp-smb-errors nil t))
(delete-process p)
(setq p nil)))
;; Check whether it is still the same share.
- (unless (and (tramp-compat-process-live-p p)
+ (unless (and (process-live-p p)
(or argument
(string-equal
share
;; Algorithm: get waiting output. See if last line contains
;; `tramp-smb-prompt' sentinel or `tramp-smb-errors' strings.
;; If not, wait a bit and again get waiting output.
- (while (and (not found) (not err) (tramp-compat-process-live-p p))
+ (while (and (not found) (not err) (process-live-p p))
;; Accept pending output.
(tramp-accept-process-output p 0.1)
(setq err (re-search-forward tramp-smb-errors nil t)))
;; When the process is still alive, read pending output.
- (while (and (not found) (tramp-compat-process-live-p p))
+ (while (and (not found) (process-live-p p))
;; Accept pending output.
(tramp-accept-process-output p 0.1)
"Send SIGKILL to the winexe process."
(ignore-errors
(let ((p (get-buffer-process (current-buffer))))
- (when (tramp-compat-process-live-p p)
+ (when (process-live-p p)
(signal-process (process-id p) 'SIGINT)))))
(defun tramp-smb-call-winexe (vec)
;; Notes:
;; -----
;;
-;; This package only works for Emacs 23.1 and higher.
+;; This package only works for Emacs 24.1 and higher.
;;
;; Also see the todo list at the bottom of this file.
;;
"Sorry, try again."
"Name or service not known"
"Host key verification failed."
- "No supported authentication methods left to try!") t)
+ "No supported authentication methods left to try!")
+ t)
".*"
"\\|"
"^.*\\("
"^"
(regexp-opt
'("tramp-backtrace"
- "tramp-compat-condition-case-unless-debug"
"tramp-compat-funcall"
"tramp-compat-user-error"
"tramp-condition-case-unless-debug"
(tramp-message ,vec ,level "%s..." ,message)
(let ((cookie "failed")
(tm
- ;; We start a pulsing progress reporter after 3 seconds. Feature
- ;; introduced in Emacs 24.1.
+ ;; We start a pulsing progress reporter after 3 seconds.
(when (and tramp-message-show-message
;; Display only when there is a minimum level.
(<= ,level (min tramp-verbose 3)))
- (ignore-errors
- (let ((pr (make-progress-reporter ,message nil nil)))
- (when pr
- (run-at-time
- 3 0.1 #'tramp-progress-reporter-update pr)))))))
+ (let ((pr (make-progress-reporter ,message nil nil)))
+ (when pr
+ (run-at-time
+ 3 0.1 #'tramp-progress-reporter-update pr))))))
(unwind-protect
;; Execute the body.
(prog1 (progn ,@body) (setq cookie "done"))
"Replace environment variables in FILENAME.
Return the string with the replaced variables."
(or (ignore-errors
- ;; Optional arg has been introduced with Emacs 24 (?).
+ ;; 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
'(access-file byte-compiler-base-file-name delete-directory
delete-file diff-latest-backup-file directory-file-name
directory-files directory-files-and-attributes
- dired-compress-file dired-uncache
+ dired-compress-file dired-uncache file-acl
file-accessible-directory-p file-attributes
file-directory-p file-executable-p file-exists-p
- file-local-copy file-modes
- file-name-as-directory file-name-directory
- file-name-nondirectory file-name-sans-versions
+ file-local-copy file-modes file-name-as-directory
+ file-name-directory file-name-nondirectory
+ file-name-sans-versions file-notify-add-watch
file-ownership-preserved-p file-readable-p
- file-regular-p file-remote-p file-symlink-p file-truename
- file-writable-p find-backup-file-name find-file-noselect
- get-file-buffer insert-directory insert-file-contents
- load make-directory make-directory-internal
- set-file-modes set-file-times substitute-in-file-name
- unhandled-file-name-directory vc-registered
- ;; Emacs 24+ only.
- file-acl file-notify-add-watch file-selinux-context
- set-file-acl set-file-selinux-context
+ file-regular-p file-remote-p file-selinux-context
+ file-symlink-p file-truename file-writable-p
+ find-backup-file-name find-file-noselect get-file-buffer
+ insert-directory insert-file-contents load
+ make-directory make-directory-internal set-file-acl
+ set-file-modes set-file-selinux-context set-file-times
+ substitute-in-file-name unhandled-file-name-directory
+ vc-registered
;; Emacs 26+ only.
file-name-case-insensitive-p))
(if (file-name-absolute-p (nth 0 args))
;; FILE DIRECTORY resp FILE1 FILE2.
((member operation
'(add-name-to-file copy-directory copy-file expand-file-name
+ file-equal-p file-in-directory-p
file-name-all-completions file-name-completion
- file-newer-than-file-p make-symbolic-link rename-file
- ;; Emacs 24+ only.
- file-equal-p file-in-directory-p))
+ file-newer-than-file-p make-symbolic-link rename-file))
(save-match-data
(cond
((tramp-tramp-file-p (nth 0 args)) (nth 0 args))
default-directory)
;; PROC.
((member operation
- '(;; Emacs 24+ only.
- file-notify-rm-watch
+ '(file-notify-rm-watch
;; Emacs 25+ only.
file-notify-valid-p))
(when (processp (nth 0 args))
(var bodyform &rest handlers)
"Like `condition-case-unless-debug' but `tramp-debug-on-error'."
`(let ((debug-on-error tramp-debug-on-error))
- (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers)))
+ (condition-case-unless-debug ,var ,bodyform ,@handlers)))
;; Main function.
(defun tramp-file-name-handler (operation &rest args)
(defun tramp-completion-mode-p ()
"Check, whether method / user name / host name completion is active."
(or
- ;; Signal from outside. `non-essential' has been introduced in Emacs 24.
- (bound-and-true-p non-essential)
+ ;; Signal from outside.
+ non-essential
;; This variable has been obsoleted in Emacs 26.
tramp-completion-mode))
(let (tramp-verbose)
(and (tramp-tramp-file-p filename)
(or (not (tramp-completion-mode-p))
- (tramp-compat-process-live-p
+ (process-live-p
(tramp-get-connection-process
(tramp-dissect-file-name filename)))))))
(when (tramp-tramp-file-p filename)
(let* ((v (tramp-dissect-file-name filename))
(p (tramp-get-connection-process v))
- (c (and (tramp-compat-process-live-p p)
+ (c (and (process-live-p p)
(tramp-get-connection-property p "connected" nil))))
;; We expand the file name only, if there is already a connection.
(with-parsed-tramp-file-name
(defun tramp-handle-file-notify-valid-p (proc)
"Like `file-notify-valid-p' for Tramp files."
- (and (tramp-compat-process-live-p proc)
+ (and (process-live-p proc)
;; Sometimes, the process is still in status `run' when the
;; file or directory to be watched is deleted already.
(with-current-buffer (process-buffer proc)
(defun tramp-action-process-alive (proc _vec)
"Check, whether a process has finished."
- (unless (tramp-compat-process-live-p proc)
+ (unless (process-live-p proc)
(throw 'tramp-action 'process-died)))
(defun tramp-action-out-of-band (proc vec)
"Check, whether an out-of-band copy has finished."
;; There might be pending output for the exit status.
(tramp-accept-process-output proc 0.1)
- (cond ((and (not (tramp-compat-process-live-p proc))
+ (cond ((and (not (process-live-p proc))
(zerop (process-exit-status proc)))
(tramp-message vec 3 "Process has finished.")
(throw 'tramp-action 'ok))
(lambda (key _value)
(and (processp key)
(not (string-prefix-p "*tramp/" (process-name key)))
- (tramp-compat-process-live-p key)
+ (process-live-p key)
(setq result t)))
tramp-cache-data)
result))
(with-timeout (timeout)
(while (not found)
(tramp-accept-process-output proc 1)
- (unless (tramp-compat-process-live-p 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
(while (not found)
(tramp-accept-process-output proc 1)
- (unless (tramp-compat-process-live-p 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)))))
(prog1
(or
;; See if auth-sources contains something useful.
- ;; `auth-source-user-or-password' is an obsoleted
- ;; function since Emacs 24.1, it has been replaced by
- ;; `auth-source-search'.
(ignore-errors
(and (tramp-get-connection-property
v "first-password-request" nil)
;; Try with Tramp's current method.
- (if (fboundp 'auth-source-search)
- (setq auth-info
- (auth-source-search
- :max 1
- (and tramp-current-user :user)
- tramp-current-user
- :host tramp-current-host
- :port tramp-current-method
- :require
- (cons
- :secret (and tramp-current-user '(:user))))
- auth-passwd (plist-get
- (nth 0 auth-info) :secret)
- auth-passwd (if (functionp auth-passwd)
- (funcall auth-passwd)
- auth-passwd))
- (tramp-compat-funcall
- 'auth-source-user-or-password
- "password" tramp-current-host tramp-current-method))))
+ (setq auth-info
+ (auth-source-search
+ :max 1
+ (and tramp-current-user :user)
+ tramp-current-user
+ :host tramp-current-host
+ :port tramp-current-method
+ :require
+ (cons
+ :secret (and tramp-current-user '(:user))))
+ auth-passwd (plist-get
+ (nth 0 auth-info) :secret)
+ auth-passwd (if (functionp auth-passwd)
+ (funcall auth-passwd)
+ auth-passwd))))
;; Try the password cache.
(let ((password (password-read pw-prompt key)))
(password-cache-add key password)
(replace-regexp-in-string
(concat tramp-postfix-hop-regexp "$")
(tramp-postfix-host-format) hop)))))
- ;; `auth-source-forget-user-or-password' is an obsoleted function
- ;; since Emacs 24.1, it has been replaced by `auth-source-forget'.
- (if (fboundp 'auth-source-forget)
- (auth-source-forget
- `(:max 1 ,(and user :user) ,user :host ,host :port ,method))
- (tramp-compat-funcall
- 'auth-source-forget-user-or-password "password" host method))
+ (auth-source-forget
+ `(:max 1 ,(and user :user) ,user :host ,host :port ,method))
(password-cache-remove
(tramp-make-tramp-file-name method user domain host port ""))))
(replace-regexp-in-string "\n" "" (buffer-string))))))))
;; Check for Emacs version.
-(let ((x (if (>= emacs-major-version 23)
+(let ((x (if (>= emacs-major-version 24)
"ok"
(format "Tramp 2.3.2-pre is not fit for %s"
(when (string-match "^.*$" (emacs-version))