From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: completing-read return meta-information? Date: Wed, 16 Sep 2015 08:57:03 -0500 Message-ID: <86y4g6zcuo.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1442411871 14204 80.91.229.3 (16 Sep 2015 13:57:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Sep 2015 13:57:51 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 16 15:57:40 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZcDDP-0008Qw-0g for ged-emacs-devel@m.gmane.org; Wed, 16 Sep 2015 15:57:39 +0200 Original-Received: from localhost ([::1]:50949 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcDDO-0007Rv-PE for ged-emacs-devel@m.gmane.org; Wed, 16 Sep 2015 09:57:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcDD9-0007RK-QG for emacs-devel@gnu.org; Wed, 16 Sep 2015 09:57:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcDD4-0006Po-S3 for emacs-devel@gnu.org; Wed, 16 Sep 2015 09:57:23 -0400 Original-Received: from gproxy1-pub.mail.unifiedlayer.com ([69.89.25.95]:58711) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1ZcDD4-0006Oc-Jt for emacs-devel@gnu.org; Wed, 16 Sep 2015 09:57:18 -0400 Original-Received: (qmail 29518 invoked by uid 0); 16 Sep 2015 13:57:14 -0000 Original-Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy1.mail.unifiedlayer.com with SMTP; 16 Sep 2015 13:57:14 -0000 Original-Received: from host114.hostmonster.com ([74.220.207.114]) by cmgw2 with id Hpx61r0062UdiVW01px9Dc; Wed, 16 Sep 2015 07:57:12 -0600 X-Authority-Analysis: v=2.1 cv=C6F6l2/+ c=1 sm=1 tr=0 a=CQdxDb2CKd3SRg4I0/XZPQ==:117 a=CQdxDb2CKd3SRg4I0/XZPQ==:17 a=DsvgjBjRAAAA:8 a=f5113yIGAAAA:8 a=9i_RQKNPAAAA:8 a=hEr_IkYJT6EA:10 a=x_XPkuGwIRMA:10 a=ff-B7xzCdYMA:10 a=DBUcJfXSD8uw8qSF6FYA:9 Original-Received: from [76.218.37.33] (port=55548 helo=TAKVER2) by host114.hostmonster.com with esmtpa (Exim 4.84) (envelope-from ) id 1ZcDCt-0003ZF-RB for emacs-devel@gnu.org; Wed, 16 Sep 2015 07:57:08 -0600 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) X-Identified-User: {2442:host114.hostmonster.com:stephele:stephe-leake.org} {sentby:smtp auth 76.218.37.33 authed with stephen_leake@stephe-leake.org} X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 69.89.25.95 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:190012 Archived-At: I'd like completing-read to be able to return meta-information with the completion string. For example, consider completing a file name when there are duplicates: dir1/ file1.el file2.el dir2/ file1.el file2.el The completion function is reading the disk; it knows the absolute path of the file that the user chooses. However, that information is lost when completing-read returns just "file1.el" (a uniqified file name). So the caller has to repeat some of the work of the completion function to use the returned result. I tried storing the directory info in a text property of the completion string; that was not returned. A similar situation occurs when completing in an alist; the completion function uses assoc to read the alist, but after completing-read returns, the caller must call assoc again. `completion-metadata' doesn't seem designed for arbitrary user information. And I'd rather not have to call the completion table function again; that would typically require re-computing the meta-information, or caching it somewhere. Is there a way to return meta-information? What would have to be changed in completing-read to make this possible? -- -- Stephe