@code{remote-file-name-inhibit-auto-save-visited} to non-@code{nil}.
@vindex lock-file-name-transforms
-And still more issues to handle. Since @w{Emacs 28}, file locks use a
-similar user option as auto-save files, called
-@code{lock-file-name-transforms}. By default this user option is
-@code{nil}, meaning to keep file locks in the same directory as the
-original file.
+And still more issues to handle. File locks use a similar user option
+as auto-save files, called @code{lock-file-name-transforms}. By
+default this user option is @code{nil}, meaning to keep file locks in
+the same directory as the original file.
If you change @code{lock-file-name-transforms} in order to keep file
locks for remote files somewhere else, you will lose Emacs's feature
@item
Which systems does it work on?
-The package works successfully on @w{Emacs 27}, @w{Emacs 28}, @w{Emacs
-29}, and @w{Emacs 30}.
+The package works successfully on @w{Emacs 28}, @w{Emacs 29}, @w{Emacs
+30}, and @w{Emacs 31}.
While Unix and Unix-like systems are the primary remote targets,
@value{tramp} has equal success connecting to other platforms, such as
@c In the Tramp GIT, the version number and the bug report address
@c are auto-frobbed from configure.ac.
-@set trampver 2.7.2-pre
+@set trampver 2.8.0-pre
@set trampurl https://www.gnu.org/software/tramp/
@set tramp-bug-report-address tramp-devel@@gnu.org
-@set emacsver 27.1
+@set emacsver 28.1
@c Other flags from configuration.
@set instprefix /usr/local
(when (string-match
(rx bol (group (+ (not blank))) (+ blank) "device" eol) line)
;; Replace ":" by "#".
- `(nil ,(tramp-compat-string-replace
+ `(nil ,(string-replace
":" tramp-prefix-port-format (match-string 1 line)))))
(tramp-process-lines nil tramp-adb-program "devices")))
v (format "%s -d -a -l %s %s | cat"
(tramp-adb-get-ls-command v)
(tramp-shell-quote-argument
- (tramp-compat-file-name-concat localname "."))
+ (file-name-concat localname "."))
(tramp-shell-quote-argument
- (tramp-compat-file-name-concat localname ".."))))
- (tramp-compat-replace-regexp-in-region
+ (file-name-concat localname ".."))))
+ (replace-regexp-in-region
(rx (literal (file-name-unquote (file-name-as-directory localname))))
"" (point-min))
(widen)))
(search-forward-regexp
(rx blank (group blank (regexp tramp-adb-ls-date-year-regexp) blank))
nil t)
- (replace-match "0\\1" "\\1" nil)
+ (replace-match "0\\1" "\\1")
;; Insert missing "/".
(when (looking-at-p
(rx (regexp tramp-adb-ls-date-time-regexp) (+ blank) eol))
;; KEEP-DATE handling.
(when keep-date
- (tramp-compat-set-file-times
+ (set-file-times
newname
(file-attribute-modification-time (file-attributes filename))
(unless ok-if-already-exists 'nofollow)))))
(let* ((host (tramp-file-name-host vec))
(port (tramp-file-name-port-or-default vec))
(devices (mapcar #'cadr (tramp-adb-parse-device-names nil))))
- (tramp-compat-string-replace
+ (string-replace
tramp-prefix-port-format ":"
(cond ((member host devices) host)
;; This is the case when the host is connected to the default port.
;; An empty host name shall be mapped as well, when there
;; is exactly one entry in `devices'.
((and (tramp-string-empty-or-nil-p host)
- (tramp-compat-length= devices 1))
+ (length= devices 1))
(car devices))
;; Try to connect device.
((and tramp-adb-connect-if-not-connected
- (tramp-compat-length> host 0)
+ (length> host 0)
(tramp-adb-execute-adb-command
vec "connect"
- (tramp-compat-string-replace
- tramp-prefix-port-format ":" host)))
+ (string-replace tramp-prefix-port-format ":" host)))
;; When new device connected, running other adb command (e.g.
;; adb shell) immediately will fail. To get around this
;; problem, add sleep 0.1 second here.
"Execute an adb command.
Insert the result into the connection buffer. Return nil on
error and non-nil on success."
- (when (and (tramp-compat-length> (tramp-file-name-host vec) 0)
+ (when (and (length> (tramp-file-name-host vec) 0)
;; The -s switch is only available for ADB device commands.
(not (member (car args) '("connect" "disconnect"))))
(setq args (append (list "-s" (tramp-adb-get-device vec)) args)))
;; system, but this requires changes in core Tramp.
(goto-char (point-min))
(while (search-forward-regexp (rx (+ "\r") eol) nil t)
- (replace-match "" nil nil)))))))
+ (replace-match "")))))))
(defun tramp-adb-send-command-and-check
(vec command &optional exit-status command-augmented-p)
"Like `tramp-handle-make-process', but modified for Android."
(tramp-skeleton-make-process args nil nil
(let* ((env (mapcar
- (lambda (elt)
- (when (tramp-compat-string-search "=" elt) elt))
+ (lambda (elt) (when (string-search "=" elt) elt))
tramp-remote-process-environment))
;; We use as environment the difference to toplevel
;; `process-environment'.
(env (dolist (elt process-environment env)
(when
(and
- (tramp-compat-string-search "=" elt)
+ (string-search "=" elt)
(not
(member
elt (default-toplevel-value 'process-environment))))
(defun tramp-archive-handle-directory-file-name (directory)
"Like `directory-file-name' for file archives."
(with-parsed-tramp-archive-file-name directory nil
- (if (and (tramp-compat-length> localname 0)
+ (if (and (length> localname 0)
(eq (aref localname (1- (length localname))) ?/)
(not (string= localname "/")))
(substring directory 0 -1)
(dolist (key (hash-table-keys tramp-cache-data))
(when (and (tramp-file-name-p key)
(stringp (tramp-file-name-localname key))
- (tramp-compat-string-search
- directory (tramp-file-name-localname key)))
+ (string-search directory (tramp-file-name-localname key)))
(remhash key tramp-cache-data)))
;; Remove file properties of symlinks.
(when (and (stringp truename)
(defun tramp-cleanup-all-buffers ()
"Kill all remote buffers."
(interactive)
- (let ((tramp-cleanup-some-buffers-hook '(tramp-compat-always)))
+ (let ((tramp-cleanup-some-buffers-hook '(always)))
(tramp-cleanup-some-buffers)))
;;; Rename
(dolist (buffer (tramp-list-remote-buffers))
(switch-to-buffer buffer)
(let* ((bfn (buffer-file-name))
- (new-bfn (and (stringp bfn)
- (tramp-compat-string-replace source target bfn)))
+ (new-bfn (and (stringp bfn) (string-replace source target bfn)))
(prompt (format-message
"Set visited file name to `%s' [Type yn!eq or %s] "
new-bfn (key-description (vector help-char)))))
(insert "\nload-path shadows:\n==================\n")
(ignore-errors
(mapc
- (lambda (x) (when (tramp-compat-string-search "tramp" x) (insert x "\n")))
+ (lambda (x) (when (string-search "tramp" x) (insert x "\n")))
(split-string (list-load-path-shadows t) "\n")))
;; Append buffers only when we are in message mode.
;;; Commentary:
;; Tramp's main Emacs version for development is Emacs 30. This
-;; package provides compatibility functions for Emacs 27, Emacs 28 and
-;; Emacs 29.
+;; package provides compatibility functions for Emacs 28, Emacs 29 and
+;; Emacs 30.
;;; Code:
(if-let ((xdg (xdg-cache-home))
((file-directory-p xdg))
((file-writable-p xdg)))
- ;; We can use `file-name-concat' starting with Emacs 28.1.
- (prog1 (setq xdg (concat (file-name-as-directory xdg) "emacs"))
+ (prog1 (setq xdg (file-name-concat xdg "emacs"))
(make-directory xdg t))
(eval (car (get 'temporary-file-directory 'standard-value)) t)))
"The default value of `temporary-file-directory' for Tramp.")
tramp-temp-name-prefix tramp-compat-temporary-file-directory)
dir-flag (file-name-extension f t)))
-;; `file-modes', `set-file-modes' and `set-file-times' got argument
-;; FLAG in Emacs 28.1.
-(defalias 'tramp-compat-file-modes
- (if (equal (func-arity #'file-modes) '(1 . 2))
- #'file-modes
- (lambda (filename &optional _flag)
- (file-modes filename))))
-
-(defalias 'tramp-compat-set-file-modes
- (if (equal (func-arity #'set-file-modes) '(2 . 3))
- #'set-file-modes
- (lambda (filename mode &optional _flag)
- (set-file-modes filename mode))))
-
-(defalias 'tramp-compat-set-file-times
- (if (equal (func-arity #'set-file-times) '(1 . 3))
- #'set-file-times
- (lambda (filename &optional timestamp _flag)
- (set-file-times filename timestamp))))
-
-;; `directory-files' and `directory-files-and-attributes' got argument
-;; COUNT in Emacs 28.1.
-(defalias 'tramp-compat-directory-files
- (if (equal (func-arity #'directory-files) '(1 . 5))
- #'directory-files
- (lambda (directory &optional full match nosort _count)
- (directory-files directory full match nosort))))
-
-(defalias 'tramp-compat-directory-files-and-attributes
- (if (equal (func-arity #'directory-files-and-attributes) '(1 . 6))
- #'directory-files-and-attributes
- (lambda (directory &optional full match nosort id-format _count)
- (directory-files-and-attributes directory full match nosort id-format))))
-
-;; `directory-empty-p' is new in Emacs 28.1.
-(defalias 'tramp-compat-directory-empty-p
- (if (fboundp 'directory-empty-p)
- #'directory-empty-p
- (lambda (dir)
- (and (file-directory-p dir)
- (null (tramp-compat-directory-files
- dir nil directory-files-no-dot-files-regexp t 1))))))
-
-;; Function `null-device' is new in Emacs 28.1.
-(defalias 'tramp-compat-null-device
- (if (fboundp 'null-device)
- #'null-device
- (lambda ()
- (if (tramp-tramp-file-p default-directory) "/dev/null" null-device))))
-
-;; Function `string-replace' is new in Emacs 28.1.
-(defalias 'tramp-compat-string-replace
- (if (fboundp 'string-replace)
- #'string-replace
- (lambda (from-string to-string in-string)
- (let (case-fold-search)
- (replace-regexp-in-string
- (regexp-quote from-string) to-string in-string t t)))))
-
-;; Function `string-search' is new in Emacs 28.1.
-(defalias 'tramp-compat-string-search
- (if (fboundp 'string-search)
- #'string-search
- (lambda (needle haystack &optional start-pos)
- (let (case-fold-search)
- (string-match-p (regexp-quote needle) haystack start-pos)))))
-
-;; Function `make-lock-file-name' is new in Emacs 28.1.
-(defalias 'tramp-compat-make-lock-file-name
- (if (fboundp 'make-lock-file-name)
- #'make-lock-file-name
- (lambda (filename)
- (expand-file-name
- (concat
- ".#" (file-name-nondirectory filename))
- (file-name-directory filename)))))
-
-;; Function `file-name-concat' is new in Emacs 28.1.
-(defalias 'tramp-compat-file-name-concat
- (if (fboundp 'file-name-concat)
- #'file-name-concat
- (lambda (directory &rest components)
- (let ((components (cl-remove-if (lambda (el)
- (or (null el) (equal "" el)))
- components))
- file-name-handler-alist)
- (if (null components)
- directory
- (apply #'tramp-compat-file-name-concat
- (concat (unless (or (equal "" directory) (null directory))
- (file-name-as-directory directory))
- (car components))
- (cdr components)))))))
-
-;; Function `replace-regexp-in-region' is new in Emacs 28.1.
-(defalias 'tramp-compat-replace-regexp-in-region
- (if (fboundp 'replace-regexp-in-region)
- #'replace-regexp-in-region
- (lambda (regexp replacement &optional start end)
- (if start
- (when (< start (point-min))
- (error "Start before start of buffer"))
- (setq start (point)))
- (if end
- (when (> end (point-max))
- (error "End after end of buffer"))
- (setq end (point-max)))
- (save-excursion
- (let ((matches 0)
- (case-fold-search nil))
- (goto-char start)
- (while (search-forward-regexp regexp end t)
- (replace-match replacement t)
- (setq matches (1+ matches)))
- (and (not (zerop matches))
- matches))))))
-
-;; `length<', `length>' and `length=' are added to Emacs 28.1.
-(defalias 'tramp-compat-length<
- (if (fboundp 'length<)
- #'length<
- (lambda (sequence length)
- (< (length sequence) length))))
-
-(defalias 'tramp-compat-length>
- (if (fboundp 'length>)
- #'length>
- (lambda (sequence length)
- (> (length sequence) length))))
-
-(defalias 'tramp-compat-length=
- (if (fboundp 'length=)
- #'length=
- (lambda (sequence length)
- (= (length sequence) length))))
-
-;; `always' is introduced with Emacs 28.1.
-(defalias 'tramp-compat-always
- (if (fboundp 'always)
- #'always
- (lambda (&rest _arguments)
- "Do nothing and return t.
-This function accepts any number of ARGUMENTS, but ignores them.
-Also see `ignore'."
- t)))
-
;; `permission-denied' is introduced in Emacs 29.1.
(defconst tramp-permission-denied
(if (get 'permission-denied 'error-conditions) 'permission-denied 'file-error)
#'take
(lambda (n list)
(when (and (natnump n) (> n 0))
- (if (tramp-compat-length< list n)
+ (if (length< list n)
list (butlast list (- (length list) n)))))))
;; Function `ntake' is new in Emacs 29.1.
#'ntake
(lambda (n list)
(when (and (natnump n) (> n 0))
- (if (tramp-compat-length< list n)
+ (if (length< list n)
list (nbutlast list (- (length list) n)))))))
;; Function `string-equal-ignore-case' is new in Emacs 29.1.
"Like `set-file-modes' for Tramp files."
(tramp-skeleton-set-file-modes-times-uid-gid filename
(let (tramp-crypt-enabled)
- (tramp-compat-set-file-modes
- (tramp-crypt-encrypt-file-name filename) mode flag))))
+ (set-file-modes (tramp-crypt-encrypt-file-name filename) mode flag))))
(defun tramp-crypt-handle-set-file-times (filename &optional time flag)
"Like `set-file-times' for Tramp files."
(tramp-skeleton-set-file-modes-times-uid-gid filename
(let (tramp-crypt-enabled)
- (tramp-compat-set-file-times
- (tramp-crypt-encrypt-file-name filename) time flag))))
+ (set-file-times (tramp-crypt-encrypt-file-name filename) time flag))))
(defun tramp-crypt-handle-set-file-uid-gid (filename &optional uid gid)
"Like `tramp-set-file-uid-gid' for Tramp files."
(append
'("." "..")
(tramp-fuse-remove-hidden-files
- (tramp-compat-directory-files
- (tramp-fuse-local-file-name directory))))))))
+ (directory-files (tramp-fuse-local-file-name directory))))))))
(if full
;; Massage the result.
(let ((local (rx
(delete (tramp-file-name-unify vec) tramp-fuse-mount-points))
;; Give the caches a chance to expire.
(sleep-for 1)
- (when (tramp-compat-directory-empty-p mount-point)
+ (when (directory-empty-p mount-point)
(delete-directory mount-point))))
(defun tramp-fuse-local-file-name (filename)
(delete-file file)))
(directory-files
directory 'full directory-files-no-dot-files-regexp))
- (unless (tramp-compat-directory-empty-p directory)
+ (unless (directory-empty-p directory)
(tramp-error
v 'file-error "Couldn't delete non-empty %s" directory)))
(setq name "."))
;; Unless NAME is absolute, concat DIR and NAME.
(unless (file-name-absolute-p name)
- (setq name (tramp-compat-file-name-concat dir name)))
+ (setq name (file-name-concat dir name)))
;; If NAME is not a Tramp file, run the real handler.
(if (not (tramp-tramp-file-p name))
(tramp-run-real-handler #'expand-file-name (list name))
(defun tramp-gvfs-handle-file-name-all-completions (filename directory)
"Like `file-name-all-completions' for Tramp files."
(tramp-skeleton-file-name-all-completions filename directory
- (unless (tramp-compat-string-search "/" filename)
+ (unless (string-search "/" filename)
(all-completions
filename
(with-parsed-tramp-file-name (expand-file-name directory) nil
(tramp-message proc 6 "%S\n%s" proc string)
(setq string (concat rest-string string)
;; Fix action names.
- string (tramp-compat-string-replace
- "attributes changed" "attribute-changed" string)
- string (tramp-compat-string-replace
- "changes done" "changes-done-hint" string)
- string (tramp-compat-string-replace
- "renamed to" "moved" string))
+ string (string-replace "attributes changed" "attribute-changed" string)
+ string (string-replace "changes done" "changes-done-hint" string)
+ string (string-replace "renamed to" "moved" string))
;; https://bugs.launchpad.net/bugs/1742946
(when
(string-match-p
(vec (make-tramp-file-name
:method "mtp"
;; A host name cannot contain spaces.
- :host (tramp-compat-string-replace " " "_" (nth 1 volume))))
+ :host (string-replace " " "_" (nth 1 volume))))
(media (make-tramp-media-device
:method method
:host (tramp-gvfs-url-host (nth 5 volume))
(vec (make-tramp-file-name
:method "mtp"
;; A host name cannot contain spaces.
- :host (tramp-compat-string-replace " " "_" (nth 1 volume))))
+ :host (string-replace " " "_" (nth 1 volume))))
(media (make-tramp-media-device
:method method
:host (tramp-gvfs-url-host (nth 5 volume))
;; Adapt default host name, supporting /mtp:: when possible.
(setq tramp-default-host-alist
(append
- `(("mtp" nil ,(if (tramp-compat-length= devices 1) (car devices) "")))
+ `(("mtp" nil ,(if (length= devices 1) (car devices) "")))
(delete
(assoc "mtp" tramp-default-host-alist)
tramp-default-host-alist)))))
"Get the debug file name for VEC."
(declare (tramp-suppress-trace t))
(expand-file-name
- (tramp-compat-string-replace "/" " " (tramp-debug-buffer-name vec))
+ (string-replace "/" " " (tramp-debug-buffer-name vec))
tramp-compat-temporary-file-directory))
(defun tramp-trace-buffer-name (vec)
"A name for the trace buffer for VEC."
(declare (tramp-suppress-trace t))
- (tramp-compat-string-replace "*debug" "*trace" (tramp-debug-buffer-name vec)))
+ (string-replace "*debug" "*trace" (tramp-debug-buffer-name vec)))
(defvar tramp-trace-functions nil
"A list of non-Tramp functions to be traced with `tramp-verbose' > 10.")
"Like `file-name-all-completions' for Tramp files."
(tramp-skeleton-file-name-all-completions filename directory
(with-parsed-tramp-file-name (expand-file-name directory) nil
- (when (and (not (tramp-compat-string-search "/" filename))
+ (when (and (not (string-search "/" filename))
(tramp-connectable-p v))
- (unless (tramp-compat-string-search "/" filename)
+ (unless (string-search "/" filename)
(all-completions
filename
(with-tramp-file-property v localname "file-name-all-completions"
;; KEEP-DATE handling.
(when (and keep-date (not copy-keep-date))
- (tramp-compat-set-file-times
+ (set-file-times
newname file-times (unless ok-if-already-exists 'nofollow)))
;; Set the mode.
copy-args
(flatten-tree
(mapcar
- (lambda (x) (if (tramp-compat-string-search " " x)
- (split-string x) x))
+ (lambda (x) (if (string-search " " x) (split-string x) x))
copy-args))
copy-env (apply #'tramp-expand-args v 'tramp-copy-env nil spec)
remote-copy-program
(save-restriction
(narrow-to-region beg-marker end-marker)
;; Some busyboxes are reluctant to discard colors.
- (unless (tramp-compat-string-search
+ (unless (string-search
"color" (tramp-get-connection-property v "ls" ""))
(goto-char (point-min))
(while (search-forward-regexp ansi-color-control-seq-regexp nil t)
(tramp-run-real-handler #'expand-file-name (list name dir))
;; Unless NAME is absolute, concat DIR and NAME.
(unless (file-name-absolute-p name)
- (setq name (tramp-compat-file-name-concat dir name)))
+ (setq name (file-name-concat dir name)))
;; Dissect NAME.
(with-parsed-tramp-file-name name nil
;; If connection is not established yet, run the real handler.
(heredoc (and (not (bufferp stderr))
(stringp program)
(string-match-p (rx "sh" eol) program)
- (tramp-compat-length= args 2)
+ (length= args 2)
(string-equal "-c" (car args))
;; Don't if there is a quoted string.
(not (string-match-p (rx (any "'\"")) (cadr args)))
;; When PROGRAM is nil, we just provide a tty.
(args (if (not heredoc) args
(let ((i 250))
- (while (and (not (tramp-compat-length< (cadr args) i))
+ (while (and (not (length< (cadr args) i))
(string-match " " (cadr args) i))
(setcdr
args
(env (dolist (elt (cons prompt process-environment) env)
(or (member
elt (default-toplevel-value 'process-environment))
- (if (tramp-compat-string-search "=" elt)
+ (if (string-search "=" elt)
(setq env (append env `(,elt)))
(setq uenv (cons elt uenv))))))
(env (setenv-internal
;; We use as environment the difference to toplevel `process-environment'.
(dolist (elt process-environment)
(or (member elt (default-toplevel-value 'process-environment))
- (if (tramp-compat-string-search "=" elt)
+ (if (string-search "=" elt)
(setq env (append env `(,elt)))
(setq uenv (cons elt uenv)))))
(setq env (setenv-internal env "INSIDE_EMACS" (tramp-inside-emacs) 'keep))
;; Make events a list of symbols.
events
(mapcar
- (lambda (x) (intern-soft (tramp-compat-string-replace "_" "-" x)))
+ (lambda (x) (intern-soft (string-replace "_" "-" x)))
(split-string events "," 'omit))))
;; "gio monitor".
((setq command (tramp-get-remote-gio-monitor v))
(tramp-message proc 6 "%S\n%s" proc string)
(setq string (concat rest-string string)
;; Fix action names.
- string (tramp-compat-string-replace
- "attributes changed" "attribute-changed" string)
- string (tramp-compat-string-replace
- "changes done" "changes-done-hint" string)
- string (tramp-compat-string-replace
- "renamed to" "moved" string))
+ string (string-replace "attributes changed" "attribute-changed" string)
+ string (string-replace "changes done" "changes-done-hint" string)
+ string (string-replace "renamed to" "moved" string))
(catch 'doesnt-work
;; https://bugs.launchpad.net/bugs/1742946
(setq string (substring string pos)))
;; Delete empty lines.
- (setq string (tramp-compat-string-replace "\n\n" "\n" string))
+ (setq string (string-replace "\n\n" "\n" string))
(while (string-match
(rx
(list
proc
(mapcar
- (lambda (x)
- (intern-soft
- (tramp-compat-string-replace "_" "-" (downcase x))))
+ (lambda (x) (intern-soft (string-replace "_" "-" (downcase x))))
(split-string (match-string 1 line) "," 'omit))
(or (match-string 2 line)
(file-name-nondirectory
vec 5 (format-message "Sending script `%s'" name)
;; In bash, leading TABs like in `tramp-bundle-read-file-names'
;; could result in unwanted command expansion. Avoid this.
- (setq script (tramp-compat-string-replace
- (make-string 1 ?\t) (make-string 8 ? ) script))
+ (setq script
+ (string-replace (make-string 1 ?\t) (make-string 8 ? ) script))
;; Expand format specifiers.
(unless (setq script (tramp-expand-script vec script))
(tramp-error
(pipe-buf (tramp-get-remote-pipe-buf vec))
tmpfile chunk chunksize)
(tramp-message vec 5 "Setting $PATH environment variable")
- (if (tramp-compat-length< command pipe-buf)
+ (if (length< command pipe-buf)
(tramp-send-command vec command)
;; Use a temporary file. We cannot use `write-region' because
;; setting the remote path happens in the early connection
means discard it)."
(tramp-call-process
nil tramp-encoding-shell
- (when (and input (not (tramp-compat-string-search "%s" cmd))) input)
+ (when (and input (not (string-search "%s" cmd))) input)
(if (eq output t) t nil)
nil
tramp-encoding-command-switch
(concat
- (if (tramp-compat-string-search "%s" cmd) (format cmd input) cmd)
+ (if (string-search "%s" cmd) (format cmd input) cmd)
(if (stringp output) (concat " >" output) ""))))
(defconst tramp-inline-compress-commands
(with-tramp-connection-property (tramp-get-process vec) prop
(tramp-find-inline-encoding vec)
(tramp-get-connection-property (tramp-get-process vec) prop)))
- (prop1 (if (tramp-compat-string-search "encoding" prop)
+ (prop1 (if (string-search "encoding" prop)
"inline-compress" "inline-decompress"))
compress)
;; The connection property might have been cached. So we must
;; send the script to the remote side - maybe.
- (when (and coding (symbolp coding)
- (tramp-compat-string-search "remote" prop))
+ (when (and coding (symbolp coding) (string-search "remote" prop))
(let ((name (symbol-name coding)))
(while (string-match "-" name)
(setq name (replace-match "_" nil t name)))
;; Return the value.
(cond
((and compress (symbolp coding))
- (if (tramp-compat-string-search "decompress" prop1)
+ (if (string-search "decompress" prop1)
`(lambda (beg end)
(,coding beg end)
(let ((coding-system-for-write 'binary)
(,coding (point-min) (point-max)))))
((symbolp coding)
coding)
- ((and compress (tramp-compat-string-search "decoding" prop))
+ ((and compress (string-search "decoding" prop))
(format
;; Windows shells need the program file name after
;; the pipe symbol be quoted if they use forward
;; slashes as directory separators.
(cond
- ((and (tramp-compat-string-search "local" prop)
- (eq system-type 'windows-nt))
- "(%s | \"%s\")")
- ((tramp-compat-string-search "local" prop) "(%s | %s)")
+ ((and (string-search "local" prop) (eq system-type 'windows-nt))
+ "(%s | \"%s\")")
+ ((string-search "local" prop) "(%s | %s)")
(t "(%s | %s >%%s)"))
coding compress))
(compress
;; Windows shells need the program file name after
;; the pipe symbol be quoted if they use forward
;; slashes as directory separators.
- (if (and (tramp-compat-string-search "local" prop)
- (eq system-type 'windows-nt))
+ (if (and (string-search "local" prop) (eq system-type 'windows-nt))
"(%s <%%s | \"%s\")"
"(%s <%%s | %s)")
compress coding))
- ((tramp-compat-string-search "decoding" prop)
+ ((string-search "decoding" prop)
(cond
- ((tramp-compat-string-search "local" prop) (format "%s" coding))
+ ((string-search "local" prop) (format "%s" coding))
(t (format "%s >%%s" coding))))
(t
(format "%s <%%s" coding)))))))
(let* ((share (tramp-smb-get-share v))
(localname (file-name-as-directory
- (tramp-compat-string-replace
+ (string-replace
"\\" "/" (tramp-smb-get-localname v))))
(tmpdir (tramp-compat-make-temp-name))
(args (list (concat "//" host "/" share) "-E"))
;; Handle KEEP-DATE argument.
(when keep-date
- (tramp-compat-set-file-times
+ (set-file-times
newname
(file-attribute-modification-time (file-attributes dirname))
(unless ok-if-already-exists 'nofollow)))
;; KEEP-DATE handling.
(when keep-date
- (tramp-compat-set-file-times
+ (set-file-times
newname
(file-attribute-modification-time (file-attributes filename))
(unless ok-if-already-exists 'nofollow)))))
(setq name "."))
;; Unless NAME is absolute, concat DIR and NAME.
(unless (file-name-absolute-p name)
- (setq name (tramp-compat-file-name-concat dir name)))
+ (setq name (file-name-concat dir name)))
;; If NAME is not a Tramp file, run the real handler.
(if (not (tramp-tramp-file-p name))
(tramp-run-real-handler #'expand-file-name (list name))
(with-tramp-file-property v localname "file-acl"
(when (tramp-smb-remote-acl-p v)
(let* ((share (tramp-smb-get-share v))
- (localname (tramp-compat-string-replace
+ (localname (string-replace
"\\" "/" (tramp-smb-get-localname v)))
(args (list (concat "//" host "/" share) "-E"))
(options tramp-smb-options))
;; Check result.
(when entry
- (list (and (tramp-compat-string-search "d" (nth 1 entry))
- t) ;0 file type
+ (list (and (string-search "d" (nth 1 entry)) t) ;0 file type
-1 ;1 link count
(cons
tramp-unknown-id-string tramp-unknown-id-integer) ;2 uid
(mapcar
(lambda (x)
(list
- (if (tramp-compat-string-search "d" (nth 1 x))
+ (if (string-search "d" (nth 1 x))
(file-name-as-directory (nth 0 x))
(nth 0 x))))
(tramp-smb-get-file-entries directory))))))))
(defun tramp-smb-handle-file-writable-p (filename)
"Like `file-writable-p' for Tramp files."
(if (file-exists-p filename)
- (tramp-compat-string-search
+ (string-search
"w" (or (file-attribute-modes (file-attributes filename)) ""))
(let ((dir (file-name-directory filename)))
(and (file-exists-p dir)
(sort
entries
(lambda (x y)
- (if (tramp-compat-string-search "t" switches)
+ (if (string-search "t" switches)
;; Sort by date.
(time-less-p (nth 3 y) (nth 3 x))
;; Sort by name.
(string-lessp (nth 0 x) (nth 0 y))))))
;; Handle "-F" switch.
- (when (tramp-compat-string-search "F" switches)
+ (when (string-search "F" switches)
(mapc
(lambda (x)
(unless (string-empty-p (car x))
(expand-file-name
(nth 0 x) (file-name-directory filename))
'string)))))
- (when (tramp-compat-string-search "l" switches)
+ (when (string-search "l" switches)
(insert
(format
"%10s %3d %-8s %-8s %8s %s "
(put-text-property start (point) 'dired-filename t))
;; Insert symlink.
- (when (and (tramp-compat-string-search "l" switches)
+ (when (and (string-search "l" switches)
(stringp (file-attribute-type attr)))
(insert " -> " (file-attribute-type attr))))
(when (and (stringp acl-string) (tramp-smb-remote-acl-p v))
(let* ((share (tramp-smb-get-share v))
- (localname (tramp-compat-string-replace
- "\\" "/" (tramp-smb-get-localname v)))
+ (localname (string-replace "\\" "/" (tramp-smb-get-localname v)))
(args (list (concat "//" host "/" share) "-E" "-S"
- (tramp-compat-string-replace
- "\n" "," acl-string)))
+ (string-replace "\n" "," acl-string)))
(options tramp-smb-options))
(if (tramp-string-empty-or-nil-p user)
;; Save exit.
;; FIXME: Does `tramp-get-connection-buffer' return the proper value?
(with-current-buffer (tramp-get-connection-buffer v)
- (if (tramp-compat-string-search tramp-temp-buffer-name (buffer-name))
+ (if (string-search tramp-temp-buffer-name (buffer-name))
(progn
(set-process-buffer (tramp-get-connection-process v) nil)
(kill-buffer (current-buffer)))
mode (or (match-string 1 line) "")
mode (format
"%s%s"
- (if (tramp-compat-string-search "D" mode) "d" "-")
+ (if (string-search "D" mode) "d" "-")
(mapconcat
(lambda (_x) "") " "
- (format
- "r%sx"
- (if (tramp-compat-string-search "R" mode) "-" "w"))))
+ (format "r%sx" (if (string-search "R" mode) "-" "w"))))
line (substring line 0 -6))
(cl-return))
"Like `set-file-modes' for Tramp files."
(unless (and (eq flag 'nofollow) (file-symlink-p filename))
(tramp-skeleton-set-file-modes-times-uid-gid filename
- (tramp-compat-set-file-modes
- (tramp-fuse-local-file-name filename) mode flag))))
+ (set-file-modes (tramp-fuse-local-file-name filename) mode flag))))
(defun tramp-sshfs-handle-set-file-times (filename &optional timestamp flag)
"Like `set-file-times' for Tramp files."
(unless (and (eq flag 'nofollow) (file-symlink-p filename))
(tramp-skeleton-set-file-modes-times-uid-gid filename
- (tramp-compat-set-file-times
- (tramp-fuse-local-file-name filename) timestamp flag))))
+ (set-file-times (tramp-fuse-local-file-name filename) timestamp flag))))
(defun tramp-sshfs-handle-write-region
(start end filename &optional append visit lockname mustbenew)
;; Set the time and mode. Mask possible errors.
(when keep-date
(ignore-errors
- (tramp-compat-set-file-times
+ (set-file-times
newname file-times (unless ok-if-already-exists 'nofollow))
(set-file-modes newname file-modes)))
(setq name "."))
;; Unless NAME is absolute, concat DIR and NAME.
(unless (file-name-absolute-p name)
- (setq name (tramp-compat-file-name-concat dir name)))
+ (setq name (file-name-concat dir name)))
;; If NAME is not a Tramp file, run the real handler.
(if (not (tramp-tramp-file-p name))
(tramp-run-real-handler #'expand-file-name (list name))
`tramp-default-host-alist' and `tramp-default-host'."
(declare (tramp-suppress-trace t))
(let ((result
- (or (and (tramp-compat-length> host 0) host)
+ (or (and (length> host 0) host)
(let ((choices tramp-default-host-alist)
lhost item)
(while choices
lhost)
tramp-default-host)))
;; We must mark, whether a default value has been used.
- (if (or (tramp-compat-length> host 0) (null result))
+ (if (or (length> host 0) (null result))
result
(propertize result 'tramp-default t))))
(setq v (tramp-dissect-hop-name hop)
hop (and hop (tramp-make-tramp-hop-name v))))
(let ((tramp-default-host
- (or (and v (not (tramp-compat-string-search
- "%h" (tramp-file-name-host v)))
+ (or (and v (not (string-search "%h" (tramp-file-name-host v)))
(tramp-file-name-host v))
tramp-default-host)))
(setq method (tramp-find-method method user host)
"Report progress of an operation for Tramp."
(let* ((parameters (cdr reporter))
(message (aref parameters 3)))
- (when (tramp-compat-string-search message (or (current-message) ""))
+ (when (string-search message (or (current-message) ""))
(progress-reporter-update reporter value suffix))))
;;;###tramp-autoload
symbolic link. If the file modes of FILENAME cannot be
determined, return the value of `default-file-modes', without
execute permissions."
- (or (tramp-compat-file-modes filename flag)
+ (or (file-modes filename flag)
(logand (default-file-modes) #o0666)))
(defun tramp-replace-environment-variables (filename)
(defun tramp-completion-handle-file-name-nondirectory (filename)
"Like `file-name-nondirectory' for partial Tramp files."
- (tramp-compat-string-replace (file-name-directory filename) "" filename))
+ (string-replace (file-name-directory filename) "" filename))
(defun tramp-parse-default-user-host (method)
"Return a list of (user host) tuples allowed to access for METHOD.
(if (and delete-by-moving-to-trash ,trash)
;; Move non-empty dir to trash only if recursive deletion was
;; requested.
- (if (not (or ,recursive (tramp-compat-directory-empty-p ,directory)))
+ (if (not (or ,recursive (directory-empty-p ,directory)))
(tramp-error
v 'file-error "Directory is not empty, not moving to trash")
(move-file-to-trash ,directory))
;; Otherwise, remove any trailing slash from localname component.
;; Method, host, etc, are unchanged.
(while (with-parsed-tramp-file-name directory nil
- (and (tramp-compat-length> localname 0)
+ (and (length> localname 0)
(eq (aref localname (1- (length localname))) ?/)
(not (string= localname "/"))))
(setq directory (substring directory 0 -1)))
(lambda (x)
(cons x (file-attributes
(if full x (expand-file-name x directory)) id-format)))
- (tramp-compat-directory-files directory full match nosort count)))
+ (directory-files directory full match nosort count)))
(defun tramp-handle-dired-uncache (dir)
"Like `dired-uncache' for Tramp files."
(setq name "."))
;; Unless NAME is absolute, concat DIR and NAME.
(unless (file-name-absolute-p name)
- (setq name (tramp-compat-file-name-concat dir name)))
+ (setq name (file-name-concat dir name)))
;; If NAME is not a Tramp file, run the real handler.
(if (not (tramp-tramp-file-p name))
(tramp-run-real-handler #'expand-file-name (list name))
;; "." and ".." are never interesting as completions, and are
;; actually in the way in a directory with only one file. See
;; file_name_completion() in dired.c.
- (when (and (consp fnac)
- (tramp-compat-length= (delete "./" (delete "../" fnac)) 1))
+ (when (and (consp fnac) (length= (delete "./" (delete "../" fnac)) 1))
(setq fnac (delete "./" (delete "../" fnac))))
(or
(try-completion
(list filename switches wildcard full-directory-p))
;; `ls-lisp' always returns full listings. We must remove
;; superfluous parts.
- (unless (tramp-compat-string-search "l" switches)
+ (unless (string-search "l" switches)
(save-excursion
(goto-char (point-min))
(while (setq start
(defun tramp-get-lock-file (file)
"Read lockfile info of FILE.
Return nil when there is no lockfile."
- (when-let ((lockname (tramp-compat-make-lock-file-name file)))
+ (when-let ((lockname (make-lock-file-name file)))
(or (file-symlink-p lockname)
(and (file-readable-p lockname)
(with-temp-buffer
(match-string 2 info) (match-string 3 info)))
(throw 'dont-lock nil)))
- (when-let ((lockname (tramp-compat-make-lock-file-name file))
+ (when-let ((lockname (make-lock-file-name file))
;; USER@HOST.PID[:BOOT_TIME]
(info
(format
;; connection. See Bug#61663.
(if-let ((v (tramp-dissect-file-name file))
((process-live-p (tramp-get-process v)))
- (lockname (tramp-compat-make-lock-file-name file)))
+ (lockname (make-lock-file-name file)))
(delete-file lockname)
;; Trigger the unlock error. Be quiet if user isn't
;; interested in lock files. See Bug#70900.
(adb-file-name-handler-p (tramp-adb-file-name-p v))
(env (mapcar
(lambda (elt)
- (when (tramp-compat-string-search "=" elt) elt))
+ (when (string-search "=" elt) elt))
tramp-remote-process-environment))
;; We use as environment the difference to toplevel
;; `process-environment'.
(env (dolist (elt process-environment env)
(when (and
- (tramp-compat-string-search "=" elt)
+ (string-search "=" elt)
(not
(member
elt (default-toplevel-value 'process-environment))))
;; Command could be too long, for example due to a longish PATH.
(when (and sh-file-name-handler-p
- (tramp-compat-length>
- (string-join command) (tramp-get-remote-pipe-buf v)))
+ (length> (string-join command) (tramp-get-remote-pipe-buf v)))
(signal 'error (cons "Command too long:" command)))
(setq
null-device
(with-tramp-connection-property vec "null-device"
(let ((default-directory (tramp-make-tramp-file-name vec)))
- (tramp-compat-null-device)))))
+ (null-device)))))
;; Checklist for `tramp-unload-hook'
;; - Unload all `tramp-*' packages
;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
;; Package: tramp
-;; Version: 2.7.2-pre
-;; Package-Requires: ((emacs "27.1"))
+;; Version: 2.8.0-pre
+;; Package-Requires: ((emacs "28.1"))
;; Package-Type: multi
;; URL: https://www.gnu.org/software/tramp/
;; ./configure" to change them.
;;;###tramp-autoload
-(defconst tramp-version "2.7.2-pre"
+(defconst tramp-version "2.8.0-pre"
"This version of Tramp.")
;;;###tramp-autoload
"The repository revision of the Tramp sources.")
;; Check for Emacs version.
-(let ((x (if (not (string-version-lessp emacs-version "27.1"))
+(let ((x (if (not (string-version-lessp emacs-version "28.1"))
"ok"
- (format "Tramp 2.7.2-pre is not fit for %s"
+ (format "Tramp 2.8.0-pre is not fit for %s"
(replace-regexp-in-string "\n" "" (emacs-version))))))
(unless (string-equal "ok" x) (error "%s" x)))