diff lisp/files.el @ 106613:291ea018e478

* files.el (file-expand-wildcards): In case of remote files, check only local file name part for wildcards. Provide feature 'files and subfeature 'remote-wildcards. (Bug#5198) * net/tramp.el (tramp-handle-file-remote-p): Expand file name only if there is already an established connection. (tramp-advice-file-expand-wildcards): Remove it. * net/tramp-compat.el (top): Autoload `tramp-handle-file-remote-p'. (tramp-advice-file-expand-wildcards): Moved from tramp.el. Activate advice for older GNU Emacs versions. (Bug#5237)
author Michael Albinus <michael.albinus@gmx.de>
date Thu, 17 Dec 2009 13:18:03 +0000
parents b38517de715f
children 4af83423a0f1
line wrap: on
line diff
--- a/lisp/files.el	Thu Dec 17 04:37:40 2009 +0000
+++ b/lisp/files.el	Thu Dec 17 13:18:03 2009 +0000
@@ -5365,7 +5365,10 @@
 	   ;; A list of all dirs that DIRPART specifies.
 	   ;; This can be more than one dir
 	   ;; if DIRPART contains wildcards.
-	   (dirs (if (and dirpart (string-match "[[*?]" dirpart))
+	   (dirs (if (and dirpart
+			  (string-match "[[*?]"
+					(or (file-remote-p dirpart 'localname)
+					    dirpart)))
 		     (mapcar 'file-name-as-directory
 			     (file-expand-wildcards (directory-file-name dirpart)))
 		   (list dirpart)))
@@ -5392,6 +5395,9 @@
 	(setq dirs (cdr dirs)))
       contents)))
 
+;; Let Tramp know that `file-expand-wildcards' does not need an advice.
+(provide 'files '(remote-wildcards))
+
 (defun list-directory (dirname &optional verbose)
   "Display a list of files in or matching DIRNAME, a la `ls'.
 DIRNAME is globbed by the shell if necessary.