1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00
emacs/lisp/net/tramp-rclone.el

449 lines
18 KiB
EmacsLisp
Raw Permalink Normal View History

;;; tramp-rclone.el --- Tramp access functions to cloud storages -*- lexical-binding:t -*-
2024-01-02 01:47:10 +00:00
;; Copyright (C) 2018-2024 Free Software Foundation, Inc.
;; Author: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
;; Package: tramp
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; rclone is a command line program to sync files and directories to
;; and from cloud storages. Tramp uses its mount utility to access
;; files and directories there. The configuration of rclone for
;; different storage systems is performed outside Tramp, see rclone(1).
;; A remote file under rclone control has the form
;; "/rclone:<remote>:/path/to/file". <remote> is the name of a
;; storage system in rclone's configuration. Therefore, such a remote
Refactor some Tramp functions * lisp/net/tramp-compat.el (tramp-compat-file-local-name): New defsubst. (tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote) (tramp-compat-file-name-unquote): * lisp/net/tramp.el (tramp-handle-file-name-case-insensitive-p) (tramp-handle-file-truename, tramp-get-remote-tmpdir): * lisp/net/tramp-adb.el (tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file, tramp-adb-handle-exec-path): * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly) (tramp-sh-handle-exec-path, tramp-find-inline-encoding) (tramp-get-remote-touch): Use it. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Use `tramp-handle-expand-file-name'. (tramp-adb-handle-expand-file-name): Move to tramp.el. (tramp-adb-handle-file-writable-p): Adapt docstring. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Use `tramp-handle-file-local-copy', `tramp-handle-file-writable-p' and `tramp-handle-write-region'. (tramp-gvfs-handle-file-local-copy) (tramp-gvfs-handle-file-writable-p) (tramp-gvfs-handle-write-region): Move to tramp.el. * lisp/net/tramp-rclone.el: Dont't require `tramp-adb' and `tramp-gvfs' anymore. (tramp-rclone-file-name-handler-alist): Use `tramp-handle-expand-file-name', `tramp-handle-file-local-copy', `tramp-handle-file-writable-p' and `tramp-handle-write-region'. (tramp-rclone-handle-directory-files): Simplify. * lisp/net/tramp.el (tramp-methods): Extend docstring. (tramp-parse-netrc): Require `netrc'. (tramp-handle-expand-file-name, tramp-handle-file-local-copy) (tramp-handle-file-writable-p, tramp-handle-write-region): New defuns.
2018-12-07 16:21:03 +00:00
;; file name does not know of any user or port specification.
;;; Code:
(require 'tramp)
Add Tramp sshfs method * doc/misc/tramp.texi (Top, Configuration): Insert sections 'FUSE-based methods' and 'FUSE setup' in menu. (Quick Start Guide): Fix @anchors. Add doas. Extend section 'Using @command{rclone}' to 'Using @acronym{FUSE}-based methods'. (External methods): Remove rclone paragraph. (FUSE-based methods, FUSE setup): New nodes. (Predefined connection information): Mention "mount-point". * etc/NEWS: Mention Tramp sshfs method. Fix typos and other oddities. * lisp/net/tramp-fuse.el: New file. * lisp/net/tramp-rclone.el (tramp-fuse): Require. (tramp-rclone-file-name-handler-alist): Replace `tramp-rclone-handle-*' by `tramp-fuse-handle-*' where appropriate. (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file) (tramp-rclone-handle-directory-files) (tramp-rclone-handle-file-attributes) (tramp-rclone-handle-file-executable-p) (tramp-rclone-handle-file-name-all-completions) (tramp-rclone-handle-file-readable-p) (tramp-rclone-handle-insert-directory) (tramp-rclone-handle-insert-file-contents) (tramp-rclone-handle-make-directory, tramp-rclone-mount-point) (tramp-rclone-mounted-p, tramp-rclone-local-file-name): Remove. Functionality moved to tramp-fuse.el. (tramp-rclone-remote-file-name) (tramp-rclone-maybe-open-connection): Use `tramp-fuse-*' functions. * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Simplify check. * lisp/net/tramp-sshfs.el: New file. * lisp/net/tramp.el: Remove TODO item. * test/lisp/net/tramp-tests.el (tramp--test-sshfs-p): New defun. (tramp-test14-delete-directory): Use it.
2021-03-08 11:05:29 +00:00
(require 'tramp-fuse)
;;;###tramp-autoload
(defconst tramp-rclone-method "rclone"
"When this method name is used, forward all calls to rclone mounts.")
(defcustom tramp-rclone-program "rclone"
"Name of the rclone program."
:group 'tramp
:version "27.1"
Add convenience to Tramp * doc/misc/tramp.texi (Inline methods): Add tramp-docker-program, tramp-podman-program, tramp-kubernetes-program, tramp-toolbox-program, tramp-distrobox-program, tramp-flatpak-program, tramp-apptainer-program, and tramp-nspawn-program. (Remote shell setup): Rearrange indices. (Ssh setup): Say "user option" when needed. (Keeping files encrypted): Add tramp-crypt-encfs-program. (Frequently Asked Questions): Rearrange indices. Remove duplicate text. Add tramp-mode. * lisp/net/tramp.el (tramp-active-command-completion-p): New defun. * lisp/net/tramp-cmds.el (tramp-cleanup-connection) (tramp-cleanup-all-connections, tramp-cleanup-some-buffers) (tramp-cleanup-all-buffers, tramp-rename-files): * lisp/net/tramp-message.el (tramp-setup-debug-buffer): Declare `completion'. * lisp/net/tramp-integration.el (tramp-info-link): New widget. (tramp-widget-info-link-action): New defun. * lisp/net/tramp.el (tramp, tramp-mode, tramp-backup-directory-alist) (tramp-auto-save-directory, tramp-encoding-shell) (tramp-encoding-command-switch) (tramp-encoding-command-interactive, tramp-default-method) (tramp-default-method-alist, tramp-default-user) (tramp-default-user-alist, tramp-default-host) (tramp-default-host-alist, tramp-default-proxies-alist) (tramp-save-ad-hoc-proxies, tramp-show-ad-hoc-proxies) (tramp-restricted-shell-hosts-alist, tramp-local-host-regexp) (tramp-shell-prompt-pattern, tramp-password-prompt-regexp) (tramp-otp-password-prompt-regexp, tramp-wrong-passwd-regexp) (tramp-terminal-type, tramp-syntax) (tramp-ignored-file-name-regexp, tramp-chunksize) (tramp-process-connection-type, tramp-remote-path) (tramp-remote-process-environment) (tramp-completion-multi-hop-methods) (tramp-completion-use-auth-sources, tramp-use-file-attributes) (tramp-inhibit-errors-if-setting-file-attributes-fail) (tramp-allow-unsafe-temporary-files): * lisp/net/tramp-adb.el (tramp-adb-program) (tramp-adb-connect-if-not-connected): * lisp/net/tramp-cache.el (tramp-connection-properties) (tramp-persistency-file-name, tramp-completion-use-cache): * lisp/net/tramp-cmds.el (tramp-cleanup-some-buffers-hook) (tramp-default-rename-alist, tramp-confirm-rename-file-names) (tramp-file-name-with-method): * lisp/net/tramp-container.el (tramp-docker-program) (tramp-podman-program, tramp-kubernetes-program) (tramp-kubernetes-context, tramp-kubernetes-namespace) (tramp-toolbox-program, tramp-distrobox-program) (tramp-flatpak-program, tramp-apptainer-program) (tramp-nspawn-program): * lisp/net/tramp-crypt.el (tramp-crypt-encfs-program) (tramp-crypt-encfsctl-program, tramp-crypt-encfs-option) (tramp-crypt-save-encfs-config-remote): * lisp/net/tramp-fuse.el (tramp-fuse-unmount-on-cleanup): * lisp/net/tramp-gvfs.el (tramp-gvfs-methods): * lisp/net/tramp-message.el (tramp-verbose, tramp-debug-to-file) (tramp-debug-command-messages): * lisp/net/tramp-rclone.el (tramp-rclone-program): * lisp/net/tramp-sh.el (tramp-inline-compress-start-size) (tramp-copy-size-limit, tramp-histfile-override) (tramp-use-connection-share) (tramp-use-scp-direct-remote-copying, tramp-sh-extra-args): * lisp/net/tramp-sshfs.el (tramp-sshfs-program): Add `:link' key. * lisp/net/tramp.el (tramp-enable-method): Move function ... * lisp/net/tramp-cmds.el (tramp-enable-method): ... here.
2024-08-26 16:48:53 +00:00
:type 'string
:link '(info-link :tag "Tramp manual" "(tramp) Setup of rclone method"))
;;;###tramp-autoload
* lisp/net/tramp: Rework mutual dependencies Functionally split tramp-loaddefs.el into two parts: one part run while loading it at the very beginning of loading tramp.el (holding plain autoloads and declarations), and another run at the very end of loading tramp.el (holding setup code). This should reduce infinite-recursion problems while loading. * lisp/net/tramp.el: Require tramp-loaddefs at beginning. Run (new and internal) tramp--startup-hook at the end. Remove all tramp-autoloads. Prefer tramp--with-startup over eval-after-load. (tramp--with-startup): New macro. (tramp-set-syntax): Show the new value rather than the old value in the error message. (tramp-syntax-values): Explicitly return 'values'. (tramp-prefix-format, tramp-prefix-regexp, tramp-method-regexp) (tramp-postfix-method-format, tramp-postfix-method-regexp) (tramp-prefix-ipv6-format, tramp-prefix-ipv6-regexp) (tramp-postfix-ipv6-format, tramp-postfix-ipv6-regexp) (tramp-postfix-host-format, tramp-postfix-host-regexp) (tramp-remote-file-name-spec-regexp, tramp-file-name-structure) (tramp-completion-file-name-regexp): Don't initialize in the declaration, since it's recomputed at the end anyway. (tramp-time-dont-know, tramp-time-doesnt-exist): Move before first use. * lisp/net/tramp-compat.el: Don't require tramp-loaddefs any more. (tramp-compat-tramp-syntax): Declare tramp-syntax. * lisp/net/tramp-smb.el: * lisp/net/tramp-rclone.el: * lisp/net/tramp-gvfs.el: * lisp/net/tramp-ftp.el: * lisp/net/tramp-adb.el: Wrap all autoloaded setup operations within tramp--with-startup. * lisp/net/tramp-sh.el: Wrap all autoloaded setup operations within tramp--with-startup. (tramp-display-escape-sequence-regexp) (tramp-device-escape-sequence-regexp): Don't tramp-autoload any more. (tramp-stat-marker): Use eval-and-compile rather than tramp-autoload. * lisp/net/tramp-sudoedit.el: Wrap all autoloaded setup operations within tramp--with-startup. Require tramp-sh at compile-time to precompute some regexps based on tramp-stat-marker.
2018-12-16 15:32:53 +00:00
(tramp--with-startup
(add-to-list 'tramp-methods
`(,tramp-rclone-method
;; Be careful changing "--dir-cache-time", this could
;; delay visibility of files. Since we use Tramp's
;; internal cache for file attributes, there shouldn't
;; be serious performance penalties when set to 0.
(tramp-mount-args
("--no-unicode-normalization" "--dir-cache-time" "0s"))
(tramp-copyto-args nil)
(tramp-moveto-args nil)
(tramp-about-args ("--full"))))
(add-to-list 'tramp-default-host-alist `(,tramp-rclone-method nil ""))
Reduce autoloaded objects in Tramp * lisp/net/tramp-adb.el (tramp-adb-program) (tramp-adb-connect-if-not-connected, tramp-adb-prompt): Remove autoload cookie. * lisp/net/tramp-cache.el (tramp-connection-properties) (tramp-persistency-file-name): Remove autoload cookie. * lisp/net/tramp-ftp.el (tramp-ftp-enable-ange-ftp): Use `tramp-autoload' cookie. * lisp/net/tramp-gvfs.el (tramp-gvfs-zeroconf-domain): Remove autoload cookie. * lisp/net/tramp-rclone.el (tramp-rclone-program): Remove autoload cookie. (tramp-set-completion-function): Use `tramp--with-startup'. * lisp/net/tramp-sh.el (tramp-inline-compress-start-size) (tramp-copy-size-limit, tramp-histfile-override) (tramp-use-ssh-controlmaster-options, tramp-remote-path) (tramp-remote-process-environment, tramp-sh-extra-args): Remove autoload cookie. (tramp-stat-marker, tramp-stat-quoted-marker): Move to tramp.el. * lisp/net/tramp-smb.el (tramp-smb-program) (tramp-smb-acl-program, tramp-smb-conf) (tramp-smb-winexe-program, tramp-smb-winexe-shell-command) (tramp-smb-winexe-shell-command-switch): Remove autoload cookie. * lisp/net/tramp-sudoedit.el (server, tramp-sh): Do not require. * lisp/net/tramp.el (tramp--startup-hook): Define. (tramp-stat-marker, tramp-stat-quoted-marker): New defconsts, taken from tramp-sh.el. * test/lisp/net/tramp-archive-tests.el (tramp-copy-size-limit) (tramp-persistency-file-name): Declare. * test/lisp/net/tramp-tests.el (tramp-connection-properties) (tramp-display-escape-sequence-regexp) (tramp-inline-compress-start-size, tramp-remote-path): Declare.
2018-12-17 10:50:06 +00:00
(tramp-set-completion-function
tramp-rclone-method '((tramp-rclone-parse-device-names ""))))
;; New handlers should be added here.
;;;###tramp-autoload
(defconst tramp-rclone-file-name-handler-alist
'(;; `abbreviate-file-name' performed by default handler.
(access-file . tramp-handle-access-file)
(add-name-to-file . tramp-handle-add-name-to-file)
;; `byte-compiler-base-file-name' performed by default handler.
(copy-directory . tramp-handle-copy-directory)
(copy-file . tramp-rclone-handle-copy-file)
Add Tramp sshfs method * doc/misc/tramp.texi (Top, Configuration): Insert sections 'FUSE-based methods' and 'FUSE setup' in menu. (Quick Start Guide): Fix @anchors. Add doas. Extend section 'Using @command{rclone}' to 'Using @acronym{FUSE}-based methods'. (External methods): Remove rclone paragraph. (FUSE-based methods, FUSE setup): New nodes. (Predefined connection information): Mention "mount-point". * etc/NEWS: Mention Tramp sshfs method. Fix typos and other oddities. * lisp/net/tramp-fuse.el: New file. * lisp/net/tramp-rclone.el (tramp-fuse): Require. (tramp-rclone-file-name-handler-alist): Replace `tramp-rclone-handle-*' by `tramp-fuse-handle-*' where appropriate. (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file) (tramp-rclone-handle-directory-files) (tramp-rclone-handle-file-attributes) (tramp-rclone-handle-file-executable-p) (tramp-rclone-handle-file-name-all-completions) (tramp-rclone-handle-file-readable-p) (tramp-rclone-handle-insert-directory) (tramp-rclone-handle-insert-file-contents) (tramp-rclone-handle-make-directory, tramp-rclone-mount-point) (tramp-rclone-mounted-p, tramp-rclone-local-file-name): Remove. Functionality moved to tramp-fuse.el. (tramp-rclone-remote-file-name) (tramp-rclone-maybe-open-connection): Use `tramp-fuse-*' functions. * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Simplify check. * lisp/net/tramp-sshfs.el: New file. * lisp/net/tramp.el: Remove TODO item. * test/lisp/net/tramp-tests.el (tramp--test-sshfs-p): New defun. (tramp-test14-delete-directory): Use it.
2021-03-08 11:05:29 +00:00
(delete-directory . tramp-fuse-handle-delete-directory)
(delete-file . tramp-fuse-handle-delete-file)
;; `diff-latest-backup-file' performed by default handler.
(directory-file-name . tramp-handle-directory-file-name)
Add Tramp sshfs method * doc/misc/tramp.texi (Top, Configuration): Insert sections 'FUSE-based methods' and 'FUSE setup' in menu. (Quick Start Guide): Fix @anchors. Add doas. Extend section 'Using @command{rclone}' to 'Using @acronym{FUSE}-based methods'. (External methods): Remove rclone paragraph. (FUSE-based methods, FUSE setup): New nodes. (Predefined connection information): Mention "mount-point". * etc/NEWS: Mention Tramp sshfs method. Fix typos and other oddities. * lisp/net/tramp-fuse.el: New file. * lisp/net/tramp-rclone.el (tramp-fuse): Require. (tramp-rclone-file-name-handler-alist): Replace `tramp-rclone-handle-*' by `tramp-fuse-handle-*' where appropriate. (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file) (tramp-rclone-handle-directory-files) (tramp-rclone-handle-file-attributes) (tramp-rclone-handle-file-executable-p) (tramp-rclone-handle-file-name-all-completions) (tramp-rclone-handle-file-readable-p) (tramp-rclone-handle-insert-directory) (tramp-rclone-handle-insert-file-contents) (tramp-rclone-handle-make-directory, tramp-rclone-mount-point) (tramp-rclone-mounted-p, tramp-rclone-local-file-name): Remove. Functionality moved to tramp-fuse.el. (tramp-rclone-remote-file-name) (tramp-rclone-maybe-open-connection): Use `tramp-fuse-*' functions. * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Simplify check. * lisp/net/tramp-sshfs.el: New file. * lisp/net/tramp.el: Remove TODO item. * test/lisp/net/tramp-tests.el (tramp--test-sshfs-p): New defun. (tramp-test14-delete-directory): Use it.
2021-03-08 11:05:29 +00:00
(directory-files . tramp-fuse-handle-directory-files)
(directory-files-and-attributes
. tramp-handle-directory-files-and-attributes)
(dired-compress-file . ignore)
(dired-uncache . tramp-handle-dired-uncache)
(exec-path . ignore)
Refactor some Tramp functions * lisp/net/tramp-compat.el (tramp-compat-file-local-name): New defsubst. (tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote) (tramp-compat-file-name-unquote): * lisp/net/tramp.el (tramp-handle-file-name-case-insensitive-p) (tramp-handle-file-truename, tramp-get-remote-tmpdir): * lisp/net/tramp-adb.el (tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file, tramp-adb-handle-exec-path): * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly) (tramp-sh-handle-exec-path, tramp-find-inline-encoding) (tramp-get-remote-touch): Use it. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Use `tramp-handle-expand-file-name'. (tramp-adb-handle-expand-file-name): Move to tramp.el. (tramp-adb-handle-file-writable-p): Adapt docstring. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Use `tramp-handle-file-local-copy', `tramp-handle-file-writable-p' and `tramp-handle-write-region'. (tramp-gvfs-handle-file-local-copy) (tramp-gvfs-handle-file-writable-p) (tramp-gvfs-handle-write-region): Move to tramp.el. * lisp/net/tramp-rclone.el: Dont't require `tramp-adb' and `tramp-gvfs' anymore. (tramp-rclone-file-name-handler-alist): Use `tramp-handle-expand-file-name', `tramp-handle-file-local-copy', `tramp-handle-file-writable-p' and `tramp-handle-write-region'. (tramp-rclone-handle-directory-files): Simplify. * lisp/net/tramp.el (tramp-methods): Extend docstring. (tramp-parse-netrc): Require `netrc'. (tramp-handle-expand-file-name, tramp-handle-file-local-copy) (tramp-handle-file-writable-p, tramp-handle-write-region): New defuns.
2018-12-07 16:21:03 +00:00
(expand-file-name . tramp-handle-expand-file-name)
(file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
(file-acl . ignore)
Add Tramp sshfs method * doc/misc/tramp.texi (Top, Configuration): Insert sections 'FUSE-based methods' and 'FUSE setup' in menu. (Quick Start Guide): Fix @anchors. Add doas. Extend section 'Using @command{rclone}' to 'Using @acronym{FUSE}-based methods'. (External methods): Remove rclone paragraph. (FUSE-based methods, FUSE setup): New nodes. (Predefined connection information): Mention "mount-point". * etc/NEWS: Mention Tramp sshfs method. Fix typos and other oddities. * lisp/net/tramp-fuse.el: New file. * lisp/net/tramp-rclone.el (tramp-fuse): Require. (tramp-rclone-file-name-handler-alist): Replace `tramp-rclone-handle-*' by `tramp-fuse-handle-*' where appropriate. (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file) (tramp-rclone-handle-directory-files) (tramp-rclone-handle-file-attributes) (tramp-rclone-handle-file-executable-p) (tramp-rclone-handle-file-name-all-completions) (tramp-rclone-handle-file-readable-p) (tramp-rclone-handle-insert-directory) (tramp-rclone-handle-insert-file-contents) (tramp-rclone-handle-make-directory, tramp-rclone-mount-point) (tramp-rclone-mounted-p, tramp-rclone-local-file-name): Remove. Functionality moved to tramp-fuse.el. (tramp-rclone-remote-file-name) (tramp-rclone-maybe-open-connection): Use `tramp-fuse-*' functions. * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Simplify check. * lisp/net/tramp-sshfs.el: New file. * lisp/net/tramp.el: Remove TODO item. * test/lisp/net/tramp-tests.el (tramp--test-sshfs-p): New defun. (tramp-test14-delete-directory): Use it.
2021-03-08 11:05:29 +00:00
(file-attributes . tramp-fuse-handle-file-attributes)
(file-directory-p . tramp-handle-file-directory-p)
(file-equal-p . tramp-handle-file-equal-p)
Add Tramp sshfs method * doc/misc/tramp.texi (Top, Configuration): Insert sections 'FUSE-based methods' and 'FUSE setup' in menu. (Quick Start Guide): Fix @anchors. Add doas. Extend section 'Using @command{rclone}' to 'Using @acronym{FUSE}-based methods'. (External methods): Remove rclone paragraph. (FUSE-based methods, FUSE setup): New nodes. (Predefined connection information): Mention "mount-point". * etc/NEWS: Mention Tramp sshfs method. Fix typos and other oddities. * lisp/net/tramp-fuse.el: New file. * lisp/net/tramp-rclone.el (tramp-fuse): Require. (tramp-rclone-file-name-handler-alist): Replace `tramp-rclone-handle-*' by `tramp-fuse-handle-*' where appropriate. (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file) (tramp-rclone-handle-directory-files) (tramp-rclone-handle-file-attributes) (tramp-rclone-handle-file-executable-p) (tramp-rclone-handle-file-name-all-completions) (tramp-rclone-handle-file-readable-p) (tramp-rclone-handle-insert-directory) (tramp-rclone-handle-insert-file-contents) (tramp-rclone-handle-make-directory, tramp-rclone-mount-point) (tramp-rclone-mounted-p, tramp-rclone-local-file-name): Remove. Functionality moved to tramp-fuse.el. (tramp-rclone-remote-file-name) (tramp-rclone-maybe-open-connection): Use `tramp-fuse-*' functions. * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Simplify check. * lisp/net/tramp-sshfs.el: New file. * lisp/net/tramp.el: Remove TODO item. * test/lisp/net/tramp-tests.el (tramp--test-sshfs-p): New defun. (tramp-test14-delete-directory): Use it.
2021-03-08 11:05:29 +00:00
(file-executable-p . tramp-fuse-handle-file-executable-p)
(file-exists-p . tramp-handle-file-exists-p)
(file-group-gid . tramp-handle-file-group-gid)
(file-in-directory-p . tramp-handle-file-in-directory-p)
Refactor some Tramp functions * lisp/net/tramp-compat.el (tramp-compat-file-local-name): New defsubst. (tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote) (tramp-compat-file-name-unquote): * lisp/net/tramp.el (tramp-handle-file-name-case-insensitive-p) (tramp-handle-file-truename, tramp-get-remote-tmpdir): * lisp/net/tramp-adb.el (tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file, tramp-adb-handle-exec-path): * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly) (tramp-sh-handle-exec-path, tramp-find-inline-encoding) (tramp-get-remote-touch): Use it. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Use `tramp-handle-expand-file-name'. (tramp-adb-handle-expand-file-name): Move to tramp.el. (tramp-adb-handle-file-writable-p): Adapt docstring. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Use `tramp-handle-file-local-copy', `tramp-handle-file-writable-p' and `tramp-handle-write-region'. (tramp-gvfs-handle-file-local-copy) (tramp-gvfs-handle-file-writable-p) (tramp-gvfs-handle-write-region): Move to tramp.el. * lisp/net/tramp-rclone.el: Dont't require `tramp-adb' and `tramp-gvfs' anymore. (tramp-rclone-file-name-handler-alist): Use `tramp-handle-expand-file-name', `tramp-handle-file-local-copy', `tramp-handle-file-writable-p' and `tramp-handle-write-region'. (tramp-rclone-handle-directory-files): Simplify. * lisp/net/tramp.el (tramp-methods): Extend docstring. (tramp-parse-netrc): Require `netrc'. (tramp-handle-expand-file-name, tramp-handle-file-local-copy) (tramp-handle-file-writable-p, tramp-handle-write-region): New defuns.
2018-12-07 16:21:03 +00:00
(file-local-copy . tramp-handle-file-local-copy)
Implement file locks for remote files (Bug#49261) * doc/lispref/files.texi (Magic File Names): Add file-locked-p, lock-file and unlock-file. * etc/NEWS: Tramp supports file locks now. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-adb-handle-write-region): Handle LOCKNAME. * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-crypt-handle-file-locked-p, tramp-crypt-handle-lock-file) (tramp-crypt-handle-unlock-file): New defun. * lisp/net/tramp-fuse.el (tramp-fuse-mounted-p): Simplify. (tramp-fuse-unmount): New defun. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-gvfs-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-rclone-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-sh-handle-write-region): Handle LOCKNAME. * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-smb-handle-copy-directory): Use `sleep-for'. (tramp-smb-handle-write-region): Handle LOCKNAME. * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-sshfs-handle-write-region): Handle LOCKNAME. (tramp-sshfs-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-sudoedit-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp.el (tramp-file-name-for-operation): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-make-lock-name, tramp-get-lock-file, tramp-get-lock-pid) (tramp-handle-file-locked-p, tramp-handle-lock-file) (tramp-handle-unlock-file): New defuns. (tramp-lock-file-contents-regexp): New regexp. (tramp-handle-write-region): Handle LOCKNAME. * src/filelock.c (lock_file, unlock_file_body, Ffile_locked_p): Call handler if exists. (Flock_file, Funlock_file): New defuns. (Qlock_file, Qunlock_file, Qfile_locked_p): Declare symbols. (Slock_file, Sunlock_file): Declare subroutines. * test/lisp/net/tramp-archive-tests.el (tramp-archive-test40-make-nearby-temp-file) (tramp-archive-test43-file-system-info): Rename. * test/lisp/net/tramp-tests.el (top): Set `create-lockfiles' to nil. (tramp--test-fuse-p): New defun. (tramp-test14-delete-directory): Use it. (tramp-test39-lock-file): New test. (tramp-test40-make-nearby-temp-file) (tramp-test41-special-characters) (tramp-test41-special-characters-with-stat) (tramp-test41-special-characters-with-perl) (tramp-test41-special-characters-with-ls, tramp-test42-utf8) (tramp-test42-utf8-with-stat, tramp-test42-utf8-with-perl) (tramp-test42-utf8-with-ls, tramp-test43-file-system-info) (tramp-test44-asynchronous-requests, tramp-test45-auto-load) (tramp-test45-delay-load, tramp-test45-recursive-load) (tramp-test45-remote-load-path, tramp-test46-unload): Rename. (tramp--test-special-characters, tramp--test-utf8) (tramp--test-asynchronous-requests-timeout): Modify docstring.
2021-07-07 16:36:53 +00:00
(file-locked-p . tramp-handle-file-locked-p)
(file-modes . tramp-handle-file-modes)
Add Tramp sshfs method * doc/misc/tramp.texi (Top, Configuration): Insert sections 'FUSE-based methods' and 'FUSE setup' in menu. (Quick Start Guide): Fix @anchors. Add doas. Extend section 'Using @command{rclone}' to 'Using @acronym{FUSE}-based methods'. (External methods): Remove rclone paragraph. (FUSE-based methods, FUSE setup): New nodes. (Predefined connection information): Mention "mount-point". * etc/NEWS: Mention Tramp sshfs method. Fix typos and other oddities. * lisp/net/tramp-fuse.el: New file. * lisp/net/tramp-rclone.el (tramp-fuse): Require. (tramp-rclone-file-name-handler-alist): Replace `tramp-rclone-handle-*' by `tramp-fuse-handle-*' where appropriate. (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file) (tramp-rclone-handle-directory-files) (tramp-rclone-handle-file-attributes) (tramp-rclone-handle-file-executable-p) (tramp-rclone-handle-file-name-all-completions) (tramp-rclone-handle-file-readable-p) (tramp-rclone-handle-insert-directory) (tramp-rclone-handle-insert-file-contents) (tramp-rclone-handle-make-directory, tramp-rclone-mount-point) (tramp-rclone-mounted-p, tramp-rclone-local-file-name): Remove. Functionality moved to tramp-fuse.el. (tramp-rclone-remote-file-name) (tramp-rclone-maybe-open-connection): Use `tramp-fuse-*' functions. * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Simplify check. * lisp/net/tramp-sshfs.el: New file. * lisp/net/tramp.el: Remove TODO item. * test/lisp/net/tramp-tests.el (tramp--test-sshfs-p): New defun. (tramp-test14-delete-directory): Use it.
2021-03-08 11:05:29 +00:00
(file-name-all-completions . tramp-fuse-handle-file-name-all-completions)
(file-name-as-directory . tramp-handle-file-name-as-directory)
(file-name-case-insensitive-p . tramp-handle-file-name-case-insensitive-p)
(file-name-completion . tramp-handle-file-name-completion)
(file-name-directory . tramp-handle-file-name-directory)
(file-name-nondirectory . tramp-handle-file-name-nondirectory)
;; `file-name-sans-versions' performed by default handler.
(file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
(file-notify-add-watch . tramp-handle-file-notify-add-watch)
(file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
(file-notify-valid-p . tramp-handle-file-notify-valid-p)
(file-ownership-preserved-p . ignore)
Remove Emacs 25 compatibility from Tramp * doc/misc/tramp.texi (Remote programs, Remote processes) (Frequently Asked Questions): Adapt Emacs versions. * doc/misc/trampver.texi: * lisp/net/trampver.el: Change version to "2.6.0-pre". * lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for connection-local functions. * lisp/net/tramp-compat.el (tramp-unload-file-name-handlers) (tramp-handle-temporary-file-directory) (tramp-compat-temporary-file-directory-function) (tramp-compat-file-attribute-type) (tramp-compat-file-attribute-link-number) (tramp-compat-file-attribute-user-id) (tramp-compat-file-attribute-group-id) (tramp-compat-file-attribute-access-time) (tramp-compat-file-attribute-modification-time) (tramp-compat-file-attribute-status-change-time) (tramp-compat-file-attribute-size) (tramp-compat-file-attribute-modes, tramp-file-missing) (tramp-compat-file-missing, tramp-compat-file-local-name): Remove. (tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote) (tramp-compat-file-name-unquote) (tramp-compat-progress-reporter-update) (tramp-compat-file-modes, tramp-compat-set-file-modes) (tramp-compat-set-file-times, tramp-compat-directory-files) (tramp-compat-directory-files-and-attributes): Adapt implementation. * lisp/net/tramp.el: * lisp/net/tramp-adb.el: * lisp/net/tramp-archive.el: * lisp/net/tramp-crypt.el: * lisp/net/tramp-fuse.el: * lisp/net/tramp-gvfs.el: * lisp/net/tramp-rclone.el: * lisp/net/tramp-sh.el: * lisp/net/tramp-smb.el: * lisp/net/tramp-sudoedit.el: Adapt callees. * lisp/net/tramp-crypt.el (tramp-crypt-config-file-name): Expand file name. * lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove. * lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version. (tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'. * lisp/net/tramp-integration.el (rfn-eshadow-overlay): Remove declaration. (top): Don't use `tramp-compat-funcall' for connection-local functions. * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): Use `tramp-rclone-handle-file-readable-p'. (tramp-rclone-handle-file-readable-p): New defun. * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): Use `tramp-handle-file-readable-p'. * lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax): Adapt docstring. (tramp-set-connection-local-variables) (tramp-set-connection-local-variables-for-buffer): Don't use `tramp-compat-funcall' for connection-local functions. (tramp-file-name-for-operation): Reorder list. (tramp-handle-make-symbolic-link): Don't handle TARGET and OK-IF-ALREADY-EXISTS. (tramp-read-passwd): Don't use `read-passwd' any longer. (top): Don't check for `interrupt-process-functions'. * test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p): Remove. (tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'. (all): Replace Emacs 26 compatibility functions with their original name. (tramp-archive-test46-auto-load) (tramp-archive-test46-delay-load): Rename. * test/lisp/net/tramp-tests.el (dired-aux, seq): Require them. (dired-compress, connection-local-criteria-alist) (connection-local-profile-alist, async-shell-command-width): Don't declare. (all): Replace Emacs 26 compatibility functions with their original name. (tramp-test04-substitute-in-file-name) (tramp-test10-write-region, tramp-test11-copy-file) (tramp-test12-rename-file, tramp-test15-copy-directory) (tramp-test17-insert-directory) (tramp-test17-dired-with-wildcards, tramp-test21-file-links) (tramp-test31-interrupt-process) (tramp-test34-connection-local-variables) (tramp-test34-explicit-shell-file-name) (tramp-test40-make-nearby-temp-file) (tramp-test41-special-characters, tramp-test42-utf8) (tramp-test46-delay-load, tramp-test46-remote-load-path) (tramp-test47-unload): Don't check for Emacs 26 special features. (tramp--test-emacs26-p): Remove. (tramp--test-emacs29-p): New defun. (tramp-test45-dired-compress-file) (tramp-test45-dired-compress-dir): Use it. (tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 17:17:32 +00:00
(file-readable-p . tramp-rclone-handle-file-readable-p)
(file-regular-p . tramp-handle-file-regular-p)
(file-remote-p . tramp-handle-file-remote-p)
(file-selinux-context . tramp-handle-file-selinux-context)
(file-symlink-p . tramp-handle-file-symlink-p)
(file-system-info . tramp-rclone-handle-file-system-info)
(file-truename . tramp-handle-file-truename)
Add 'file-user-uid' to get the connection-local effective UID In particular, this lets Eshell show a "#" root prompt sigil when the user has sudo'ed via "cd /sudo::" (bug#60722). * lisp/simple.el (file-user-uid): New function. * lisp/net/tramp.el (tramp-file-name-for-operation): Add 'file-user-uid'. (tramp-handle-file-user-uid): New function. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add 'file-user-uid'. * lisp/net/tramp-archive.el (tramp-archive-handle-file-user-uid): New function... (tramp-archive-file-name-handler-alist): ... use it. * lisp/eshell/em-prompt.el (eshell-prompt-function): Use 'file-user-uid'. * lisp/eshell/esh-var.el (eshell-variable-aliases-list): Add '$UID'. * test/lisp/eshell/esh-var-tests.el (esh-var-test/uid-var): New test. * doc/lispref/os.texi (User Identification): Document 'file-user-uid'. * doc/lispref/files.texi (Magic File Names): Mention 'file-user-uid'. * doc/misc/eshell.texi (Variables): Document '$UID'. Add a missing index entry for '$INSIDE_EMACS'. * etc/NEWS: Announce 'file-user-uid'.
2023-01-10 23:35:18 +00:00
(file-user-uid . tramp-handle-file-user-uid)
Refactor some Tramp functions * lisp/net/tramp-compat.el (tramp-compat-file-local-name): New defsubst. (tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote) (tramp-compat-file-name-unquote): * lisp/net/tramp.el (tramp-handle-file-name-case-insensitive-p) (tramp-handle-file-truename, tramp-get-remote-tmpdir): * lisp/net/tramp-adb.el (tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file, tramp-adb-handle-exec-path): * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly) (tramp-sh-handle-exec-path, tramp-find-inline-encoding) (tramp-get-remote-touch): Use it. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Use `tramp-handle-expand-file-name'. (tramp-adb-handle-expand-file-name): Move to tramp.el. (tramp-adb-handle-file-writable-p): Adapt docstring. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Use `tramp-handle-file-local-copy', `tramp-handle-file-writable-p' and `tramp-handle-write-region'. (tramp-gvfs-handle-file-local-copy) (tramp-gvfs-handle-file-writable-p) (tramp-gvfs-handle-write-region): Move to tramp.el. * lisp/net/tramp-rclone.el: Dont't require `tramp-adb' and `tramp-gvfs' anymore. (tramp-rclone-file-name-handler-alist): Use `tramp-handle-expand-file-name', `tramp-handle-file-local-copy', `tramp-handle-file-writable-p' and `tramp-handle-write-region'. (tramp-rclone-handle-directory-files): Simplify. * lisp/net/tramp.el (tramp-methods): Extend docstring. (tramp-parse-netrc): Require `netrc'. (tramp-handle-expand-file-name, tramp-handle-file-local-copy) (tramp-handle-file-writable-p, tramp-handle-write-region): New defuns.
2018-12-07 16:21:03 +00:00
(file-writable-p . tramp-handle-file-writable-p)
(find-backup-file-name . tramp-handle-find-backup-file-name)
;; `get-file-buffer' performed by default handler.
(insert-directory . tramp-handle-insert-directory)
(insert-file-contents . tramp-handle-insert-file-contents)
Handle remote system processes * doc/lispref/files.texi (Magic File Names): Add list-system-processes and process-attributes. * doc/lispref/processes.texi (System Processes): Document changes in list-system-processes and process-attributes. * doc/misc/tramp.texi (Customizing Completion): Use @ftable. (Remote processes): Document changes in list-system-processes and process-attributes. * etc/NEWS: Document changes in proced, list-system-processes and process-attributes. * lisp/proced.el (proced-show-remote-processes): New defcustom. (proced-remote-directory): Remove. (proced-filter-alist): Use it. (proced-user-name): New defun. (proced-available): Set it to t. (proced-mode): Adapt docstring. (proced): Adapt docstring. Acknowledge prefix argument. (proced-format): Change initialization of `standard-attributes'. (proced-send-signal, proced-renice): Adapt docstring. Remove special handling of prefix argument. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add 'list-system-processes' and `process-attributes'. * lisp/net/tramp-integration.el (files-x): Require `files-x'. (tramp-bsd-process-attributes-ps-args) (tramp-bsd-process-attributes-ps-format) (tramp-connection-local-bsd-ps-variables) (tramp-busybox-process-attributes-ps-args) (tramp-busybox-process-attributes-ps-format) (tramp-connection-local-busybox-ps-variables): * lisp/net/tramp-adb.el (tramp-adb-connection-local-default-ps-variables): New defconsts. Add them to connection-local variables. * lisp/net/tramp.el (tramp-file-name-for-operation): Add 'list-system-processes' and `process-attributes'. (tramp-process-attributes-ps-args) (tramp-process-attributes-ps-format): New defconsts. (tramp-ps-time, tramp-get-process-attributes) (tramp-handle-list-system-processes) (tramp-handle-process-attributes): New defuns. * src/process.c (Flist_system_processes, Fprocess_attributes): Support remote system processes. (Qlist_system_processes, Qprocess_attributes): Declare symbols.
2022-04-05 15:08:03 +00:00
(list-system-processes . ignore)
(load . tramp-handle-load)
Implement file locks for remote files (Bug#49261) * doc/lispref/files.texi (Magic File Names): Add file-locked-p, lock-file and unlock-file. * etc/NEWS: Tramp supports file locks now. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-adb-handle-write-region): Handle LOCKNAME. * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-crypt-handle-file-locked-p, tramp-crypt-handle-lock-file) (tramp-crypt-handle-unlock-file): New defun. * lisp/net/tramp-fuse.el (tramp-fuse-mounted-p): Simplify. (tramp-fuse-unmount): New defun. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-gvfs-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-rclone-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-sh-handle-write-region): Handle LOCKNAME. * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-smb-handle-copy-directory): Use `sleep-for'. (tramp-smb-handle-write-region): Handle LOCKNAME. * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-sshfs-handle-write-region): Handle LOCKNAME. (tramp-sshfs-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-sudoedit-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp.el (tramp-file-name-for-operation): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-make-lock-name, tramp-get-lock-file, tramp-get-lock-pid) (tramp-handle-file-locked-p, tramp-handle-lock-file) (tramp-handle-unlock-file): New defuns. (tramp-lock-file-contents-regexp): New regexp. (tramp-handle-write-region): Handle LOCKNAME. * src/filelock.c (lock_file, unlock_file_body, Ffile_locked_p): Call handler if exists. (Flock_file, Funlock_file): New defuns. (Qlock_file, Qunlock_file, Qfile_locked_p): Declare symbols. (Slock_file, Sunlock_file): Declare subroutines. * test/lisp/net/tramp-archive-tests.el (tramp-archive-test40-make-nearby-temp-file) (tramp-archive-test43-file-system-info): Rename. * test/lisp/net/tramp-tests.el (top): Set `create-lockfiles' to nil. (tramp--test-fuse-p): New defun. (tramp-test14-delete-directory): Use it. (tramp-test39-lock-file): New test. (tramp-test40-make-nearby-temp-file) (tramp-test41-special-characters) (tramp-test41-special-characters-with-stat) (tramp-test41-special-characters-with-perl) (tramp-test41-special-characters-with-ls, tramp-test42-utf8) (tramp-test42-utf8-with-stat, tramp-test42-utf8-with-perl) (tramp-test42-utf8-with-ls, tramp-test43-file-system-info) (tramp-test44-asynchronous-requests, tramp-test45-auto-load) (tramp-test45-delay-load, tramp-test45-recursive-load) (tramp-test45-remote-load-path, tramp-test46-unload): Rename. (tramp--test-special-characters, tramp--test-utf8) (tramp--test-asynchronous-requests-timeout): Modify docstring.
2021-07-07 16:36:53 +00:00
(lock-file . tramp-handle-lock-file)
(make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
Add Tramp sshfs method * doc/misc/tramp.texi (Top, Configuration): Insert sections 'FUSE-based methods' and 'FUSE setup' in menu. (Quick Start Guide): Fix @anchors. Add doas. Extend section 'Using @command{rclone}' to 'Using @acronym{FUSE}-based methods'. (External methods): Remove rclone paragraph. (FUSE-based methods, FUSE setup): New nodes. (Predefined connection information): Mention "mount-point". * etc/NEWS: Mention Tramp sshfs method. Fix typos and other oddities. * lisp/net/tramp-fuse.el: New file. * lisp/net/tramp-rclone.el (tramp-fuse): Require. (tramp-rclone-file-name-handler-alist): Replace `tramp-rclone-handle-*' by `tramp-fuse-handle-*' where appropriate. (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file) (tramp-rclone-handle-directory-files) (tramp-rclone-handle-file-attributes) (tramp-rclone-handle-file-executable-p) (tramp-rclone-handle-file-name-all-completions) (tramp-rclone-handle-file-readable-p) (tramp-rclone-handle-insert-directory) (tramp-rclone-handle-insert-file-contents) (tramp-rclone-handle-make-directory, tramp-rclone-mount-point) (tramp-rclone-mounted-p, tramp-rclone-local-file-name): Remove. Functionality moved to tramp-fuse.el. (tramp-rclone-remote-file-name) (tramp-rclone-maybe-open-connection): Use `tramp-fuse-*' functions. * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Simplify check. * lisp/net/tramp-sshfs.el: New file. * lisp/net/tramp.el: Remove TODO item. * test/lisp/net/tramp-tests.el (tramp--test-sshfs-p): New defun. (tramp-test14-delete-directory): Use it.
2021-03-08 11:05:29 +00:00
(make-directory . tramp-fuse-handle-make-directory)
(make-directory-internal . ignore)
(make-lock-file-name . tramp-handle-make-lock-file-name)
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . ignore)
(make-symbolic-link . tramp-handle-make-symbolic-link)
(memory-info . ignore)
Handle remote system processes * doc/lispref/files.texi (Magic File Names): Add list-system-processes and process-attributes. * doc/lispref/processes.texi (System Processes): Document changes in list-system-processes and process-attributes. * doc/misc/tramp.texi (Customizing Completion): Use @ftable. (Remote processes): Document changes in list-system-processes and process-attributes. * etc/NEWS: Document changes in proced, list-system-processes and process-attributes. * lisp/proced.el (proced-show-remote-processes): New defcustom. (proced-remote-directory): Remove. (proced-filter-alist): Use it. (proced-user-name): New defun. (proced-available): Set it to t. (proced-mode): Adapt docstring. (proced): Adapt docstring. Acknowledge prefix argument. (proced-format): Change initialization of `standard-attributes'. (proced-send-signal, proced-renice): Adapt docstring. Remove special handling of prefix argument. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add 'list-system-processes' and `process-attributes'. * lisp/net/tramp-integration.el (files-x): Require `files-x'. (tramp-bsd-process-attributes-ps-args) (tramp-bsd-process-attributes-ps-format) (tramp-connection-local-bsd-ps-variables) (tramp-busybox-process-attributes-ps-args) (tramp-busybox-process-attributes-ps-format) (tramp-connection-local-busybox-ps-variables): * lisp/net/tramp-adb.el (tramp-adb-connection-local-default-ps-variables): New defconsts. Add them to connection-local variables. * lisp/net/tramp.el (tramp-file-name-for-operation): Add 'list-system-processes' and `process-attributes'. (tramp-process-attributes-ps-args) (tramp-process-attributes-ps-format): New defconsts. (tramp-ps-time, tramp-get-process-attributes) (tramp-handle-list-system-processes) (tramp-handle-process-attributes): New defuns. * src/process.c (Flist_system_processes, Fprocess_attributes): Support remote system processes. (Qlist_system_processes, Qprocess_attributes): Declare symbols.
2022-04-05 15:08:03 +00:00
(process-attributes . ignore)
(process-file . ignore)
(rename-file . tramp-rclone-handle-rename-file)
(set-file-acl . ignore)
(set-file-modes . ignore)
(set-file-selinux-context . ignore)
(set-file-times . ignore)
(set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
(shell-command . ignore)
(start-file-process . ignore)
(substitute-in-file-name . tramp-handle-substitute-in-file-name)
(temporary-file-directory . tramp-handle-temporary-file-directory)
Rework `abbreviate-file-name' in Tramp * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): Add 'tramp-get-home-directory'. * lisp/net/tramp-compat.el (tramp-file-name-handler): Declare. (tramp-compat-exec-path): Use it. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Add 'tramp-get-home-directory'. (tramp-gvfs-handle-expand-file-name): Rewrite tilde handling. (tramp-gvfs-handle-get-home-directory): New defun. * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): Add 'tramp-get-home-directory'. (tramp-sh-handle-get-home-directory): New defun. (tramp-sh-handle-expand-file-name): Rewrite tilde handling. * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add 'tramp-get-home-directory'. (tramp-smb-handle-expand-file-name): Rewrite tilde handling. (tramp-smb-handle-get-home-directory): New defun. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add 'tramp-get-home-directory'. (tramp-sudoedit-handle-expand-file-name): Rewrite tilde handling. (tramp-sudoedit-handle-get-home-directory): New defun. * lisp/net/tramp.el (tramp-file-name-for-operation): Add `tramp-get-home-directory'. (tramp-get-home-directory): New defun. (tramp-handle-abbreviate-file-name): Use it. (tramp-set-file-uid-gid, tramp-get-remote-uid) (tramp-get-remote-gid): Use `tramp-file-name-handler'. (tramp-get-remote-null-device): Do not check for null VEC, it doesn't happen anymore. * test/lisp/net/tramp-tests.el (tramp-test05-expand-file-name-relative): Reorder checks. (tramp-test07-abbreviate-file-name): (tramp--test-ange-ftp-p): Adapt tests.
2022-03-07 12:42:30 +00:00
(tramp-get-home-directory . ignore)
Rearrange detecting remote uid and gid in Tramp * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'. * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): Add `file-ownership-preserved-p'. (tramp-crypt-add-directory): Check, that NAME is not quoted. (tramp-crypt-handle-file-ownership-preserved-p): New defun. (tramp-crypt-handle-insert-directory): Fix docstring. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'. (tramp-gvfs-handle-file-readable-p): Call `tramp-get-remote-uid'. (tramp-gvfs-handle-get-remote-uid) (tramp-gvfs-handle-get-remote-gid): Rename from `tramp-gvfs-get-remote-{uid,gid}'. Do not cache result. (tramp-gvfs-maybe-open-connection): No special handling for remote uid and gid. * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'. (tramp-sh-handle-get-remote-uid, tramp-sh-handle-get-remote-gid): Rename from `tramp-get-remote-{uid,gid}'. Do not cache result. (tramp-sh-handle-file-ownership-preserved-p): Distinguish by GROUP when caching. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'. (tramp-sudoedit-handle-get-remote-uid) (tramp-sudoedit-handle-get-remote-gid): Rename from `tramp-sudoedit-get-remote-{uid,gid}'. Do not cache result. (tramp-sudoedit-handle-set-file-uid-gid) (tramp-sudoedit-handle-write-region): Call `tramp-get-remote-uid' and `tramp-get-remote-gid'. (tramp-sudoedit-maybe-open-connection): No special handling for remote uid and gid. * lisp/net/tramp.el (tramp-file-name-for-operation): Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'. (tramp-handle-write-region, tramp-check-cached-permissions): Call `tramp-get-remote-uid' and `tramp-get-remote-gid'. (tramp-get-remote-uid, tramp-get-remote-gid): New defuns. (tramp-local-host-p): Simplify `tramp-get-remote-uid' call. * test/lisp/net/tramp-tests.el (tramp-test17-dired-with-wildcards) Skip if needed.
2020-06-14 13:31:17 +00:00
(tramp-get-remote-gid . ignore)
2022-09-06 10:33:19 +00:00
(tramp-get-remote-groups . ignore)
Rearrange detecting remote uid and gid in Tramp * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'. * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): Add `file-ownership-preserved-p'. (tramp-crypt-add-directory): Check, that NAME is not quoted. (tramp-crypt-handle-file-ownership-preserved-p): New defun. (tramp-crypt-handle-insert-directory): Fix docstring. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'. (tramp-gvfs-handle-file-readable-p): Call `tramp-get-remote-uid'. (tramp-gvfs-handle-get-remote-uid) (tramp-gvfs-handle-get-remote-gid): Rename from `tramp-gvfs-get-remote-{uid,gid}'. Do not cache result. (tramp-gvfs-maybe-open-connection): No special handling for remote uid and gid. * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'. (tramp-sh-handle-get-remote-uid, tramp-sh-handle-get-remote-gid): Rename from `tramp-get-remote-{uid,gid}'. Do not cache result. (tramp-sh-handle-file-ownership-preserved-p): Distinguish by GROUP when caching. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'. (tramp-sudoedit-handle-get-remote-uid) (tramp-sudoedit-handle-get-remote-gid): Rename from `tramp-sudoedit-get-remote-{uid,gid}'. Do not cache result. (tramp-sudoedit-handle-set-file-uid-gid) (tramp-sudoedit-handle-write-region): Call `tramp-get-remote-uid' and `tramp-get-remote-gid'. (tramp-sudoedit-maybe-open-connection): No special handling for remote uid and gid. * lisp/net/tramp.el (tramp-file-name-for-operation): Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'. (tramp-handle-write-region, tramp-check-cached-permissions): Call `tramp-get-remote-uid' and `tramp-get-remote-gid'. (tramp-get-remote-uid, tramp-get-remote-gid): New defuns. (tramp-local-host-p): Simplify `tramp-get-remote-uid' call. * test/lisp/net/tramp-tests.el (tramp-test17-dired-with-wildcards) Skip if needed.
2020-06-14 13:31:17 +00:00
(tramp-get-remote-uid . ignore)
(tramp-set-file-uid-gid . ignore)
(unhandled-file-name-directory . ignore)
Implement file locks for remote files (Bug#49261) * doc/lispref/files.texi (Magic File Names): Add file-locked-p, lock-file and unlock-file. * etc/NEWS: Tramp supports file locks now. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-adb-handle-write-region): Handle LOCKNAME. * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-crypt-handle-file-locked-p, tramp-crypt-handle-lock-file) (tramp-crypt-handle-unlock-file): New defun. * lisp/net/tramp-fuse.el (tramp-fuse-mounted-p): Simplify. (tramp-fuse-unmount): New defun. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-gvfs-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-rclone-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-sh-handle-write-region): Handle LOCKNAME. * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-smb-handle-copy-directory): Use `sleep-for'. (tramp-smb-handle-write-region): Handle LOCKNAME. * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-sshfs-handle-write-region): Handle LOCKNAME. (tramp-sshfs-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-sudoedit-maybe-open-connection): Set "lock-pid" connection property. * lisp/net/tramp.el (tramp-file-name-for-operation): Add `file-locked-p', `lock-file' and `unlock-file'. (tramp-make-lock-name, tramp-get-lock-file, tramp-get-lock-pid) (tramp-handle-file-locked-p, tramp-handle-lock-file) (tramp-handle-unlock-file): New defuns. (tramp-lock-file-contents-regexp): New regexp. (tramp-handle-write-region): Handle LOCKNAME. * src/filelock.c (lock_file, unlock_file_body, Ffile_locked_p): Call handler if exists. (Flock_file, Funlock_file): New defuns. (Qlock_file, Qunlock_file, Qfile_locked_p): Declare symbols. (Slock_file, Sunlock_file): Declare subroutines. * test/lisp/net/tramp-archive-tests.el (tramp-archive-test40-make-nearby-temp-file) (tramp-archive-test43-file-system-info): Rename. * test/lisp/net/tramp-tests.el (top): Set `create-lockfiles' to nil. (tramp--test-fuse-p): New defun. (tramp-test14-delete-directory): Use it. (tramp-test39-lock-file): New test. (tramp-test40-make-nearby-temp-file) (tramp-test41-special-characters) (tramp-test41-special-characters-with-stat) (tramp-test41-special-characters-with-perl) (tramp-test41-special-characters-with-ls, tramp-test42-utf8) (tramp-test42-utf8-with-stat, tramp-test42-utf8-with-perl) (tramp-test42-utf8-with-ls, tramp-test43-file-system-info) (tramp-test44-asynchronous-requests, tramp-test45-auto-load) (tramp-test45-delay-load, tramp-test45-recursive-load) (tramp-test45-remote-load-path, tramp-test46-unload): Rename. (tramp--test-special-characters, tramp--test-utf8) (tramp--test-asynchronous-requests-timeout): Modify docstring.
2021-07-07 16:36:53 +00:00
(unlock-file . tramp-handle-unlock-file)
(vc-registered . ignore)
(verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
Refactor some Tramp functions * lisp/net/tramp-compat.el (tramp-compat-file-local-name): New defsubst. (tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote) (tramp-compat-file-name-unquote): * lisp/net/tramp.el (tramp-handle-file-name-case-insensitive-p) (tramp-handle-file-truename, tramp-get-remote-tmpdir): * lisp/net/tramp-adb.el (tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file, tramp-adb-handle-exec-path): * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly) (tramp-sh-handle-exec-path, tramp-find-inline-encoding) (tramp-get-remote-touch): Use it. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Use `tramp-handle-expand-file-name'. (tramp-adb-handle-expand-file-name): Move to tramp.el. (tramp-adb-handle-file-writable-p): Adapt docstring. * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Use `tramp-handle-file-local-copy', `tramp-handle-file-writable-p' and `tramp-handle-write-region'. (tramp-gvfs-handle-file-local-copy) (tramp-gvfs-handle-file-writable-p) (tramp-gvfs-handle-write-region): Move to tramp.el. * lisp/net/tramp-rclone.el: Dont't require `tramp-adb' and `tramp-gvfs' anymore. (tramp-rclone-file-name-handler-alist): Use `tramp-handle-expand-file-name', `tramp-handle-file-local-copy', `tramp-handle-file-writable-p' and `tramp-handle-write-region'. (tramp-rclone-handle-directory-files): Simplify. * lisp/net/tramp.el (tramp-methods): Extend docstring. (tramp-parse-netrc): Require `netrc'. (tramp-handle-expand-file-name, tramp-handle-file-local-copy) (tramp-handle-file-writable-p, tramp-handle-write-region): New defuns.
2018-12-07 16:21:03 +00:00
(write-region . tramp-handle-write-region))
"Alist of handler functions for Tramp RCLONE method.
Operations not mentioned here will be handled by the default Emacs primitives.")
;; It must be a `defsubst' in order to push the whole code into
;; tramp-loaddefs.el. Otherwise, there would be recursive autoloading.
;;;###tramp-autoload
(defsubst tramp-rclone-file-name-p (vec-or-filename)
"Check if it's a VEC-OR-FILENAME for rclone."
(and-let* ((vec (tramp-ensure-dissected-file-name vec-or-filename))
((string= (tramp-file-name-method vec) tramp-rclone-method)))))
;;;###tramp-autoload
(defun tramp-rclone-file-name-handler (operation &rest args)
Adapt Tramp docstrings according to checkdoc * lisp/net/tramp.el (tramp-backup-directory-alist) (tramp-echoed-echo-mark-regexp, tramp-syntax-values) (tramp-lookup-syntax, tramp-build-prefix-format) (tramp-build-prefix-regexp, tramp-build-method-regexp) (tramp-build-postfix-method-format) (tramp-build-postfix-method-regexp) (tramp-build-prefix-ipv6-format, tramp-build-prefix-ipv6-regexp) (tramp-build-postfix-ipv6-format) (tramp-build-postfix-ipv6-regexp) (tramp-build-postfix-host-format) (tramp-build-postfix-host-regexp, tramp-unknown-id-string) (tramp-unknown-id-integer, tramp-build-file-name-regexp) (tramp-build-completion-file-name-regexp, tramp-chunksize) (tramp-find-method, tramp-find-user, tramp-find-host) (tramp-dissect-file-name, tramp-get-buffer) (tramp-get-connection-buffer, tramp-debug-message, tramp-error) (with-tramp-connection-property, tramp-run-real-handler) (tramp-file-name-for-operation, tramp-file-name-handler) (tramp-completion-file-name-handler) (tramp-completion-handle-file-name-completion) (tramp-completion-dissect-file-name) (tramp-completion-dissect-file-name1) (tramp-handle-file-name-as-directory) (tramp-handle-file-name-directory) (tramp-handle-file-name-nondirectory, tramp-mode-string-to-int) (tramp-file-mode-from-int): * lisp/net/tramp-adb.el (tramp-adb-file-name-p): * lisp/net/tramp-archive.el (tramp-archive-run-real-handler) (tramp-archive-file-name-handler) (tramp-archive-dissect-file-name) (with-parsed-tramp-archive-file-name) (tramp-archive-gvfs-file-name, tramp-archive-handle-access-file): * lisp/net/tramp-cmds.el (tramp-list-remote-buffers): * lisp/net/tramp-compat.el (tramp-unload-file-name-handlers) (tramp-compat-funcall, tramp-compat-tramp-file-name-slots): * lisp/net/tramp-ftp.el (tramp-ftp-file-name-handler) (tramp-ftp-file-name-p): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-p) (tramp-gvfs-file-name-handler) (tramp-gvfs-stringify-dbus-message) (tramp-gvfs-monitor-process-filter) (tramp-gvfs-handler-mounted-unmounted): * lisp/net/tramp-integration.el (tramp-rfn-eshadow-update-overlay-regexp): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-p) (tramp-rclone-file-name-handler, tramp-rclone-send-command): * lisp/net/tramp-sh.el (tramp-sh--quoting-style-options) (tramp-sh-gio-monitor-process-filter) (tramp-sh-gvfs-monitor-dir-process-filter) (tramp-sh-inotifywait-process-filter, tramp-find-executable) (tramp-set-remote-path, tramp-open-shell, tramp-find-shell) (tramp-send-command-and-check, tramp-shell-case-fold) (tramp-get-remote-path): * lisp/net/tramp-smb.el (tramp-smb-file-name-p) (tramp-smb-file-name-handler) (tramp-smb-do-file-attributes-with-stat) (tramp-smb-handle-substitute-in-file-name) (tramp-smb-get-stat-capability, tramp-smb-shell-quote-argument): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-p) (tramp-sudoedit-file-name-handler) (tramp-sudoedit-send-command-string): * test/lisp/net/tramp-archive-tests.el (tramp-archive-test-all): * test/lisp/net/tramp-tests.el (tramp--test-gvfs-p) (tramp--test-with-proper-process-name-and-buffer) (tramp-test-all): Adapt docstrings according to `checkdoc'.
2019-11-13 12:10:58 +00:00
"Invoke the rclone handler for OPERATION and ARGS.
Tramp code cleanup * lisp/net/tramp.el (tramp-signal-hook-function) (tramp-handle-access-file, tramp-handle-copy-directory) (tramp-handle-directory-files, tramp-handle-file-local-copy) (tramp-handle-insert-file-contents, tramp-handle-load): * lisp/net/tramp-adb.el (tramp-adb-handle-directory-files-and-attributes) (tramp-adb-handle-make-directory) (tramp-adb-handle-file-local-copy, tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file): * lisp/net/tramp-crypt.el (tramp-crypt-do-copy-or-rename-file) (tramp-crypt-handle-directory-files) (tramp-crypt-handle-make-directory): * lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-error) (tramp-gvfs-do-copy-or-rename-file) (tramp-gvfs-handle-make-directory): * lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file) (tramp-rclone-handle-directory-files): * lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link) (tramp-sh-handle-directory-files-and-attributes) (tramp-sh-handle-file-name-all-completions) (tramp-sh-handle-copy-directory, tramp-do-copy-or-rename-file) (tramp-sh-handle-make-directory) (tramp-sh-handle-file-local-copy) (tramp-sh-inotifywait-process-filter): * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory) (tramp-smb-handle-copy-file, tramp-smb-handle-directory-files) (tramp-smb-handle-file-local-copy) (tramp-smb-handle-make-directory, tramp-smb-handle-rename-file): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file): Unify error report. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler): Sync args with other `tramp-*-file-name-handler'. * lisp/net/tramp-compat.el (tramp-error): Declare. (tramp-compat-file-missing): New defsubst. * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): Handle volatile files. (tramp-gvfs-set-attribute): New defun. (tramp-gvfs-handle-set-file-modes) (tramp-gvfs-handle-set-file-times) (tramp-gvfs-handle-set-file-uid-gid): Use it. * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file): Use `msg-operation'. * lisp/net/tramp-smb.el (tramp-smb-handle-insert-directory): Remove superfluous `format: (tramp-smb-maybe-open-connection): Simplify loop. * lisp/net/tramp.el (tramp-handle-file-truename): Drop volume letter from symlinked files. * test/lisp/net/tramp-tests.el (tramp--test-gdrive-p): New defun. (tramp--test-nextcloud-p): Remove. (tramp-test40-special-characters-with-ls): Do not skip on MS Windows. (tramp-test41-utf8): Skip if needed.
2021-02-03 17:48:09 +00:00
First arg specifies the OPERATION, second arg is a list of
arguments to pass to the OPERATION."
(if-let* ((fn (assoc operation tramp-rclone-file-name-handler-alist)))
Reorganize Tramp's messages * doc/misc/tramp.texi (Traces and Profiles): Use proper buffer names. Add tramp-debug-command-messages. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler): * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler): Set `tramp-debug-message-fnh-function'. * lisp/net/tramp.el (tramp-file-name-handler): * lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection): * lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection): * lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection): * lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection): * lisp/net/tramp-sh.el (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection): Wrap code `with-tramp-debug-message'. * lisp/net/tramp-message.el: New file. * lisp/net/tramp.el (tramp-message): Require. (tramp-verbose, tramp-debug-to-file, tramp-debug-buffer-name) (tramp-debug-outline-regexp, tramp-debug-font-lock-keywords) (tramp-debug-outline-level) (tramp-debug-buffer-command-completion-p) (tramp-setup-debug-buffer, tramp-get-debug-buffer) (tramp-get-debug-file-name, tramp-trace-buffer-name) (tramp-trace-functions, tramp-debug-message, tramp-message) (tramp-backtrace, tramp-error, tramp-error-show-message-timeout) (tramp-error-with-buffer, tramp-user-error) (tramp-with-demoted-errors): Move to tramp-message.el. (tramp-current-connection, tramp-file-name-user-domain) (tramp-file-name-host-port): Add ;;;###tramp-autoload cookie. (tramp-inhibit-progress-reporter): Move down. (tramp-post-process-creation): Write debug message only when there is a command. * lisp/net/trampver.el (tramp-repository-branch) (tramp-repository-version): Add ;;;###tramp-autoload cookie. * test/lisp/net/tramp-tests.el (tramp--test-instrument-test-case): Don't bind `trace-buffer'.
2023-07-29 11:11:01 +00:00
(prog1 (save-match-data (apply (cdr fn) args))
(setq tramp-debug-message-fnh-function (cdr fn)))
(prog1 (tramp-run-real-handler operation args)
(setq tramp-debug-message-fnh-function operation))))
;;;###tramp-autoload
* lisp/net/tramp: Rework mutual dependencies Functionally split tramp-loaddefs.el into two parts: one part run while loading it at the very beginning of loading tramp.el (holding plain autoloads and declarations), and another run at the very end of loading tramp.el (holding setup code). This should reduce infinite-recursion problems while loading. * lisp/net/tramp.el: Require tramp-loaddefs at beginning. Run (new and internal) tramp--startup-hook at the end. Remove all tramp-autoloads. Prefer tramp--with-startup over eval-after-load. (tramp--with-startup): New macro. (tramp-set-syntax): Show the new value rather than the old value in the error message. (tramp-syntax-values): Explicitly return 'values'. (tramp-prefix-format, tramp-prefix-regexp, tramp-method-regexp) (tramp-postfix-method-format, tramp-postfix-method-regexp) (tramp-prefix-ipv6-format, tramp-prefix-ipv6-regexp) (tramp-postfix-ipv6-format, tramp-postfix-ipv6-regexp) (tramp-postfix-host-format, tramp-postfix-host-regexp) (tramp-remote-file-name-spec-regexp, tramp-file-name-structure) (tramp-completion-file-name-regexp): Don't initialize in the declaration, since it's recomputed at the end anyway. (tramp-time-dont-know, tramp-time-doesnt-exist): Move before first use. * lisp/net/tramp-compat.el: Don't require tramp-loaddefs any more. (tramp-compat-tramp-syntax): Declare tramp-syntax. * lisp/net/tramp-smb.el: * lisp/net/tramp-rclone.el: * lisp/net/tramp-gvfs.el: * lisp/net/tramp-ftp.el: * lisp/net/tramp-adb.el: Wrap all autoloaded setup operations within tramp--with-startup. * lisp/net/tramp-sh.el: Wrap all autoloaded setup operations within tramp--with-startup. (tramp-display-escape-sequence-regexp) (tramp-device-escape-sequence-regexp): Don't tramp-autoload any more. (tramp-stat-marker): Use eval-and-compile rather than tramp-autoload. * lisp/net/tramp-sudoedit.el: Wrap all autoloaded setup operations within tramp--with-startup. Require tramp-sh at compile-time to precompute some regexps based on tramp-stat-marker.
2018-12-16 15:32:53 +00:00
(tramp--with-startup
(tramp-register-foreign-file-name-handler
#'tramp-rclone-file-name-p #'tramp-rclone-file-name-handler))
;;;###tramp-autoload
(defun tramp-rclone-parse-device-names (_ignore)
"Return a list of (nil host) tuples allowed to access."
(with-tramp-connection-property nil "rclone-device-names"
(tramp-compat-seq-keep
(lambda (line)
(when (string-match (rx bol (group (+ (not blank))) ":" eol) line)
`(nil ,(match-string 1 line))))
(tramp-process-lines nil tramp-rclone-program "listremotes"))))
;; File name primitives.
(defun tramp-rclone-do-copy-or-rename-file
(op filename newname &optional ok-if-already-exists keep-date
preserve-uid-gid preserve-extended-attributes)
"Copy or rename a remote file.
OP must be `copy' or `rename' and indicates the operation to perform.
FILENAME specifies the file to copy or rename, NEWNAME is the name of
the new file (for copy) or the new name of the file (for rename).
OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already.
KEEP-DATE means to make sure that NEWNAME has the same timestamp
as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep
the uid and gid if both files are on the same host.
PRESERVE-EXTENDED-ATTRIBUTES is ignored.
This function is invoked by `tramp-rclone-handle-copy-file' and
`tramp-rclone-handle-rename-file'. It is an error if OP is neither
of `copy' and `rename'. FILENAME and NEWNAME must be absolute
file names."
Ensure, that Tramp cache works over absolute file names * lisp/net/tramp.el (tramp-skeleton-directory-files) (tramp-skeleton-directory-files-and-attributes) (tramp-skeleton-set-file-modes-times-uid-gid) (tramp-handle-add-name-to-file, tramp-handle-file-exists-p) (tramp-handle-file-readable-p, tramp-handle-file-writable-p): * lisp/net/tramp-adb.el (tramp-adb-handle-file-executable-p) (tramp-adb-handle-file-exists-p) (tramp-adb-handle-file-readable-p) (tramp-adb-handle-file-writable-p) * lisp/net/tramp-gvfs.el (tramp-gvfs-info, tramp-gvfs-handle-delete-file) (tramp-gvfs-get-directory-attributes) (tramp-gvfs-get-root-attributes) (tramp-gvfs-handle-file-executable-p): * lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link) (tramp-sh-handle-file-exists-p) (tramp-sh-handle-set-visited-file-modtime) (tramp-sh-handle-file-selinux-context) (tramp-sh-handle-set-file-selinux-context) (tramp-sh-handle-file-acl, tramp-sh-handle-file-executable-p) (tramp-sh-handle-file-readable-p) (tramp-sh-handle-file-directory-p) (tramp-sh-handle-file-writable-p) (tramp-sh-handle-file-ownership-preserved-p) (tramp-sh-handle-add-name-to-file) (tramp-sh-handle-copy-directory, tramp-sh-handle-delete-file) (tramp-sh-handle-dired-compress-file): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-add-name-to-file) (tramp-sudoedit-handle-delete-file) (tramp-sudoedit-handle-file-acl) (tramp-sudoedit-handle-file-executable-p) (tramp-sudoedit-handle-file-exists-p) (tramp-sudoedit-handle-file-readable-p) (tramp-sudoedit-handle-file-selinux-context) (tramp-sudoedit-handle-file-writable-p) (tramp-sudoedit-handle-make-symbolic-link) (tramp-sudoedit-handle-set-file-selinux-context): Use `expand-file-name'. (Bug#57572) * lisp/net/tramp-cache.el (tramp-flush-file-function): Expand `buffer-file-name'. (Bug#57676) * lisp/net/tramp.el (tramp-file-name-unify): Extend error message. * lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link): * lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link): Do not check remoteness of TARGET anymore.
2022-09-10 11:10:47 +00:00
;; FILENAME and NEWNAME are already expanded.
(unless (memq op '(copy rename))
(error "Unknown operation `%s', must be `copy' or `rename'" op))
(setq filename (file-truename filename))
(if (file-directory-p filename)
(progn
(copy-directory filename newname keep-date t)
(when (eq op 'rename) (delete-directory filename 'recursive)))
(let ((t1 (tramp-tramp-file-p filename))
(t2 (tramp-tramp-file-p newname))
(equal-remote (tramp-equal-remote filename newname))
(rclone-operation (if (eq op 'copy) "copyto" "moveto"))
(msg-operation (if (eq op 'copy) "Copying" "Renaming")))
(with-parsed-tramp-file-name (if t1 filename newname) nil
Refactor Tramp * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Use `tramp-adb-handle-get-remote-gid' and `tramp-adb-handle-get-remote-uid'. (tramp-adb-handle-file-attributes): Use `tramp-convert-file-attributes'. (tramp-do-parse-file-attributes-with-ls): Remove ID-FORMAT. (tramp-adb-handle-directory-files-and-attributes): Use `tramp-skeleton-directory-files-and-attributes'. (tramp-adb-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-adb-handle-copy-file, tramp-adb-handle-rename-file): Use `tramp-barf-if-file-missing'. (tramp-adb-handle-get-remote-uid) (tramp-adb-handle-get-remote-gid): New defuns. * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): Use `tramp-archive-handle-directory-files'. (tramp-archive-handle-directory-files): New defun. * lisp/net/tramp-cache.el (tramp-file-property-p): New defun. * lisp/net/tramp-compat.el (tramp-compat-take): New defalias. * lisp/net/tramp-crypt.el (tramp-crypt-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-crypt-handle-directory-files): Use `tramp-skeleton-directory-files'. * lisp/net/tramp-fuse.el (tramp-fuse-handle-directory-files): Use `tramp-skeleton-directory-files'. * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. * lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. * lisp/net/tramp-sh.el (tramp-readlink-file-truename) (tramp-stat-file-attributes) (tramp-stat-directory-files-and-attributes): New defconsts. (tramp-perl-file-attributes) (tramp-perl-directory-files-and-attributes): Adapt. (tramp-sh-handle-make-symbolic-link): Flush TARGET file properties. (tramp-sh-handle-file-truename): Use `tramp-readlink-file-truename' (tramp-sh-handle-file-exists-p) (tramp-sh-handle-file-executable-p) (tramp-sh-handle-file-readable-p) (tramp-sh-handle-file-directory-p) (tramp-sh-handle-file-writable-p): Adapt check of file properties. (tramp-sh-handle-file-attributes): Simplify. (tramp-do-file-attributes-with-ls): Remove ID-FORMAT. Combine two remote commands. Compute both versions of uid and gid together. (tramp-do-file-attributes-with-perl) (tramp-do-directory-files-and-attributes-with-perl): Remove ID-FORMAT. (tramp-do-file-attributes-with-stat): Remove ID-FORMAT. Use `tramp-stat-file-attributes'. (tramp-sh-handle-directory-files-and-attributes): Use `tramp-skeleton-directory-files-and-attributes'. (tramp-do-directory-files-and-attributes-with-stat): Remove ID-FORMAT. Use `tramp-stat-directory-files-and-attributes'. (tramp-sh-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-sh-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-sh-handle-write-region): Combine two remote commands. (tramp-sh-gio-monitor-process-filter): Simplify `cond' call. (tramp-expand-script): Extend for ls, readling and stat. (tramp-open-connection-setup-interactive-shell): Do not set `tramp-end-of-output'. (tramp-open-connection-setup-interactive-shell): Do not send prompt formatting command, it's superfluous. (tramp-send-command-and-check): Rearrange in order to accept also heredoc scripts. (tramp-convert-file-attributes): Move function to tramp.el. (tramp-get-remote-id): Set connection property. (tramp-get-remote-uid-with-id): Use it. (tramp-get-remote-python): Don't check for python2 anymore. * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Use `tramp-handle-directory-files'. (tramp-smb-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-smb-handle-directory-files): Remove. (tramp-smb-handle-file-attributes): Use `tramp-convert-file-attributes'. (tramp-smb-do-file-attributes-with-stat): Remove ID-FORMAT. (tramp-smb-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-sudoedit-file-attributes): New defconst. (tramp-sudoedit-handle-file-attributes): Simplify code. * lisp/net/tramp.el (tramp-setup-debug-buffer): Set debug buffer as not modified. (tramp-barf-if-file-missing, tramp-skeleton-copy-directory) (tramp-skeleton-directory-files) (tramp-skeleton-directory-files-and-attributes) (tramp-skeleton-file-local-copy): New macros. (tramp-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-handle-directory-files): Use `tramp-skeleton-directory-files'. (tramp-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-handle-insert-file-contents): Use `tramp-barf-if-file-missing'. (tramp-get-process-attributes, tramp-action-out-of-band): Simplify `cond' call. (tramp-check-cached-permissions): Simplify. (tramp-make-tramp-temp-file): Reimplement. * test/lisp/net/tramp-archive-tests.el (tramp-copy-size-limit): Don't set. * test/lisp/net/tramp-tests.el (tramp--test-enabled): Remove superfluous test files. (tramp-test21-file-links): Protect file name deletion.
2022-07-24 14:02:10 +00:00
(tramp-barf-if-file-missing v filename
(when (and (not ok-if-already-exists) (file-exists-p newname))
(tramp-error v 'file-already-exists newname))
(when (and (file-directory-p newname)
(not (directory-name-p newname)))
(tramp-error v 'file-error "File is a directory %s" newname))
(when (file-regular-p newname)
(delete-file newname))
Refactor Tramp * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Use `tramp-adb-handle-get-remote-gid' and `tramp-adb-handle-get-remote-uid'. (tramp-adb-handle-file-attributes): Use `tramp-convert-file-attributes'. (tramp-do-parse-file-attributes-with-ls): Remove ID-FORMAT. (tramp-adb-handle-directory-files-and-attributes): Use `tramp-skeleton-directory-files-and-attributes'. (tramp-adb-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-adb-handle-copy-file, tramp-adb-handle-rename-file): Use `tramp-barf-if-file-missing'. (tramp-adb-handle-get-remote-uid) (tramp-adb-handle-get-remote-gid): New defuns. * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): Use `tramp-archive-handle-directory-files'. (tramp-archive-handle-directory-files): New defun. * lisp/net/tramp-cache.el (tramp-file-property-p): New defun. * lisp/net/tramp-compat.el (tramp-compat-take): New defalias. * lisp/net/tramp-crypt.el (tramp-crypt-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-crypt-handle-directory-files): Use `tramp-skeleton-directory-files'. * lisp/net/tramp-fuse.el (tramp-fuse-handle-directory-files): Use `tramp-skeleton-directory-files'. * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. * lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. * lisp/net/tramp-sh.el (tramp-readlink-file-truename) (tramp-stat-file-attributes) (tramp-stat-directory-files-and-attributes): New defconsts. (tramp-perl-file-attributes) (tramp-perl-directory-files-and-attributes): Adapt. (tramp-sh-handle-make-symbolic-link): Flush TARGET file properties. (tramp-sh-handle-file-truename): Use `tramp-readlink-file-truename' (tramp-sh-handle-file-exists-p) (tramp-sh-handle-file-executable-p) (tramp-sh-handle-file-readable-p) (tramp-sh-handle-file-directory-p) (tramp-sh-handle-file-writable-p): Adapt check of file properties. (tramp-sh-handle-file-attributes): Simplify. (tramp-do-file-attributes-with-ls): Remove ID-FORMAT. Combine two remote commands. Compute both versions of uid and gid together. (tramp-do-file-attributes-with-perl) (tramp-do-directory-files-and-attributes-with-perl): Remove ID-FORMAT. (tramp-do-file-attributes-with-stat): Remove ID-FORMAT. Use `tramp-stat-file-attributes'. (tramp-sh-handle-directory-files-and-attributes): Use `tramp-skeleton-directory-files-and-attributes'. (tramp-do-directory-files-and-attributes-with-stat): Remove ID-FORMAT. Use `tramp-stat-directory-files-and-attributes'. (tramp-sh-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-sh-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-sh-handle-write-region): Combine two remote commands. (tramp-sh-gio-monitor-process-filter): Simplify `cond' call. (tramp-expand-script): Extend for ls, readling and stat. (tramp-open-connection-setup-interactive-shell): Do not set `tramp-end-of-output'. (tramp-open-connection-setup-interactive-shell): Do not send prompt formatting command, it's superfluous. (tramp-send-command-and-check): Rearrange in order to accept also heredoc scripts. (tramp-convert-file-attributes): Move function to tramp.el. (tramp-get-remote-id): Set connection property. (tramp-get-remote-uid-with-id): Use it. (tramp-get-remote-python): Don't check for python2 anymore. * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Use `tramp-handle-directory-files'. (tramp-smb-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-smb-handle-directory-files): Remove. (tramp-smb-handle-file-attributes): Use `tramp-convert-file-attributes'. (tramp-smb-do-file-attributes-with-stat): Remove ID-FORMAT. (tramp-smb-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-sudoedit-file-attributes): New defconst. (tramp-sudoedit-handle-file-attributes): Simplify code. * lisp/net/tramp.el (tramp-setup-debug-buffer): Set debug buffer as not modified. (tramp-barf-if-file-missing, tramp-skeleton-copy-directory) (tramp-skeleton-directory-files) (tramp-skeleton-directory-files-and-attributes) (tramp-skeleton-file-local-copy): New macros. (tramp-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-handle-directory-files): Use `tramp-skeleton-directory-files'. (tramp-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-handle-insert-file-contents): Use `tramp-barf-if-file-missing'. (tramp-get-process-attributes, tramp-action-out-of-band): Simplify `cond' call. (tramp-check-cached-permissions): Simplify. (tramp-make-tramp-temp-file): Reimplement. * test/lisp/net/tramp-archive-tests.el (tramp-copy-size-limit): Don't set. * test/lisp/net/tramp-tests.el (tramp--test-enabled): Remove superfluous test files. (tramp-test21-file-links): Protect file name deletion.
2022-07-24 14:02:10 +00:00
(if (or (and equal-remote
(tramp-get-connection-property v "direct-copy-failed"))
(and t1 (not (tramp-rclone-file-name-p filename)))
Refactor Tramp * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Use `tramp-adb-handle-get-remote-gid' and `tramp-adb-handle-get-remote-uid'. (tramp-adb-handle-file-attributes): Use `tramp-convert-file-attributes'. (tramp-do-parse-file-attributes-with-ls): Remove ID-FORMAT. (tramp-adb-handle-directory-files-and-attributes): Use `tramp-skeleton-directory-files-and-attributes'. (tramp-adb-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-adb-handle-copy-file, tramp-adb-handle-rename-file): Use `tramp-barf-if-file-missing'. (tramp-adb-handle-get-remote-uid) (tramp-adb-handle-get-remote-gid): New defuns. * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): Use `tramp-archive-handle-directory-files'. (tramp-archive-handle-directory-files): New defun. * lisp/net/tramp-cache.el (tramp-file-property-p): New defun. * lisp/net/tramp-compat.el (tramp-compat-take): New defalias. * lisp/net/tramp-crypt.el (tramp-crypt-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-crypt-handle-directory-files): Use `tramp-skeleton-directory-files'. * lisp/net/tramp-fuse.el (tramp-fuse-handle-directory-files): Use `tramp-skeleton-directory-files'. * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. * lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. * lisp/net/tramp-sh.el (tramp-readlink-file-truename) (tramp-stat-file-attributes) (tramp-stat-directory-files-and-attributes): New defconsts. (tramp-perl-file-attributes) (tramp-perl-directory-files-and-attributes): Adapt. (tramp-sh-handle-make-symbolic-link): Flush TARGET file properties. (tramp-sh-handle-file-truename): Use `tramp-readlink-file-truename' (tramp-sh-handle-file-exists-p) (tramp-sh-handle-file-executable-p) (tramp-sh-handle-file-readable-p) (tramp-sh-handle-file-directory-p) (tramp-sh-handle-file-writable-p): Adapt check of file properties. (tramp-sh-handle-file-attributes): Simplify. (tramp-do-file-attributes-with-ls): Remove ID-FORMAT. Combine two remote commands. Compute both versions of uid and gid together. (tramp-do-file-attributes-with-perl) (tramp-do-directory-files-and-attributes-with-perl): Remove ID-FORMAT. (tramp-do-file-attributes-with-stat): Remove ID-FORMAT. Use `tramp-stat-file-attributes'. (tramp-sh-handle-directory-files-and-attributes): Use `tramp-skeleton-directory-files-and-attributes'. (tramp-do-directory-files-and-attributes-with-stat): Remove ID-FORMAT. Use `tramp-stat-directory-files-and-attributes'. (tramp-sh-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-sh-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-sh-handle-write-region): Combine two remote commands. (tramp-sh-gio-monitor-process-filter): Simplify `cond' call. (tramp-expand-script): Extend for ls, readling and stat. (tramp-open-connection-setup-interactive-shell): Do not set `tramp-end-of-output'. (tramp-open-connection-setup-interactive-shell): Do not send prompt formatting command, it's superfluous. (tramp-send-command-and-check): Rearrange in order to accept also heredoc scripts. (tramp-convert-file-attributes): Move function to tramp.el. (tramp-get-remote-id): Set connection property. (tramp-get-remote-uid-with-id): Use it. (tramp-get-remote-python): Don't check for python2 anymore. * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Use `tramp-handle-directory-files'. (tramp-smb-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-smb-handle-directory-files): Remove. (tramp-smb-handle-file-attributes): Use `tramp-convert-file-attributes'. (tramp-smb-do-file-attributes-with-stat): Remove ID-FORMAT. (tramp-smb-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-sudoedit-file-attributes): New defconst. (tramp-sudoedit-handle-file-attributes): Simplify code. * lisp/net/tramp.el (tramp-setup-debug-buffer): Set debug buffer as not modified. (tramp-barf-if-file-missing, tramp-skeleton-copy-directory) (tramp-skeleton-directory-files) (tramp-skeleton-directory-files-and-attributes) (tramp-skeleton-file-local-copy): New macros. (tramp-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-handle-directory-files): Use `tramp-skeleton-directory-files'. (tramp-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-handle-insert-file-contents): Use `tramp-barf-if-file-missing'. (tramp-get-process-attributes, tramp-action-out-of-band): Simplify `cond' call. (tramp-check-cached-permissions): Simplify. (tramp-make-tramp-temp-file): Reimplement. * test/lisp/net/tramp-archive-tests.el (tramp-copy-size-limit): Don't set. * test/lisp/net/tramp-tests.el (tramp--test-enabled): Remove superfluous test files. (tramp-test21-file-links): Protect file name deletion.
2022-07-24 14:02:10 +00:00
(and t2 (not (tramp-rclone-file-name-p newname))))
;; We cannot copy or rename directly.
(let ((tmpfile (tramp-compat-make-temp-file filename)))
(if (eq op 'copy)
(copy-file
filename tmpfile t keep-date preserve-uid-gid
preserve-extended-attributes)
(rename-file filename tmpfile t))
(rename-file tmpfile newname ok-if-already-exists))
;; Direct action.
(with-tramp-progress-reporter
v 0 (format "%s %s to %s" msg-operation filename newname)
(unless (zerop
(tramp-rclone-send-command
v rclone-operation
(tramp-rclone-remote-file-name filename)
(tramp-rclone-remote-file-name newname)))
(if (or (not equal-remote)
(and equal-remote
(tramp-get-connection-property
v "direct-copy-failed")))
(tramp-error
v 'file-error
"Error %s `%s' `%s'" msg-operation filename newname)
;; Some WebDAV server, like the one from QNAP, do
;; not support direct copy/move. Try a fallback.
(tramp-set-connection-property v "direct-copy-failed" t)
(tramp-rclone-do-copy-or-rename-file
op filename newname ok-if-already-exists keep-date
preserve-uid-gid preserve-extended-attributes))))
Refactor Tramp * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Use `tramp-adb-handle-get-remote-gid' and `tramp-adb-handle-get-remote-uid'. (tramp-adb-handle-file-attributes): Use `tramp-convert-file-attributes'. (tramp-do-parse-file-attributes-with-ls): Remove ID-FORMAT. (tramp-adb-handle-directory-files-and-attributes): Use `tramp-skeleton-directory-files-and-attributes'. (tramp-adb-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-adb-handle-copy-file, tramp-adb-handle-rename-file): Use `tramp-barf-if-file-missing'. (tramp-adb-handle-get-remote-uid) (tramp-adb-handle-get-remote-gid): New defuns. * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): Use `tramp-archive-handle-directory-files'. (tramp-archive-handle-directory-files): New defun. * lisp/net/tramp-cache.el (tramp-file-property-p): New defun. * lisp/net/tramp-compat.el (tramp-compat-take): New defalias. * lisp/net/tramp-crypt.el (tramp-crypt-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-crypt-handle-directory-files): Use `tramp-skeleton-directory-files'. * lisp/net/tramp-fuse.el (tramp-fuse-handle-directory-files): Use `tramp-skeleton-directory-files'. * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. * lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. * lisp/net/tramp-sh.el (tramp-readlink-file-truename) (tramp-stat-file-attributes) (tramp-stat-directory-files-and-attributes): New defconsts. (tramp-perl-file-attributes) (tramp-perl-directory-files-and-attributes): Adapt. (tramp-sh-handle-make-symbolic-link): Flush TARGET file properties. (tramp-sh-handle-file-truename): Use `tramp-readlink-file-truename' (tramp-sh-handle-file-exists-p) (tramp-sh-handle-file-executable-p) (tramp-sh-handle-file-readable-p) (tramp-sh-handle-file-directory-p) (tramp-sh-handle-file-writable-p): Adapt check of file properties. (tramp-sh-handle-file-attributes): Simplify. (tramp-do-file-attributes-with-ls): Remove ID-FORMAT. Combine two remote commands. Compute both versions of uid and gid together. (tramp-do-file-attributes-with-perl) (tramp-do-directory-files-and-attributes-with-perl): Remove ID-FORMAT. (tramp-do-file-attributes-with-stat): Remove ID-FORMAT. Use `tramp-stat-file-attributes'. (tramp-sh-handle-directory-files-and-attributes): Use `tramp-skeleton-directory-files-and-attributes'. (tramp-do-directory-files-and-attributes-with-stat): Remove ID-FORMAT. Use `tramp-stat-directory-files-and-attributes'. (tramp-sh-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-sh-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-sh-handle-write-region): Combine two remote commands. (tramp-sh-gio-monitor-process-filter): Simplify `cond' call. (tramp-expand-script): Extend for ls, readling and stat. (tramp-open-connection-setup-interactive-shell): Do not set `tramp-end-of-output'. (tramp-open-connection-setup-interactive-shell): Do not send prompt formatting command, it's superfluous. (tramp-send-command-and-check): Rearrange in order to accept also heredoc scripts. (tramp-convert-file-attributes): Move function to tramp.el. (tramp-get-remote-id): Set connection property. (tramp-get-remote-uid-with-id): Use it. (tramp-get-remote-python): Don't check for python2 anymore. * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Use `tramp-handle-directory-files'. (tramp-smb-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-smb-handle-directory-files): Remove. (tramp-smb-handle-file-attributes): Use `tramp-convert-file-attributes'. (tramp-smb-do-file-attributes-with-stat): Remove ID-FORMAT. (tramp-smb-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file): Use `tramp-barf-if-file-missing'. (tramp-sudoedit-file-attributes): New defconst. (tramp-sudoedit-handle-file-attributes): Simplify code. * lisp/net/tramp.el (tramp-setup-debug-buffer): Set debug buffer as not modified. (tramp-barf-if-file-missing, tramp-skeleton-copy-directory) (tramp-skeleton-directory-files) (tramp-skeleton-directory-files-and-attributes) (tramp-skeleton-file-local-copy): New macros. (tramp-handle-copy-directory): Use `tramp-skeleton-copy-directory'. (tramp-handle-directory-files): Use `tramp-skeleton-directory-files'. (tramp-handle-file-local-copy): Use `tramp-skeleton-file-local-copy'. (tramp-handle-insert-file-contents): Use `tramp-barf-if-file-missing'. (tramp-get-process-attributes, tramp-action-out-of-band): Simplify `cond' call. (tramp-check-cached-permissions): Simplify. (tramp-make-tramp-temp-file): Reimplement. * test/lisp/net/tramp-archive-tests.el (tramp-copy-size-limit): Don't set. * test/lisp/net/tramp-tests.el (tramp--test-enabled): Remove superfluous test files. (tramp-test21-file-links): Protect file name deletion.
2022-07-24 14:02:10 +00:00
(when (and t1 (eq op 'rename))
(while (file-exists-p filename)
(with-parsed-tramp-file-name filename v1
(tramp-flush-file-properties v1 v1-localname))))
(when t2
(with-parsed-tramp-file-name newname v2
(tramp-flush-file-properties v2 v2-localname)))))))))
(defun tramp-rclone-handle-copy-file
(filename newname &optional ok-if-already-exists keep-date
preserve-uid-gid preserve-extended-attributes)
"Like `copy-file' for Tramp files."
2020-01-24 13:41:44 +00:00
(setq filename (expand-file-name filename)
newname (expand-file-name newname))
;; At least one file a Tramp file?
(if (or (tramp-tramp-file-p filename)
(tramp-tramp-file-p newname))
(tramp-rclone-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))))
Remove Emacs 25 compatibility from Tramp * doc/misc/tramp.texi (Remote programs, Remote processes) (Frequently Asked Questions): Adapt Emacs versions. * doc/misc/trampver.texi: * lisp/net/trampver.el: Change version to "2.6.0-pre". * lisp/net/tramp-adb.el (top): Don't use `tramp-compat-funcall' for connection-local functions. * lisp/net/tramp-compat.el (tramp-unload-file-name-handlers) (tramp-handle-temporary-file-directory) (tramp-compat-temporary-file-directory-function) (tramp-compat-file-attribute-type) (tramp-compat-file-attribute-link-number) (tramp-compat-file-attribute-user-id) (tramp-compat-file-attribute-group-id) (tramp-compat-file-attribute-access-time) (tramp-compat-file-attribute-modification-time) (tramp-compat-file-attribute-status-change-time) (tramp-compat-file-attribute-size) (tramp-compat-file-attribute-modes, tramp-file-missing) (tramp-compat-file-missing, tramp-compat-file-local-name): Remove. (tramp-compat-file-name-quoted-p, tramp-compat-file-name-quote) (tramp-compat-file-name-unquote) (tramp-compat-progress-reporter-update) (tramp-compat-file-modes, tramp-compat-set-file-modes) (tramp-compat-set-file-times, tramp-compat-directory-files) (tramp-compat-directory-files-and-attributes): Adapt implementation. * lisp/net/tramp.el: * lisp/net/tramp-adb.el: * lisp/net/tramp-archive.el: * lisp/net/tramp-crypt.el: * lisp/net/tramp-fuse.el: * lisp/net/tramp-gvfs.el: * lisp/net/tramp-rclone.el: * lisp/net/tramp-sh.el: * lisp/net/tramp-smb.el: * lisp/net/tramp-sudoedit.el: Adapt callees. * lisp/net/tramp-crypt.el (tramp-crypt-config-file-name): Expand file name. * lisp/net/tramp-fuse.el (tramp-fuse-handle-file-readable-p): Remove. * lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Don't check Emacs version. (tramp-gvfs-handler-mounted-unmounted): Use `make-tramp-file-name'. * lisp/net/tramp-integration.el (rfn-eshadow-overlay): Remove declaration. (top): Don't use `tramp-compat-funcall' for connection-local functions. * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): Use `tramp-rclone-handle-file-readable-p'. (tramp-rclone-handle-file-readable-p): New defun. * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): Use `tramp-handle-file-readable-p'. * lisp/net/tramp.el (tramp-temp-name-prefix, tramp-lookup-syntax): Adapt docstring. (tramp-set-connection-local-variables) (tramp-set-connection-local-variables-for-buffer): Don't use `tramp-compat-funcall' for connection-local functions. (tramp-file-name-for-operation): Reorder list. (tramp-handle-make-symbolic-link): Don't handle TARGET and OK-IF-ALREADY-EXISTS. (tramp-read-passwd): Don't use `read-passwd' any longer. (top): Don't check for `interrupt-process-functions'. * test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs26-p): Remove. (tramp-archive-test02-file-name-dissect): Use `make-tramp-file-name'. (all): Replace Emacs 26 compatibility functions with their original name. (tramp-archive-test46-auto-load) (tramp-archive-test46-delay-load): Rename. * test/lisp/net/tramp-tests.el (dired-aux, seq): Require them. (dired-compress, connection-local-criteria-alist) (connection-local-profile-alist, async-shell-command-width): Don't declare. (all): Replace Emacs 26 compatibility functions with their original name. (tramp-test04-substitute-in-file-name) (tramp-test10-write-region, tramp-test11-copy-file) (tramp-test12-rename-file, tramp-test15-copy-directory) (tramp-test17-insert-directory) (tramp-test17-dired-with-wildcards, tramp-test21-file-links) (tramp-test31-interrupt-process) (tramp-test34-connection-local-variables) (tramp-test34-explicit-shell-file-name) (tramp-test40-make-nearby-temp-file) (tramp-test41-special-characters, tramp-test42-utf8) (tramp-test46-delay-load, tramp-test46-remote-load-path) (tramp-test47-unload): Don't check for Emacs 26 special features. (tramp--test-emacs26-p): Remove. (tramp--test-emacs29-p): New defun. (tramp-test45-dired-compress-file) (tramp-test45-dired-compress-dir): Use it. (tramp-test44-asynchronous-requests): Use `seq-random-elt'.
2021-11-12 17:17:32 +00:00
(defun tramp-rclone-handle-file-readable-p (filename)
"Like `file-readable-p' for Tramp files."
(with-parsed-tramp-file-name (expand-file-name filename) nil
(with-tramp-file-property v localname "file-readable-p"
(file-readable-p (tramp-fuse-local-file-name filename)))))
(defun tramp-rclone-handle-file-system-info (filename)
"Like `file-system-info' for Tramp files."
(ignore-errors
(unless (file-directory-p filename)
(setq filename (file-name-directory filename)))
(with-parsed-tramp-file-name (expand-file-name filename) nil
(tramp-message v 5 "file system info: %s" localname)
(when (zerop (tramp-rclone-send-command v "about" (concat host ":")))
(with-current-buffer (tramp-get-connection-buffer v)
(let (total used free)
(goto-char (point-min))
(while (not (eobp))
(when (looking-at (rx "Total: " (+ blank) (group (+ digit))))
(setq total (string-to-number (match-string 1))))
(when (looking-at (rx "Used: " (+ blank) (group (+ digit))))
(setq used (string-to-number (match-string 1))))
(when (looking-at (rx "Free: " (+ blank) (group (+ digit))))
(setq free (string-to-number (match-string 1))))
(forward-line))
(when used
;; The used number of bytes is not part of the result.
;; As side effect, we store it as file property.
(tramp-set-file-property v localname "used-bytes" used))
;; Result.
(when (and total free)
(list total free (- total free)))))))))
(defun tramp-rclone-handle-rename-file
(filename newname &optional ok-if-already-exists)
"Like `rename-file' for Tramp files."
2020-01-24 13:41:44 +00:00
(setq filename (expand-file-name filename)
newname (expand-file-name newname))
;; At least one file a Tramp file?
(if (or (tramp-tramp-file-p filename)
(tramp-tramp-file-p newname))
(tramp-rclone-do-copy-or-rename-file
'rename filename newname ok-if-already-exists
'keep-date 'preserve-uid-gid)
(tramp-run-real-handler
#'rename-file (list filename newname ok-if-already-exists))))
;; File name conversions.
(defun tramp-rclone-remote-file-name (filename)
"Return FILENAME as used in the `rclone' command."
Remove Emacs 26 compatibility from Tramp * doc/misc/tramp.texi (Remote processes): Don't mention Emacs version. (Frequently Asked Questions): Adapt supported Emacs versions. * doc/misc/trampver.texi: * lisp/net/trampver.el: Change version to "2.7.0-pre". * lisp/net/tramp-compat.el (tramp-compat-file-name-quoted-p) (tramp-compat-file-name-quote, tramp-compat-file-name-unquote) (tramp-compat-tramp-syntax, tramp-compat-exec-path) (tramp-compat-time-equal-p, tramp-compat-flatten-tree) (tramp-compat-progress-reporter-update) (tramp-compat-ignore-error, tramp-compat-rx--transform-item) (tramp-compat-rx--transform, tramp-compat-rx): Remove. * lisp/net/tramp-adb.el: * lisp/net/tramp-archive.el: * lisp/net/tramp-cache.el: * lisp/net/tramp-cmds.el: * lisp/net/tramp-crypt.el: * lisp/net/tramp-fuse.el: * lisp/net/tramp-gvfs.el: * lisp/net/tramp-integration.el: * lisp/net/tramp-rclone.el: * lisp/net/tramp-sh.el: * lisp/net/tramp-smb.el: * lisp/net/tramp-sshfs.el: * lisp/net/tramp-sudoedit.el: * lisp/net/tramp.el: * lisp/net/trampver.el: Replace the removed `tramp-compat-*' items by their real definition. Don't use `tramp-compat-funcall' when not needed. Remove `with-no-warnings' and `ignore-errors' where appropriate. * lisp/net/tramp.el (tramp-file-name-for-operation): Rearrange list. (tramp-handle-file-newer-than-file-p): Simplify. (tramp-get-process-attributes): Don't check for existence of `connection-local-criteria-for-default-directory'. (tramp-handle-shell-command): Don't check for existence of `shell-command-save-pos-or-erase', `async-shell-command-width' and `shell-command-set-point-after-cmd'. (tramp-handle-start-file-process): Call `make-process' directly. (tramp-defined-time): New defsubst. (tramp-get-local-gid): Don't check for existence of `group-name'. * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times): Use `tramp-defined-time'. (tramp-adb-get-signal-strings): Don't bind `shell-file-name' and `shell-command-switch'. * lisp/net/tramp-archive.el (top, tramp-archive-file-name-handler): Don't bind `max-specpdl-size' any longer. (tramp-archive-autoload-file-name-regexp): Remove Emacs 26 specific code. (top): Don't call `tramp-register-archive-autoload-file-name-handler'. * lisp/net/tramp-gvfs.el (top): Don't bind `max-specpdl-size' any longer. (tramp-gvfs-handle-set-file-times): Use `tramp-defined-time'. * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-times): Use `tramp-defined-time'. * test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs27-p): Remove. (all): * test/lisp/net/tramp-tests.el (all): Don't skip for Emacs 26. Replace the removed `tramp-compat-*' items by their real definition. Don't use `tramp-compat-funcall' when not needed. Remove `with-no-warnings' and `ignore-errors' where appropriate. (with-connection-local-variables) (shell-command-dont-erase-buffer): Don't declare. (tramp-test10-write-region): Don't check for `make-empty-file'. (tramp-test32-shell-command): Simplify. (tramp-test34-explicit-shell-file-name): Don't protect `explicit-shell-file-name' any longer. (tramp--test-emacs27-p): Remove.
2023-01-06 12:34:33 +00:00
(setq filename (file-name-unquote (expand-file-name filename)))
(if (tramp-rclone-file-name-p filename)
(with-parsed-tramp-file-name filename nil
;; As long as we call `tramp-rclone-maybe-open-connection' here,
;; we cache the result.
(with-tramp-file-property v localname "remote-file-name"
(tramp-rclone-maybe-open-connection v)
;; TODO: This shall be handled by `expand-file-name'.
(setq localname
Use `rx' in Tramp where possible * lisp/net/tramp.el: * lisp/net/tramp-adb.el: * lisp/net/tramp-archive.el: * lisp/net/tramp-cache.el: * lisp/net/tramp-cmds.el: * lisp/net/tramp-compat.el: * lisp/net/tramp-crypt.el: * lisp/net/tramp-ftp.el: * lisp/net/tramp-fuse.el: * lisp/net/tramp-gvfs.el: * lisp/net/tramp-integration.el: * lisp/net/tramp-rclone.el: * lisp/net/tramp-sh.el: * lisp/net/tramp-smb.el: * lisp/net/tramp-sudoedit.el: Use `rx' where possible. * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times): Use `eval-when-compile'. (tramp-adb-maybe-open-connection): Use file-property for "/". Use `eval-when-compile'. * lisp/net/tramp-cmds.el (mm-7bit-chars): Declare. (tramp-reporter-dump-variable): Simplify point movement. * lisp/net/tramp-gvfs.el (tramp-dbus-function): Fix typo. (tramp-zeroconf-parse-device-names): Use `tramp-prefix-port-format'. * lisp/net/tramp-sh.el (tramp-open-shell, tramp-find-shell): Use `eval-when-compile'. Improve sanity check. * lisp/net/tramp.el (tramp-prefix-format, tramp-prefix-regexp) (tramp-method-regexp, tramp-postfix-method-format) (tramp-postfix-method-regexp, tramp-prefix-ipv6-format) (tramp-prefix-ipv6-regexp, tramp-postfix-ipv6-format) (tramp-postfix-ipv6-regexp, tramp-postfix-host-format) (tramp-postfix-host-regexp, tramp-remote-file-name-spec-regexp) (tramp-file-name-structure, tramp-file-name-regexp) (tramp-completion-method-regexp) (tramp-completion-file-name-regexp): Declare. (tramp-set-syntax): Set also `tramp-completion-method-regexp'. (tramp-volume-letter-regexp, tramp-completion-method-regexp-alist): New defconsts. (tramp-build-completion-method-regexp): New defun. (tramp-completion-method-regexp): New defvar. (tramp-completion-file-name-regexp-default) (tramp-completion-file-name-regexp-simplified) (tramp-completion-file-name-regexp-separate) (tramp-completion-file-name-regexp-alist): Remove. (tramp-build-completion-file-name-regexp): Rwrite. (tramp-make-tramp-file-name): Use `tramp-archive-method'. (tramp-handle-file-directory-p): Ignore errors. (tramp-handle-find-backup-file-name, tramp-handle-lock-file) (tramp-handle-make-auto-save-file-name): Use `eval-when-compile'. * test/lisp/net/tramp-archive-tests.el: * test/lisp/net/tramp-tests.el: Use `rx' where possible. (tramp-test01-file-name-syntax): Adapt test.
2022-08-26 14:19:47 +00:00
(replace-regexp-in-string (rx bol ".") "" (or localname "")))
Add Tramp sshfs method * doc/misc/tramp.texi (Top, Configuration): Insert sections 'FUSE-based methods' and 'FUSE setup' in menu. (Quick Start Guide): Fix @anchors. Add doas. Extend section 'Using @command{rclone}' to 'Using @acronym{FUSE}-based methods'. (External methods): Remove rclone paragraph. (FUSE-based methods, FUSE setup): New nodes. (Predefined connection information): Mention "mount-point". * etc/NEWS: Mention Tramp sshfs method. Fix typos and other oddities. * lisp/net/tramp-fuse.el: New file. * lisp/net/tramp-rclone.el (tramp-fuse): Require. (tramp-rclone-file-name-handler-alist): Replace `tramp-rclone-handle-*' by `tramp-fuse-handle-*' where appropriate. (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file) (tramp-rclone-handle-directory-files) (tramp-rclone-handle-file-attributes) (tramp-rclone-handle-file-executable-p) (tramp-rclone-handle-file-name-all-completions) (tramp-rclone-handle-file-readable-p) (tramp-rclone-handle-insert-directory) (tramp-rclone-handle-insert-file-contents) (tramp-rclone-handle-make-directory, tramp-rclone-mount-point) (tramp-rclone-mounted-p, tramp-rclone-local-file-name): Remove. Functionality moved to tramp-fuse.el. (tramp-rclone-remote-file-name) (tramp-rclone-maybe-open-connection): Use `tramp-fuse-*' functions. * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Simplify check. * lisp/net/tramp-sshfs.el: New file. * lisp/net/tramp.el: Remove TODO item. * test/lisp/net/tramp-tests.el (tramp--test-sshfs-p): New defun. (tramp-test14-delete-directory): Use it.
2021-03-08 11:05:29 +00:00
(format "%s%s" (tramp-fuse-mounted-p v) localname)))
;; It is a local file name.
filename))
(defun tramp-rclone-maybe-open-connection (vec)
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
;; During completion, don't reopen a new connection.
(unless (tramp-connectable-p vec)
(throw 'non-essential 'non-essential))
Reorganize Tramp's messages * doc/misc/tramp.texi (Traces and Profiles): Use proper buffer names. Add tramp-debug-command-messages. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler): * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler): Set `tramp-debug-message-fnh-function'. * lisp/net/tramp.el (tramp-file-name-handler): * lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection): * lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection): * lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection): * lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection): * lisp/net/tramp-sh.el (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection): Wrap code `with-tramp-debug-message'. * lisp/net/tramp-message.el: New file. * lisp/net/tramp.el (tramp-message): Require. (tramp-verbose, tramp-debug-to-file, tramp-debug-buffer-name) (tramp-debug-outline-regexp, tramp-debug-font-lock-keywords) (tramp-debug-outline-level) (tramp-debug-buffer-command-completion-p) (tramp-setup-debug-buffer, tramp-get-debug-buffer) (tramp-get-debug-file-name, tramp-trace-buffer-name) (tramp-trace-functions, tramp-debug-message, tramp-message) (tramp-backtrace, tramp-error, tramp-error-show-message-timeout) (tramp-error-with-buffer, tramp-user-error) (tramp-with-demoted-errors): Move to tramp-message.el. (tramp-current-connection, tramp-file-name-user-domain) (tramp-file-name-host-port): Add ;;;###tramp-autoload cookie. (tramp-inhibit-progress-reporter): Move down. (tramp-post-process-creation): Write debug message only when there is a command. * lisp/net/trampver.el (tramp-repository-branch) (tramp-repository-version): Add ;;;###tramp-autoload cookie. * test/lisp/net/tramp-tests.el (tramp--test-instrument-test-case): Don't bind `trace-buffer'.
2023-07-29 11:11:01 +00:00
(with-tramp-debug-message vec "Opening connection"
(let ((host (tramp-file-name-host vec)))
(when (rassoc `(,host) (tramp-rclone-parse-device-names nil))
(if (tramp-string-empty-or-nil-p host)
(tramp-error vec 'file-error "Storage %s not connected" host))
;; We need a process bound to the connection buffer.
;; Therefore, we create a dummy process. Maybe there is a
;; better solution?
(unless (get-buffer-process (tramp-get-connection-buffer vec))
(let ((p (make-network-process
:name (tramp-get-connection-name vec)
:buffer (tramp-get-connection-buffer vec)
:server t :host 'local :service t :noquery t)))
(tramp-post-process-creation p vec)
;; Set connection-local variables.
(tramp-set-connection-local-variables vec)))
;; Create directory.
(unless (file-directory-p (tramp-fuse-mount-point vec))
(make-directory (tramp-fuse-mount-point vec) 'parents))
;; Mount. This command does not return, so we use 0 as
;; DESTINATION of `tramp-call-process'.
(unless (tramp-fuse-mounted-p vec)
(apply
#'tramp-call-process
vec tramp-rclone-program nil 0 nil
"mount" (tramp-fuse-mount-spec vec)
(tramp-fuse-mount-point vec)
(tramp-get-method-parameter vec 'tramp-mount-args))
(while (not (file-exists-p (tramp-make-tramp-file-name vec 'noloc)))
(tramp-cleanup-connection vec 'keep-debug 'keep-password))
;; Mark it as connected.
(add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec))
(tramp-set-connection-property
(tramp-get-connection-process vec) "connected" t))))
;; In `tramp-check-cached-permissions', the connection properties
;; "{uid,gid}-{integer,string}" are used. We set them to proper values.
(with-tramp-connection-property
vec "uid-integer" (tramp-get-local-uid 'integer))
(with-tramp-connection-property
vec "gid-integer" (tramp-get-local-gid 'integer))
(with-tramp-connection-property
vec "uid-string" (tramp-get-local-uid 'string))
(with-tramp-connection-property
vec "gid-string" (tramp-get-local-gid 'string))))
(defun tramp-rclone-send-command (vec &rest args)
Adapt Tramp docstrings according to checkdoc * lisp/net/tramp.el (tramp-backup-directory-alist) (tramp-echoed-echo-mark-regexp, tramp-syntax-values) (tramp-lookup-syntax, tramp-build-prefix-format) (tramp-build-prefix-regexp, tramp-build-method-regexp) (tramp-build-postfix-method-format) (tramp-build-postfix-method-regexp) (tramp-build-prefix-ipv6-format, tramp-build-prefix-ipv6-regexp) (tramp-build-postfix-ipv6-format) (tramp-build-postfix-ipv6-regexp) (tramp-build-postfix-host-format) (tramp-build-postfix-host-regexp, tramp-unknown-id-string) (tramp-unknown-id-integer, tramp-build-file-name-regexp) (tramp-build-completion-file-name-regexp, tramp-chunksize) (tramp-find-method, tramp-find-user, tramp-find-host) (tramp-dissect-file-name, tramp-get-buffer) (tramp-get-connection-buffer, tramp-debug-message, tramp-error) (with-tramp-connection-property, tramp-run-real-handler) (tramp-file-name-for-operation, tramp-file-name-handler) (tramp-completion-file-name-handler) (tramp-completion-handle-file-name-completion) (tramp-completion-dissect-file-name) (tramp-completion-dissect-file-name1) (tramp-handle-file-name-as-directory) (tramp-handle-file-name-directory) (tramp-handle-file-name-nondirectory, tramp-mode-string-to-int) (tramp-file-mode-from-int): * lisp/net/tramp-adb.el (tramp-adb-file-name-p): * lisp/net/tramp-archive.el (tramp-archive-run-real-handler) (tramp-archive-file-name-handler) (tramp-archive-dissect-file-name) (with-parsed-tramp-archive-file-name) (tramp-archive-gvfs-file-name, tramp-archive-handle-access-file): * lisp/net/tramp-cmds.el (tramp-list-remote-buffers): * lisp/net/tramp-compat.el (tramp-unload-file-name-handlers) (tramp-compat-funcall, tramp-compat-tramp-file-name-slots): * lisp/net/tramp-ftp.el (tramp-ftp-file-name-handler) (tramp-ftp-file-name-p): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-p) (tramp-gvfs-file-name-handler) (tramp-gvfs-stringify-dbus-message) (tramp-gvfs-monitor-process-filter) (tramp-gvfs-handler-mounted-unmounted): * lisp/net/tramp-integration.el (tramp-rfn-eshadow-update-overlay-regexp): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-p) (tramp-rclone-file-name-handler, tramp-rclone-send-command): * lisp/net/tramp-sh.el (tramp-sh--quoting-style-options) (tramp-sh-gio-monitor-process-filter) (tramp-sh-gvfs-monitor-dir-process-filter) (tramp-sh-inotifywait-process-filter, tramp-find-executable) (tramp-set-remote-path, tramp-open-shell, tramp-find-shell) (tramp-send-command-and-check, tramp-shell-case-fold) (tramp-get-remote-path): * lisp/net/tramp-smb.el (tramp-smb-file-name-p) (tramp-smb-file-name-handler) (tramp-smb-do-file-attributes-with-stat) (tramp-smb-handle-substitute-in-file-name) (tramp-smb-get-stat-capability, tramp-smb-shell-quote-argument): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-p) (tramp-sudoedit-file-name-handler) (tramp-sudoedit-send-command-string): * test/lisp/net/tramp-archive-tests.el (tramp-archive-test-all): * test/lisp/net/tramp-tests.el (tramp--test-gvfs-p) (tramp--test-with-proper-process-name-and-buffer) (tramp-test-all): Adapt docstrings according to `checkdoc'.
2019-11-13 12:10:58 +00:00
"Send a command to connection VEC.
The command is the list of strings ARGS."
(with-current-buffer (tramp-get-connection-buffer vec)
(erase-buffer)
(let ((flags (tramp-get-method-parameter
vec (intern (format "tramp-%s-args" (car args))))))
(apply #'tramp-call-process
vec tramp-rclone-program nil t nil (append args flags)))))
(add-hook 'tramp-unload-hook
(lambda ()
(unload-feature 'tramp-rclone 'force)))
(provide 'tramp-rclone)
;;; tramp-rclone.el ends here