[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: completing-read return meta-information?

From: Drew Adams
Subject: RE: completing-read return meta-information?
Date: Wed, 16 Sep 2015 10:28:30 -0700 (PDT)

> >> 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


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 ()
  (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 via email to

[Prev in Thread] Current Thread [Next in Thread]