Richard Stallman <[EMAIL PROTECTED]> writes:
> On the other hand, cd does use read-directory-name.
> So this appears to be a bug in the completion routines themselves.
read-directory-name uses read-file-name with PREDICATE set to
'file-directory-p
read-file-name uses read-file-name-internal
read-file-name-internal ignores the value of PREDICATE if ACTION is
nil (ACTION is t if we are listing possible completions, and nil if
are actually doing the completion)
When we are doing the completion, read-file-name-internal calls
file_name_completion in dired.c to actually do it.
file_name_completion doesn't have any code to complete only
directories, but it does honour the value of
completion-ignored-extensions. If we temporarily bind
completion-ignored-extensions to include the empty string, it will
ignore all files, but not directories.
So here's a possible fix:
------------------------------------------------------------------------
--- lisp/files.el 2006-12-01 14:27:47.000000000 +0100
+++ /tmp/files.el 2006-12-08 15:49:50.000000000 +0100
@@ -576,11 +576,12 @@
the value of `default-directory'."
(unless dir
(setq dir default-directory))
- (read-file-name prompt dir (or default-dirname
- (if initial (expand-file-name initial dir)
- dir))
- mustmatch initial
- 'file-directory-p))
+ (let ((completion-ignored-extensions (cons ""
completion-ignored-extensions)))
+ (read-file-name prompt dir (or default-dirname
+ (if initial (expand-file-name initial dir)
+ dir))
+ mustmatch initial
+ 'file-directory-p)))
(defun pwd ()
------------------------------------------------------------------------
And a test case:
$ mkdir -p /tmp/dir/subdir
$ touch /tmp/dir/sub.txt
$ emacs
M-x cd RET /tmp/dir/s TAB
Before applying the patch, TAB will complete only up to "/tmp/dir/sub". With
the patch it will complete to "/tmp/dir/subdir/".
_______________________________________________
emacs-pretest-bug mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug