summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-rclone.el
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2021-11-11 19:34:17 +0100
committerMichael Albinus <michael.albinus@gmx.de>2021-11-11 19:34:17 +0100
commit6c9ac53249a1c1b05bbcc8e253f39fa8d1e319f6 (patch)
treea4e8bde5926b1986043a2fbea5752eadfe5b7e49 /lisp/net/tramp-rclone.el
parent585e2103df144664921670878fc273eee817b0ba (diff)
downloademacs-6c9ac53249a1c1b05bbcc8e253f39fa8d1e319f6.tar.gz
Improve performance of 'file-name-case-insensitive-p' for Tramp files
Previously, each function in 'tramp-foreign-file-name-handler-alist' would call 'tramp-dissect-file-name', resulting in it being called several times whenever 'tramp-find-foreign-file-name-handler' was called. Now, functions take the dissected file name to avoid this duplicated effort. (Bug#51699) * etc/NEWS: Announce this change. * lisp/net/tramp-adb.el (tramp-adb-file-name-p): * lisp/net/tramp-ftp.el (tramp-ftp-file-name-p): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-p): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-p): * lisp/net/tramp-smb.el (tramp-smb-file-name-p): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-p): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-p): Accept dissected file names. * lisp/net/tramp.el (tramp-ensure-dissected-file-name): New function. (tramp-find-foreign-file-name-handler): Pass dissected file name to functions. (tramp-connectable-p): Use 'tramp-ensure-dissected-file-name'.
Diffstat (limited to 'lisp/net/tramp-rclone.el')
-rw-r--r--lisp/net/tramp-rclone.el9
1 files changed, 4 insertions, 5 deletions
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index 812e06f3f11..64b0176d088 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -156,11 +156,10 @@ 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 (filename)
- "Check if it's a FILENAME for rclone."
- (and (tramp-tramp-file-p filename)
- (string= (tramp-file-name-method (tramp-dissect-file-name filename))
- tramp-rclone-method)))
+(defsubst tramp-rclone-file-name-p (vec-or-filename)
+ "Check if it's a VEC-OR-FILENAME for rclone."
+ (when-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)