unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: emacs-devel@gnu.org
Subject: Re: rewriting y-or-n-p to use read-char-choice
Date: Thu, 10 Mar 2011 13:46:45 -0600	[thread overview]
Message-ID: <87lj0mkbbu.fsf@lifelogs.com> (raw)
In-Reply-To: AANLkTi=fzRiqFcan5gxXTipZYjkEnJX-X8W1gkZoVZ-u@mail.gmail.com

On Thu, 10 Mar 2011 11:10:06 -0800 "Edward O'Connor" <hober0@gmail.com> 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
characters.

Ted




  reply	other threads:[~2011-03-10 19:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 18:50 rewriting y-or-n-p to use read-char-choice Ted Zlatanov
2011-03-10 19:10 ` Edward O'Connor
2011-03-10 19:46   ` Ted Zlatanov [this message]
2011-03-10 22:35 ` Drew Adams
2011-03-10 22:54   ` Ted Zlatanov
2011-03-10 23:48     ` Drew Adams
2011-03-11  2:05 ` Stefan Monnier

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=87lj0mkbbu.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=emacs-devel@gnu.org \
    /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).