[Top][All Lists]

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

Re: rewriting y-or-n-p to use read-char-choice

From: Ted Zlatanov
Subject: Re: rewriting y-or-n-p to use read-char-choice
Date: Thu, 10 Mar 2011 13:46:45 -0600
User-agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux)

On Thu, 10 Mar 2011 11:10:06 -0800 "Edward O'Connor" <address@hidden> wrote: 

EO> Hi,
>> Stefan Monnier asked me to look at rewriting `y-or-n-p' to use
>> `read-char-choice'.  This looked easy at first but I realized it's not
>> such a good idea because:
EO> [snip]
>> So I think a better way would be to write a
>> `read-char-choice-from-keymap' function which can be passed
>> `query-replace-map' or something else AND a prompt and a list of
>> acceptable return values.

EO> I don't know if this is at all useful, but I had implemented the
EO> functionality that `read-char-choice' provides a couple of years ago:

EO> http://edward.oconnor.cx/elisp/read-char-spec.el

EO> I've signed papers, so feel free to pilfer anything useful out of there.

Thanks.  I think at least the ?? help behavior should be in
`read-char-choice', and appending the mapconcat-ed list of choices is a
nice feature (I did something similar for `auth-source-read-char-choice').

I really think, however, that a keymap is a necessity in this kind of
prompting function.  We want it to be flexible multilingually and we
very rarely actually want the char value of the key pressed.  We usually
want a symbolic return.  It's also nice to accept more than literal


reply via email to

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