[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Completion with different values and displayed things
From: |
mbork |
Subject: |
Completion with different values and displayed things |
Date: |
Sat, 16 Mar 2024 05:44:35 +0100 |
User-agent: |
mu4e 1.12.0; emacs 30.0.50 |
Hi all!
I have a list of "things" and I need to use `completing-read' (or
another completion mechanism) to enable the user to select one of them.
Here's the problem. Every "thing" has, say, three things, like
(:name "Thing" :description "The important thing" :id 1337)
I want my completion to:
- complete on :name
- display also :description (there could be two different "things" with
the same :name's but different :description's)
- and return :id
I use Ivy, but I'd prefer to make this work with any completion
framework (or even with Emacs vanilla completion).
Does Emacs has anything like this? More or less, I'd like an equivalent
of HTML's <select> where displayed thing is different than the "value"
attribute. It is important though to use some sort of completion
instead of e.g. displaying all options annotated by numbers/letters and
letting the user type the number or a letter associated with the one
they want - there are too many of them for this to be comfortable.
TIA,
--
Marcin Borkowski
https://mbork.pl
https://crimsonelevendelightpetrichor.net/
- Completion with different values and displayed things,
mbork <=