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

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

bug#51650: Autocomplete: first Tab should show *Completions* buffer


From: Stephen Berman
Subject: bug#51650: Autocomplete: first Tab should show *Completions* buffer
Date: Sun, 07 Nov 2021 23:33:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

On Sun, 7 Nov 2021 18:24:56 -0300 Carlos Pita <carlosjosepita@gmail.com> wrote:

> On Sun, Nov 7, 2021 at 5:39 PM Eli Zaretskii <eliz@gnu.org> wrote:
>>
>
>> > - The initial value is taken from the current working directory so
>> > it's always a valid completion.
>>
>> The completion doesn't know that.  It's just what the caller arranged
>> for it to display.
>> [...]
>> The completion doesn't know where it was launched from.  It just knows
>> what the user typed, and in the "~/" case the user didn't type
>> anything.
>
> If we add the context that we're doing directory completion from the
> cwd my statement is true. If we remove that context I start to see
> where you're coming from. Let's say the algorithm is more generic and
> unaware of some facts like its initial value being valid. From its
> perspective it may start with an invalid response that's not even a
> prefix of a valid response. After the TAB that goes from ~/Desk to
> ~/Desktop/ at least it knows that the response is the prefix of some
> set of valid completions. So you may explain its behavior as:
>
> 1. C-x C-f => ~/ but from what I know this may be rubbish
> 2. TAB => ~/ ok this is a completion but there are more with the same prefix
> 3. TAB => ~/ as I said there are more with the same prefix, take a
> look at the other ones
> 4. Desk<TAB> => ~/Desktop/ ok this is a completion
> 5. TAB => ~/Desktop/ there are more with the same prefix, take a look
> at the other ones
>
> At this level of explanation, there is a difference between the TAB in
> 2 and the TAB in 5. I also get why you may be willing to say that from
> 1 to 2 a completion indeed happened when, on the face of it, this
> seems a nonsensical statement: the algorithm inspected a completion
> set at this point and realized that the initial value is a member of
> it. It's hardly what the manual conveys to a user unaware of the
> implementation, but I get it. I still don't get why 2 and 3 can't be
> merged into a single step but that would be a discussion about
> convenience, at least I'm satisfied with this logical tackle on the
> inconsistency issue.

In fact, 2 and 3 essentially do get merged by setting
insert-default-directory to nil: then `C-x C-f' displays no directory in
the prompt, and the first TAB pops up the *Completions* buffer
containing completions in the default directory (unless it's empty or
contains only one file).  This seems to refute the contention that the
crucial difference between 2 and 5 is that in the former the user didn't
type anything.

Steve Berman





reply via email to

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