all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Completion with different values and displayed things
@ 2024-03-16  4:44 mbork
  2024-03-16 15:33 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 2+ messages in thread
From: mbork @ 2024-03-16  4:44 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

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/



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

end of thread, other threads:[~2024-03-16 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-16  4:44 Completion with different values and displayed things mbork
2024-03-16 15:33 ` Stefan Monnier via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.