aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2016-11-17 12:38:58 +0100
committerMichael Albinus2016-11-17 12:38:58 +0100
commit6653bb45d3697c9372cc77773c49f52399740b51 (patch)
tree715eab98cdd656fb49fb446f2eccaf0083f8b097
parentcf897a70b70d0f82708be52e1734aac8f68eaf12 (diff)
downloademacs-6653bb45d3697c9372cc77773c49f52399740b51.tar.gz
emacs-6653bb45d3697c9372cc77773c49f52399740b51.zip
Fix Bug#24947 (Tramp + ido)
* lisp/ido.el (ido-read-internal): Prevent eager Tramp connection. * lisp/net/tramp.el (tramp-handle-file-name-case-insensitive-p): Run remote tests only if a connection is established only. (Bug#24947)
-rw-r--r--lisp/ido.el1
-rw-r--r--lisp/net/tramp.el62
2 files changed, 34 insertions, 29 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 0e74cbc7a2d..9df89c9fb61 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1882,6 +1882,7 @@ If INITIAL is non-nil, it specifies the initial input string."
1882 ido-selected 1882 ido-selected
1883 ido-final-text 1883 ido-final-text
1884 (done nil) 1884 (done nil)
1885 (non-essential t) ;; prevent eager Tramp connection
1885 (icomplete-mode nil) ;; prevent icomplete starting up 1886 (icomplete-mode nil) ;; prevent icomplete starting up
1886 ;; Exported dynamic variables: 1887 ;; Exported dynamic variables:
1887 ido-cur-list 1888 ido-cur-list
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b0391ec7714..e9697ff2e1e 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2905,35 +2905,39 @@ User is always nil."
2905 (or ;; Maybe there is a default value. 2905 (or ;; Maybe there is a default value.
2906 (tramp-get-method-parameter v 'tramp-case-insensitive) 2906 (tramp-get-method-parameter v 'tramp-case-insensitive)
2907 2907
2908 ;; There isn't. So we must check. 2908 ;; There isn't. So we must check, in case there's a connection already.
2909 (with-tramp-connection-property v "case-insensitive" 2909 (and (tramp-connectable-p filename)
2910 ;; The idea is to compare a file with lower case letters with 2910 (with-tramp-connection-property v "case-insensitive"
2911 ;; the same file with upper case letters. 2911 ;; The idea is to compare a file with lower case letters
2912 (let ((candidate (directory-file-name filename)) 2912 ;; with the same file with upper case letters.
2913 tmpfile) 2913 (let ((candidate (directory-file-name filename))
2914 ;; Check, whether we find an existing file with lower case 2914 tmpfile)
2915 ;; letters. This avoids us to create a temporary file. 2915 ;; Check, whether we find an existing file with lower case
2916 (while (and (string-match "[a-z]" (file-remote-p candidate 'localname)) 2916 ;; letters. This avoids us to create a temporary file.
2917 (not (file-exists-p candidate))) 2917 (while (and (string-match
2918 (setq candidate 2918 "[a-z]" (file-remote-p candidate 'localname))
2919 (directory-file-name (file-name-directory candidate)))) 2919 (not (file-exists-p candidate)))
2920 ;; Nothing found, so we must use a temporary file for 2920 (setq candidate
2921 ;; comparision. `make-nearby-temp-file' is added to Emacs 2921 (directory-file-name (file-name-directory candidate))))
2922 ;; 26+ like `file-name-case-insensitive-p', so there is no 2922 ;; Nothing found, so we must use a temporary file for
2923 ;; compatibility problem calling it. 2923 ;; comparision. `make-nearby-temp-file' is added to
2924 (unless (string-match "[a-z]" (file-remote-p candidate 'localname)) 2924 ;; Emacs 26+ like `file-name-case-insensitive-p', so
2925 (setq tmpfile 2925 ;; there is no compatibility problem calling it.
2926 (let ((default-directory (file-name-directory filename))) 2926 (unless
2927 (tramp-compat-funcall 'make-nearby-temp-file "tramp.")) 2927 (string-match "[a-z]" (file-remote-p candidate 'localname))
2928 candidate tmpfile)) 2928 (setq tmpfile
2929 ;; Check for the existence of the same file with upper case letters. 2929 (let ((default-directory (file-name-directory filename)))
2930 (unwind-protect 2930 (tramp-compat-funcall 'make-nearby-temp-file "tramp."))
2931 (file-exists-p 2931 candidate tmpfile))
2932 (concat 2932 ;; Check for the existence of the same file with upper
2933 (file-remote-p candidate) 2933 ;; case letters.
2934 (upcase (file-remote-p candidate 'localname)))) 2934 (unwind-protect
2935 ;; Cleanup. 2935 (file-exists-p
2936 (when tmpfile (delete-file tmpfile)))))))) 2936 (concat
2937 (file-remote-p candidate)
2938 (upcase (file-remote-p candidate 'localname))))
2939 ;; Cleanup.
2940 (when tmpfile (delete-file tmpfile)))))))))
2937 2941
2938(defun tramp-handle-file-name-completion 2942(defun tramp-handle-file-name-completion
2939 (filename directory &optional predicate) 2943 (filename directory &optional predicate)