* net/tramp-sh.el (tramp-sh-handle-file-directory-p): Return t for
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 25 Oct 2011 12:50:03 +0000 (14:50 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 25 Oct 2011 12:50:03 +0000 (14:50 +0200)
filenames "/method:foo:".

lisp/ChangeLog
lisp/net/tramp-sh.el

index 32e46b2..9511300 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-25  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-sh.el (tramp-sh-handle-file-directory-p): Return t for
+       filenames "/method:foo:".
+
 2011-10-25  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * comint.el (comint-get-old-input-default): Fix use-prompt-regexp case
index 56424f7..5573219 100644 (file)
@@ -1594,17 +1594,14 @@ and gid of the corresponding user is taken.  Both parameters must be integers."
 
 (defun tramp-sh-handle-file-directory-p (filename)
   "Like `file-directory-p' for Tramp files."
-  ;; Care must be taken that this function returns `t' for symlinks
-  ;; pointing to directories.  Surely the most obvious implementation
-  ;; would be `test -d', but that returns false for such symlinks.
-  ;; CCC: Stefan Monnier says that `test -d' follows symlinks.  And
-  ;; I now think he's right.  So we could be using `test -d', couldn't
-  ;; we?
-  ;;
-  ;; Alternatives: `cd %s', `test -d %s'
   (with-parsed-tramp-file-name filename nil
-    (with-file-property v localname "file-directory-p"
-      (tramp-run-test "-d" filename))))
+    ;; `file-directory-p' is used as predicate for filename completion.
+    ;; Sometimes, when a connection is not established yet, it is
+    ;; desirable to return t immediately for "/method:foo:".  It can
+    ;; be expected that this is always a directory.
+    (or (zerop (length localname))
+       (with-file-property v localname "file-directory-p"
+         (tramp-run-test "-d" filename)))))
 
 (defun tramp-sh-handle-file-writable-p (filename)
   "Like `file-writable-p' for Tramp files."