all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Stephen Leake <stephen_leake@stephe-leake.org>, emacs-devel@gnu.org
Subject: RE: completing-read return meta-information?
Date: Wed, 16 Sep 2015 10:28:30 -0700 (PDT)	[thread overview]
Message-ID: <dcde8d89-c31c-4cd2-b56e-046c9999beb8@default> (raw)
In-Reply-To: <86y4g6xpig.fsf@stephe-leake.org>

> >> 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.
> 
> 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)
	(aa (propertize "aa" 'face 'highlight))
	(bb (propertize "bb" 'face 'error))
	(cc (propertize "cc" 'face 'escape-glyph)))
    (completing-read "foo: " (list aa bb cc))))

(setq toto (foo))



  reply	other threads:[~2015-09-16 17:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 13:57 completing-read return meta-information? Stephen Leake
2015-09-16 15:00 ` Drew Adams
2015-09-16 17:06   ` Stephen Leake
2015-09-16 17:28     ` Drew Adams [this message]
2015-09-16 17:45   ` Stephen Leake
2015-09-17  1:38     ` Stefan Monnier
2015-09-17 12:52       ` Stephen Leake
2015-09-17 13:24         ` Stefan Monnier
2015-09-17 18:14           ` Dmitry Gutov
2015-09-18  0:54             ` Stefan Monnier
2015-09-21 16:46       ` Stephen Leake
2015-09-21 19:12         ` Stephen Leake
2015-09-21 19:51         ` Stefan Monnier
2015-09-22 15:21           ` Stephen Leake
2015-09-26 10:54             ` Stephen Leake
2015-09-27 15:45               ` Stefan Monnier
2015-09-28  5:50                 ` Dmitry Gutov
2015-09-28 15:59                 ` Stephen Leake
2015-09-28 16:13                 ` Stephen Leake
2015-09-28 19:42                   ` Stefan Monnier
2015-09-28  5:58             ` Dmitry Gutov

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dcde8d89-c31c-4cd2-b56e-046c9999beb8@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=stephen_leake@stephe-leake.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.