I have a data structure like: ((fid . FID) (name . NAME) (count . COUNT) (data . ORIGINAL_DATA))
I have following Elisp code try to interactively select FID through display the NAME instead of FID.
(defun emms-bilibili-favlist-select () "Interactive select which favlist to open." (let* ((fav-name (completing-read "Select favlist: " (mapcar (lambda (x) (alist-get 'name x)) (emms-bilibili--retrieve-favfolder)))) ;; TODO: (favlist ...) ) (emms-bilibili--retrieve-favlist (alist-get 'fid favlist)))) I need it to display a list in interactive select:
NAME A NAME B NAME C When I select "NAME A", code need to get the corresponding FID. (upper code is just my pseudo code, if you have better solution, please tell me, Thanks.)
alist-getinstead ofassq. Your actual question seems to be about mapping from the value of one alist entry to the value of another entry of the same alist. Can you please clarify the title/question to make them consistent?