From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: completing-read return meta-information? Date: Wed, 16 Sep 2015 10:28:30 -0700 (PDT) Message-ID: References: <86y4g6zcuo.fsf@stephe-leake.org> <7c37cd21-a9e0-48fa-b5a2-a32595c43dda@default> <86y4g6xpig.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1442424567 5991 80.91.229.3 (16 Sep 2015 17:29:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Sep 2015 17:29:27 +0000 (UTC) To: Stephen Leake , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 16 19:29:14 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 1ZcGVr-0000Gh-5h for ged-emacs-devel@m.gmane.org; Wed, 16 Sep 2015 19:28:55 +0200 Original-Received: from localhost ([::1]:52193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcGVq-0004QM-L8 for ged-emacs-devel@m.gmane.org; Wed, 16 Sep 2015 13:28:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcGVc-0004QC-AF for emacs-devel@gnu.org; Wed, 16 Sep 2015 13:28:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcGVW-000470-Nb for emacs-devel@gnu.org; Wed, 16 Sep 2015 13:28:40 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:38546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcGVW-00046p-Ge for emacs-devel@gnu.org; Wed, 16 Sep 2015 13:28:34 -0400 Original-Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t8GHSXEM029817 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 16 Sep 2015 17:28:33 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t8GHSWHN015182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 16 Sep 2015 17:28:32 GMT Original-Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t8GHSWmq011083; Wed, 16 Sep 2015 17:28:32 GMT In-Reply-To: <86y4g6xpig.fsf@stephe-leake.org> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 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:190035 Archived-At: > >> I tried storing the directory info in a text property of the > >> completion string; that was not returned. > > > > FWIW, I proposed years ago that a completion candidate (string) be > > able to be returned propertized. "Be able" means that this can be > > controlled, e.g., by a variable. > > > > Here is a thread about this from 2008, for instance: > > http://lists.gnu.org/archive/html/emacs-devel/2008-06/msg01503.html > > There were other threads too. > > > > FWIW, in Icicles I've done this for nearly a decade. I use this > > feature to recuperate information associated with an individual > > candidate. A candidate can be as rich as you like and return as > > much info as you like. > > > > The changes to the Emacs code needed to allow this are simple. >=20 > Excellent. Can you post a patch? See the old threads. Stefan knows full well how to do this. It's not wanted. The Icicles code that does it is here, if you're interested: http://www.emacswiki.org/emacs/download/icicles-fn.el. In Icicle mode, `icicle-completing-read' substitutes for `completing-read'. In particular, it doesn't remove text properties from the return value. --- It also binds `minibuffer-allow-text-properties' to `t'. But you will note from `C-h v' for that variable that it has no effect in vanilla Emacs on text read using completion. IOW, you might hope that this would be sufficient to give `toto' a propertized string value, but you would be wrong: (defun foo () (interactive) (let ((minibuffer-allow-text-properties t) =09(aa (propertize "aa" 'face 'highlight)) =09(bb (propertize "bb" 'face 'error)) =09(cc (propertize "cc" 'face 'escape-glyph))) (completing-read "foo: " (list aa bb cc)))) (setq toto (foo))