From cef31747b602c423842caa50cbfee9ca804289a3 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Tue, 9 Nov 2021 19:59:14 +0100 Subject: [PATCH] Improve performance when checking case-sensitivity of Tramp file names * lisp/net/tramp-sh.el (tramp-sh-handle-expand-file-name): Dissect file name before testing for connectability to reduce duplicated work. * lisp/net/tramp.el (tramp-handle-file-name-case-insensitive-p): Use `tramp-connectable-p' to test for connection. --- lisp/net/tramp-sh.el | 10 +++++----- lisp/net/tramp.el | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 62921909406..b20e5f80732 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2705,11 +2705,11 @@ the result will be a local, non-Tramp, file name." ;; Unless NAME is absolute, concat DIR and NAME. (unless (file-name-absolute-p name) (setq name (tramp-compat-file-name-concat dir name))) - ;; If connection is not established yet, run the real handler. - (if (not (tramp-connectable-p name)) - (tramp-run-real-handler #'expand-file-name (list name nil)) - ;; Dissect NAME. - (with-parsed-tramp-file-name name nil + ;; Dissect NAME. + (with-parsed-tramp-file-name name nil + ;; If connection is not established yet, run the real handler. + (if (not (tramp-connectable-p v)) + (tramp-run-real-handler #'expand-file-name (list name nil)) (unless (tramp-run-real-handler #'file-name-absolute-p (list localname)) (setq localname (concat "~/" localname))) ;; Tilde expansion if necessary. This needs a shell which diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b152584c1f8..a8972ce69e8 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3484,7 +3484,7 @@ User is always nil." (tramp-get-method-parameter v 'tramp-case-insensitive) ;; There isn't. So we must check, in case there's a connection already. - (and (file-remote-p filename nil 'connected) + (and (let ((non-essential t)) (tramp-connectable-p v)) (with-tramp-connection-property v "case-insensitive" (ignore-errors (with-tramp-progress-reporter v 5 "Checking case-insensitive" -- 2.39.5