emacs-devel
[Top][All Lists]
Advanced

[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 08:00:39 -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.

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

See above - same thing.  Just put the full alist element on the
string as a property.  You can use the exact alist element:
`eq'-testable.  No loss of information.

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

Simply return the propertized candidate as is.  Makes completion
far more useful.



reply via email to

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