[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Directory name completion blocks when it shouldn't
From: |
Chris Moore |
Subject: |
Re: Directory name completion blocks when it shouldn't |
Date: |
Fri, 08 Dec 2006 15:54:11 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) |
Richard Stallman <address@hidden> 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/".
- Directory name completion blocks when it shouldn't, Tim Van Holder, 2006/12/04
- Re: Directory name completion blocks when it shouldn't, Kim F. Storm, 2006/12/04
- Re: Directory name completion blocks when it shouldn't, Kevin Rodgers, 2006/12/04
- Re: Directory name completion blocks when it shouldn't, Richard Stallman, 2006/12/05
- Re: Directory name completion blocks when it shouldn't,
Chris Moore <=
- Re: Directory name completion blocks when it shouldn't, Richard Stallman, 2006/12/09
- Re: Directory name completion blocks when it shouldn't, Richard Stallman, 2006/12/17
- Re: Directory name completion blocks when it shouldn't, Richard Stallman, 2006/12/17
- Re: Directory name completion blocks when it shouldn't, Chris Moore, 2006/12/19
- Re: Directory name completion blocks when it shouldn't, Michael Albinus, 2006/12/20
- Re: Directory name completion blocks when it shouldn't, Sascha Wilde, 2006/12/20
- Re: Directory name completion blocks when it shouldn't, Michael Albinus, 2006/12/20
- Re: Directory name completion blocks when it shouldn't, Sascha Wilde, 2006/12/20
Re: Directory name completion blocks when it shouldn't, Richard Stallman, 2006/12/04