From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: completing-read() with explanations of the possible alternatives Date: Fri, 30 May 2008 10:05:51 -0700 Message-ID: <005301c8c277$6c0bf980$0200a8c0@us.oracle.com> References: <1ac2b900-194b-4af8-9e87-f16d38d6f173@k13g2000hse.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1212167337 2643 80.91.229.12 (30 May 2008 17:08:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 May 2008 17:08:57 +0000 (UTC) To: "=?iso-8859-1?Q?'Nordl=F6w'?=" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 30 19:09:37 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K286d-0001Cp-Cr for geh-help-gnu-emacs@m.gmane.org; Fri, 30 May 2008 19:09:31 +0200 Original-Received: from localhost ([127.0.0.1]:35951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K285r-0000JS-OM for geh-help-gnu-emacs@m.gmane.org; Fri, 30 May 2008 13:08:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K285V-0000IK-9f for help-gnu-emacs@gnu.org; Fri, 30 May 2008 13:08:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K285S-0000GL-Lt for help-gnu-emacs@gnu.org; Fri, 30 May 2008 13:08:20 -0400 Original-Received: from [199.232.76.173] (port=36489 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K285R-0000Fz-SB for help-gnu-emacs@gnu.org; Fri, 30 May 2008 13:08:18 -0400 Original-Received: from agminet01.oracle.com ([141.146.126.228]:57209) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K285O-0005Io-2U for help-gnu-emacs@gnu.org; Fri, 30 May 2008 13:08:14 -0400 Original-Received: from agmgw1.us.oracle.com (agmgw1.us.oracle.com [152.68.180.212]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id m4UH7HwG000923; Fri, 30 May 2008 12:07:17 -0500 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by agmgw1.us.oracle.com (Switch-3.2.0/Switch-3.2.0) with ESMTP id m4UDxbJ3011392; Fri, 30 May 2008 11:07:16 -0600 Original-Received: from inet-141-146-46-1.oracle.com by acsmt350.oracle.com with ESMTP id 3685670421212167153; Fri, 30 May 2008 10:05:53 -0700 Original-Received: from dradamslap1 (/24.5.171.3) by bhmail.oracle.com (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 30 May 2008 10:05:53 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1ac2b900-194b-4af8-9e87-f16d38d6f173@k13g2000hse.googlegroups.com> Thread-Index: AcjCdCOjGzR/R1ubQrq4b2Bg9MmunQAAD66w X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:54366 Archived-At: > I would like to extend completing-read() and completing-read- > multiple() in such a way that I get extra help for the alternatives > that are provided in the TABLE argument. > > I thought that completing-read() would give this functionality by > default as the documentation for it says: > "TABLE is an alist whose elements' cars are strings, or an > obarray." > I thought that the car was what displayed during completing-read() and > its corresponding cdr's were gathered in the return value. > > But I only return the cars of these elements. Is it meant to be this > way? Should I perform the lookup of crds by using the return value of > completing-read(). If so how do I accomplish that for the different > possible TABLE types. > > Example: > I want the interface for my completing-read-function to list the > alternatives something like this (preferrablly with vector or list in > font-lock-type-face and explanations in font-lock-comment-face) > - vector - Vector Container is ... > - list - List Container is ... > and return for example in the form '("vector") Hi Per, Yes, `completing-read' returns only the car, not the entire alist element. You can then look up the cdr separately, of course. However, if you have duplicate elements, then something like `assoc' will give you only the first such, which might not be what you want. There are various ways you can work around this, all of which are, well, workarounds. Since you are an Icicles user, you can find various examples in the Icicles code of dealing with this. Mail me off list if you want to discuss specifics. However, if all you want to do is add extra help, then you should be able to use annotations. See the doc for `display-completion-list'. In Icicles, you can instead use multi-completions - see http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Programming_Multi-Completions for how to use multi-completions in Emacs Lisp, and see http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Multi-Completions for the user point of view. The second page also provides a comparison with `completing-read-multiple'. HTH.