Changed filename-complete-string so that matches which complete to
authorBrian A. LaMacchia <edu/mit/csail/zurich/bal>
Fri, 6 Sep 1991 16:19:44 +0000 (16:19 +0000)
committerBrian A. LaMacchia <edu/mit/csail/zurich/bal>
Fri, 6 Sep 1991 16:19:44 +0000 (16:19 +0000)
directory names act as though the completion is non-unique.  Before, if
the only directory in /tmp beginning with "f" was "foo", then completing
on "/tmp/f" would complete to "/tmp/foo", and the if-unique proc. would
be invoked with "/tmp/foo/".  Now, we invoke if-non-unique with
"/tmp/foo/".

v7/src/edwin/filcom.scm

index 8c884f91f9c091a9c7cfe4daa46ebbc5b4326762..bc92d39115918c5f27186b0928aa9989862e323a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/filcom.scm,v 1.157 1991/05/21 21:46:35 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/filcom.scm,v 1.158 1991/09/06 16:19:44 bal Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -598,11 +598,18 @@ If a file with the new name already exists, confirmation is requested first."
   (define (loop directory filenames)
     (let ((unique-case
           (lambda (filename)
-            (if-unique
-             (let ((filename (os/make-filename directory filename)))
-               (if (os/file-directory? filename)
-                   (os/filename-as-directory filename)
-                   filename)))))
+            (let ((filename (os/make-filename directory filename)))
+              (if (os/file-directory? filename)
+                  ;; Note: We assume here that all directories contain
+                  ;; at least one file.  Thus directory names should 
+                  ;; complete, but not uniquely.
+                  (let ((dir (os/filename-as-directory filename)))
+                    (if-not-unique dir
+                                   (lambda ()
+                                     (canonicalize-filename-completions
+                                      dir
+                                      (os/directory-list dir)))))
+                  (if-unique filename)))))
          (non-unique-case
           (lambda (filenames*)
             (let ((string (string-greatest-common-prefix filenames*)))