emacs-devel
[Top][All Lists]
Advanced

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

completing-read return meta-information?


From: Stephen Leake
Subject: completing-read return meta-information?
Date: Wed, 16 Sep 2015 08:57:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

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



reply via email to

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