emacs-pretest-bug
[Top][All Lists]
Advanced

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

RE: should locate-file-completion filter out "./" and "../"?


From: Drew Adams
Subject: RE: should locate-file-completion filter out "./" and "../"?
Date: Sun, 9 Jul 2006 18:27:47 -0700

The problem is worse than just "./" and "../". There are multiple
occurrences of ".cvsignore" also. Perhaps other names as well; I didn't
check.

I would appreciate it if `locate-file-completion' would remove all
duplicates (or, better, not create any).

This is actually an important problem for me. Why? Glad you asked...

I have my own completion code (Icicles), but I use the standard
`completing-read' as a base for it.

Sometime between June 2005 and March 2006, Emacs 22 was changed to remove
duplicates from the display in *Completions* (in function
`minibuffer-completion-help'). Emacs has never done that before. I have no
problem with that, per se.

Thankfully (!!!!), duplicates are *not* being removed from the result of
`all-completions', because I rely upon that fact to give me an unordered set
of completions, with duplicates if they are available. I have code that lets
users take advantage of completion candidates that might be identical
strings but have different meanings (e.g. occurrences of the same string in
a buffer).

I need to have the function that calls `completing-read' take responsibility
for any duplicate elimination, when it deems that appropriate. There is no
way for my enhanced `completing-read' code itself to know if duplicate
removal is appropriate or not in any given context - it simply displays all
completions (including duplicates, if there are any), when you hit TAB.

I'd suggest that the same policy would be better for Emacs too: give the
responsibility of removing duplicates to the functions that call
`completing-read' and `read-file-name', and get rid of the recent
duplicate-removal code in `minibuffer-completion-help'. Emacs too might one
day want to allow for duplicate completion strings, for whatever reason. Be
that as it may...

I don't really care whether Emacs removes duplicates for its own display of
*Completions*, but I do care that `locate-file-completion' does not remove
duplicates itself, because when you hit TAB with my own completing code,
*Completions* contains _lots_ of duplicate entries ("./" and "../", in
particular). For `locate-file-completion' to work well with my code, it
needs to take responsibility for removing duplicates.

So, I would *really* appreciate it if you would fix `locate-file-completion'
so that it removes duplicates or (better) doesn't create them in the first
place.

For me, this is very important. For you, making this change to
`locate-file-completion' might mean a small performance improvement, if
duplicates are prevented, or a small performance hit, if duplicates are
removed afterward.

I'll be grateful.


    -----Original Message-----
    emacs -q

    M-: (locate-file-completion "" (list load-path ".el" ".el.gz") t)

    That returns a HUMONGOUS list (3093 entries in emacs -q)) such as this
    (abbreviated):

    ("./" "../" "ja-dic/" "leim-list" "leim-list.el" "quail/" "./" "../"
    ".cvsignore" "ChangeLog" "CVS/" ...)

    There are plenty of occurrences of "./" and "../" here, in particular.

    1. Is it at all useful to have "./" and "../" in this list?
    2. If it is useful, how about removing (or not creating) duplicates of
       "./" and "../"?

    In GNU Emacs 22.0.50.1 (i386-mingw-nt5.1.2600)
     of 2006-03-20 on W2ONE
    X server distributor `Microsoft Corp.', version 5.1.2600
    configured using `configure --with-gcc (3.4) --cflags -Id:/g/include'






reply via email to

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