changeset 48225:75ced2cd606e

(PC-do-completion): Make partial-completion work with incomplete directory names.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 08 Nov 2002 23:39:29 +0000
parents 0d0908b6b4cc
children 65903e252ec1
files lisp/complete.el
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/complete.el	Fri Nov 08 20:28:55 2002 +0000
+++ b/lisp/complete.el	Fri Nov 08 23:39:29 2002 +0000
@@ -78,11 +78,6 @@
 ;; The regular M-TAB (lisp-complete-symbol) command also supports
 ;; partial completion in this package.
 
-;; File name completion does not do partial completion of directories
-;; on the path, e.g., "/u/b/f" will not complete to "/usr/bin/foo",
-;; but you can put *'s in the path to accomplish this:  "/u*/b*/f".
-;; Stars are required for performance reasons.
-
 ;; In addition, this package includes a feature for accessing include
 ;; files.  For example, `C-x C-f <sys/time.h> RET' reads the file
 ;; /usr/include/sys/time.h.  The variable PC-include-file-path is a
@@ -396,6 +391,18 @@
 		PC-ndelims-regex (concat "[^" PC-delims "]*")
 		PC-delims-list (append PC-delims nil)))
 
+      ;; Add wildcards if necessary
+      (let ((dir (file-name-directory str))
+	    (file (file-name-nondirectory str)))
+	(while (and (stringp dir) (not (file-directory-p dir)))
+	  (setq dir (directory-file-name dir))
+	  (setq file (concat (replace-regexp-in-string
+			      PC-delim-regex "*\\&"
+			      (file-name-nondirectory dir))
+			     "*/" file))
+	  (setq dir (file-name-directory dir)))
+	(setq str (concat dir file)))
+      
       ;; Look for wildcard expansions in directory name
       (and filename
 	   (string-match "\\*.*/" str)