emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Q on file-name completion - "." and ".."


From: Drew Adams
Subject: Q on file-name completion - "." and ".."
Date: Fri, 9 Jun 2006 10:35:18 -0700

Consider a directory c:/foo/ (e.g. on Windows), with an empty subdirectory
bar/.

Then, (try-completion "c:/foo/bar/" 'read-file-name-internal "c:/foo/")
returns "c:/foo/bar/." (note the ".").  There are no files or subdirs in
bar, so the only matches are "." and "..". Since there is more than one
match, the common prefix of the two, ".", is returned.

1. The behavior seems to be to ignore "." and ".." as possible completion
candidates, unless there are no non-ignorable candidates. That is, "." and
".." seem to be treated exactly the same as the file names that match
`completion-ignored-extensions'.

Is this the correct behavior wrt "." and ".."? I assume so.

This rule seems to hold, but when I looked through the Elisp and Emacs
manuals and briefly searched the source code, I found nothing about this. I
did find that the C code for `file_name_completion' seems to treat "." and
".." as ignorable file names. I wasn't able to quickly track down whether
`try-completion' makes use of `file_name_completion' as, say, a file
handler.

2. Assuming that #1 is the correct behavior, can we please document this -
in both the Emacs manual and the Elisp manual? That is, wherever we speak of
file-name completion, and of `completion-ignored-extensions' in particular,
can we mention that "." and ".." are treated in the same way as names that
match `completion-ignored-extensions'? I don't think this is documented
anywhere.

Otherwise, there is nothing to help users understand why they sometimes get
"." as a common prefix when they complete, and they sometimes don't get ".".
It will be difficult for them to figure out that they will get "." and ".."
whenever the only possible matches are ignorable extensions.

3. How about also adding a link from Elisp-manual node Reading File Names to
node File Name Completion (where `completion-ignored-extensions' is
described)?

4. I'm not even sure that `completion-ignored-extensions' is described in
the right Elisp-manual node. IIIUC, it affects completion functions besides
`file-name-completion' (`all-completions', `try-completion',
`read-file-name', etc.), and it does not even affect
`file-name-all-completions', which is the other function described in node
File Name Completion.








reply via email to

[Prev in Thread] Current Thread [Next in Thread]