From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: rewriting y-or-n-p to use read-char-choice Date: Thu, 10 Mar 2011 13:46:45 -0600 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87lj0mkbbu.fsf@lifelogs.com> References: <8739mulshy.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1299786437 21800 80.91.229.12 (10 Mar 2011 19:47:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 10 Mar 2011 19:47:17 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 10 20:47:10 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PxlpF-0002TR-IO for ged-emacs-devel@m.gmane.org; Thu, 10 Mar 2011 20:47:09 +0100 Original-Received: from localhost ([127.0.0.1]:43326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxlpF-00082E-32 for ged-emacs-devel@m.gmane.org; Thu, 10 Mar 2011 14:47:09 -0500 Original-Received: from [140.186.70.92] (port=60903 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pxlp9-00081q-As for emacs-devel@gnu.org; Thu, 10 Mar 2011 14:47:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pxlp7-0003c1-NC for emacs-devel@gnu.org; Thu, 10 Mar 2011 14:47:03 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:35111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pxlp7-0003bh-Em for emacs-devel@gnu.org; Thu, 10 Mar 2011 14:47:01 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Pxlp5-0002Os-Di for emacs-devel@gnu.org; Thu, 10 Mar 2011 20:46:59 +0100 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Mar 2011 20:46:59 +0100 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Mar 2011 20:46:59 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 30 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:ZoL/G50/fnDdUTCQte1I7s08ICs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:137060 Archived-At: On Thu, 10 Mar 2011 11:10:06 -0800 "Edward O'Connor" 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