unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Paul Landes <landes@mailc.net>
Cc: emacs-devel@gnu.org
Subject: Re: completing-read enhancement
Date: Sun, 16 Aug 2009 01:04:44 -0400	[thread overview]
Message-ID: <jwvab20weat.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <loom.20090812T015630-600@post.gmane.org> (Paul Landes's message of "Wed, 12 Aug 2009 01:57:39 +0000 (UTC)")

>> > 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	other threads:[~2009-08-16  5:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11  3:01 completing-read enhancement Paul Landes
2009-08-11 15:12 ` Stefan Monnier
2009-08-12  1:57   ` Paul Landes
2009-08-16  5:04     ` Stefan Monnier [this message]
2009-08-16 21:16       ` Paul Landes
2009-08-17 14:54         ` Stefan Monnier
2009-08-20  0:24           ` Paul Landes
2009-09-10  5:13             ` Paul Landes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvab20weat.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=landes@mailc.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).