summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2016-11-17 12:38:58 +0100
committerMichael Albinus <michael.albinus@gmx.de>2016-11-17 12:38:58 +0100
commit6653bb45d3697c9372cc77773c49f52399740b51 (patch)
tree715eab98cdd656fb49fb446f2eccaf0083f8b097
parentcf897a70b70d0f82708be52e1734aac8f68eaf12 (diff)
downloademacs-6653bb45d3697c9372cc77773c49f52399740b51.tar.gz
emacs-6653bb45d3697c9372cc77773c49f52399740b51.tar.bz2
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."
ido-selected
ido-final-text
(done nil)
+ (non-essential t) ;; prevent eager Tramp connection
(icomplete-mode nil) ;; prevent icomplete starting up
;; Exported dynamic variables:
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."
(or ;; Maybe there is a default value.
(tramp-get-method-parameter v 'tramp-case-insensitive)
- ;; There isn't. So we must check.
- (with-tramp-connection-property v "case-insensitive"
- ;; The idea is to compare a file with lower case letters with
- ;; the same file with upper case letters.
- (let ((candidate (directory-file-name filename))
- tmpfile)
- ;; Check, whether we find an existing file with lower case
- ;; letters. This avoids us to create a temporary file.
- (while (and (string-match "[a-z]" (file-remote-p candidate 'localname))
- (not (file-exists-p candidate)))
- (setq candidate
- (directory-file-name (file-name-directory candidate))))
- ;; Nothing found, so we must use a temporary file for
- ;; comparision. `make-nearby-temp-file' is added to Emacs
- ;; 26+ like `file-name-case-insensitive-p', so there is no
- ;; compatibility problem calling it.
- (unless (string-match "[a-z]" (file-remote-p candidate 'localname))
- (setq tmpfile
- (let ((default-directory (file-name-directory filename)))
- (tramp-compat-funcall 'make-nearby-temp-file "tramp."))
- candidate tmpfile))
- ;; Check for the existence of the same file with upper case letters.
- (unwind-protect
- (file-exists-p
- (concat
- (file-remote-p candidate)
- (upcase (file-remote-p candidate 'localname))))
- ;; Cleanup.
- (when tmpfile (delete-file tmpfile))))))))
+ ;; There isn't. So we must check, in case there's a connection already.
+ (and (tramp-connectable-p filename)
+ (with-tramp-connection-property v "case-insensitive"
+ ;; The idea is to compare a file with lower case letters
+ ;; with the same file with upper case letters.
+ (let ((candidate (directory-file-name filename))
+ tmpfile)
+ ;; Check, whether we find an existing file with lower case
+ ;; letters. This avoids us to create a temporary file.
+ (while (and (string-match
+ "[a-z]" (file-remote-p candidate 'localname))
+ (not (file-exists-p candidate)))
+ (setq candidate
+ (directory-file-name (file-name-directory candidate))))
+ ;; Nothing found, so we must use a temporary file for
+ ;; comparision. `make-nearby-temp-file' is added to
+ ;; Emacs 26+ like `file-name-case-insensitive-p', so
+ ;; there is no compatibility problem calling it.
+ (unless
+ (string-match "[a-z]" (file-remote-p candidate 'localname))
+ (setq tmpfile
+ (let ((default-directory (file-name-directory filename)))
+ (tramp-compat-funcall 'make-nearby-temp-file "tramp."))
+ candidate tmpfile))
+ ;; Check for the existence of the same file with upper
+ ;; case letters.
+ (unwind-protect
+ (file-exists-p
+ (concat
+ (file-remote-p candidate)
+ (upcase (file-remote-p candidate 'localname))))
+ ;; Cleanup.
+ (when tmpfile (delete-file tmpfile)))))))))
(defun tramp-handle-file-name-completion
(filename directory &optional predicate)