unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* completing-read return meta-information?
@ 2015-09-16 13:57 Stephen Leake
  2015-09-16 15:00 ` Drew Adams
  0 siblings, 1 reply; 21+ messages in thread
From: Stephen Leake @ 2015-09-16 13:57 UTC (permalink / raw)
  To: emacs-devel

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<dir1>" (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



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-09-28 19:42 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).