Minor Tramp optimization

* lisp/net/tramp.el (tramp-skeleton-file-truename)
(tramp-skeleton-write-region, tramp-handle-file-truename):
* lisp/net/tramp-integration.el (tramp-eshell-directory-change)
(tramp-recentf-exclude-predicate):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file):
Use `tramp-tramp-file-p' instead of `file-remote-p'.
This commit is contained in:
Michael Albinus 2023-11-18 14:39:16 +01:00
parent 1d0e3030ff
commit 80d0ff4612
4 changed files with 9 additions and 9 deletions

View file

@ -136,7 +136,7 @@ been set up by `rfn-eshadow-setup-minibuffer'."
;; Remove last element of `(exec-path)', which is `exec-directory'.
;; Use `path-separator' as it does eshell.
(setq eshell-path-env
(if (file-remote-p default-directory)
(if (tramp-tramp-file-p default-directory)
(string-join (butlast (exec-path)) path-separator)
(getenv "PATH"))))
@ -158,7 +158,7 @@ been set up by `rfn-eshadow-setup-minibuffer'."
(defun tramp-recentf-exclude-predicate (name)
"Predicate to exclude a remote file name from recentf.
NAME must be equal to `tramp-current-connection'."
(when (file-remote-p name)
(when (tramp-tramp-file-p name)
(tramp-file-name-equal-p
(tramp-dissect-file-name name) (car tramp-current-connection))))

View file

@ -618,7 +618,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
;; with `jka-compr-handler', so we cannot trust its result as
;; indication for a remote file name.
(if-let ((tmpfile
(and (file-remote-p filename) (file-local-copy filename))))
(and (tramp-tramp-file-p filename) (file-local-copy filename))))
;; Remote filename.
(condition-case err
(rename-file tmpfile newname ok-if-already-exists)

View file

@ -274,8 +274,8 @@ absolute file names."
(not (directory-name-p newname)))
(tramp-error v 'file-error "File is a directory %s" newname))
(if (or (and (file-remote-p filename) (not t1))
(and (file-remote-p newname) (not t2)))
(if (or (and (tramp-tramp-file-p filename) (not t1))
(and (tramp-tramp-file-p newname) (not t2)))
;; We cannot copy or rename directly.
(let ((tmpfile (tramp-compat-make-temp-file filename)))
(if (eq op 'copy)
@ -296,7 +296,7 @@ absolute file names."
;; When `newname' is local, we must change the ownership to
;; the local user.
(unless (file-remote-p newname)
(unless (tramp-tramp-file-p newname)
(tramp-set-file-uid-gid
(concat (file-remote-p filename) newname)
(tramp-get-local-uid 'integer)

View file

@ -3447,7 +3447,7 @@ BODY is the backend specific code."
"Apparent cycle of symbolic links for %s" ,filename))
;; If the resulting localname looks remote, we must quote
;; it for security reasons.
(when (file-remote-p result)
(when (tramp-tramp-file-p result)
(setq result (file-name-quote result 'top)))
result)))))))
@ -3587,7 +3587,7 @@ BODY is the backend specific code."
;; Lock file.
(when (and (not (auto-save-file-name-p
(file-name-nondirectory filename)))
(file-remote-p lockname)
(tramp-tramp-file-p lockname)
(not file-locked))
(setq file-locked t)
;; `lock-file' exists since Emacs 28.1.
@ -4117,7 +4117,7 @@ Let-bind it when necessary.")
(< numchase numchase-limit))
(setq numchase (1+ numchase)
result
(if (file-remote-p symlink-target)
(if (tramp-tramp-file-p symlink-target)
(file-name-quote symlink-target 'top)
(tramp-drop-volume-letter
(expand-file-name