emacs-devel
[Top][All Lists]
Advanced

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

Re: completing-read enhancement


From: Stefan Monnier
Subject: Re: completing-read enhancement
Date: Sun, 16 Aug 2009 01:04:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>> > This isn't a patch to completing-read, instead it is a new function.
>> > I think of it more as a facade with bells and whistles.  In summary,
>> > it makes prompting for user input easy requiring terse, in the context
>> > of a function invocation, code for this purpose.
>> 
>> Could you describe how it relates to completing-read (i.e. how it
>> differs, mostly; both from the point of view of the user, and from the
>> point of view of the coder)?

> The read-completing-choice uses completing-read and doesn't intend to
> supplant it.

I understand, yes, that's fine.

> To the developer, it offers a quicker way of prompting the user purely
> based on a list of choices (either symbols or strings) and.

> It adds the following features:
>  - accepts either symbols or string as input and converts between type
>    automatically
>  - returns user input as either a symbol or string

When/why are these useful?

>  - when the size of the list is one, the initial input is the car of the list

As a convention in Emacs, we usually prefer to start with an empty input
(and rely on the "use default if the result is the empty string"), so
I don't think this is something we want to encourage.

>  - renders default formatting (i.e. "File" -> "File (default subst.el): ")

This is good.

>  - optionally allows for empty data

Could you say something more about this.  E.g. why you came up with it,
in which situations did you find it useful/needed, ...

> To the user, it provides a quicker (for most cases) way to select from
> the list of choices (i.e. by populating the initial data from the
> choices passed or by adding a default).

IIUC, the initial data is built by (try-completion "" choices), right?
It might make sense when require-match is set, but ho often does it
return something else than ""?

As for "adding default", I don't find in the code where/how this is done,
could you explain what you mean by that?

One problem with your function is that it has even more arguments than
completing-read (which already has too many).


        Stefan


PS: BTW, (try-completion "" choices) should also work just fine for the
singleton case.




reply via email to

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