[Top][All Lists]

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

Re: completing-read return meta-information?

From: Stephen Leake
Subject: Re: completing-read return meta-information?
Date: Tue, 22 Sep 2015 10:21:10 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

Stefan Monnier <address@hidden> writes:

>> It also achieves the goal of returning an absolute string from
>> completing-read; that required advice on completing-read-default to call
>> the new function completion-get-data-string.
> Why can't you make completion-try-completion return an absolute filename
> when there's only one match?  

The string returned from completion-try-completion is displayed in the
minibuffer, as the completion prefix. I don't want that to be the
display string.

Part of the point of using path completion is that you don't care what
directory the file is in. So having the absolute path displayed as the
final completion feels like the system forcing you to care.

More importantly, the user can type <ret> at any time; then
test-completion should return t when it is passed the abbreviated
display string from the first completion; that is known to be a unique
valid completion.

So this approach would require the user to always type tab, or go thru
one more confirmation step after typing <ret>. I tried this approach
early in this work, and could not make it work consistently.

This discussion points out that "user input string" and "display string"
have the same format; both can be passed to completion-try-completion and
completion-test-completion. The only difference is that the strings
returned by completion-all-completions all identifiy unique, valid
files. So I think I'll merge those two string types to "user string";
that should make this clearer.

> PS: Also, as a user, I think I'd rather see names like "dir/file" than
> "file<dir>".

You only need directory names when there are conflicting names; on many
paths, there will be none or few.

I mainly used that style because it meant the user string is a prefix of
all the completions, which some of the completion primitives expect, so
it made things simpler.

On the other hand, I use the postfix uniquify style for buffer names, so
I'm used to it :).

I'll try to implement directory completion in both styles; this should
be a user preference, just as it is in buffer names.

-- Stephe

reply via email to

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