| Re: completing-read() on list of vectors |
|
 |
|
 |
|
 |
|
 |
Group: gnu.emacs.help · Group Profile
Author: NordlöwNordlöw Date: Sep 12, 2008 04:19
On 12 Sep, 12:30, Nordlöw gmail.com> wrote:
> If I have the following association list (alist):
>
> (defvar c++-stl-algorithms
> Â '(
> Â Â ("adjacent_difference" " " "Compute the differences
> between adjacent elements in a range")
> Â Â ("adjacent_find" "" "Finds two items that are adjacent
> to eachother")
> Â ))
>
> how can I modify the use of completing-read() to make the function
>
> (defun read-c++-stl-algorithm ()
> Â (let* ((sym (thing-at-point 'symbol))
> Â Â Â Â Â (cont (completing-read (concat "C++ STL Algorithm (default "
> sym "): ")
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â c++-stl-algorithms nil t nil nil
> sym)))
> Â Â (list cont)))
>
> to instead work on this list of vectors:
>
> (defvar c++-stl-algorithms
> Â '(
> Â Â ["adjacent_difference" "" "Compute the differences
> between adjacent elements in a range"]
> Â Â ["adjacent_find" "" "Finds two items that are adjacent
> to eachother"]
> Â ))
>
> I guess I need to give it an explicit completion function (as second
> argument) to achieve lookups of list of vectors where for example
> "accumulate" is used as key and the return value is the whole list
> element (vector).
>
> Why doesn't completing-read() already work on list of vectors where
> first vector element is a string aswell?
>
> Thanks in advance,
> Nordlöw
It believe it boils down to the search for a function like assoc()
that takes a list of vectors as arguments.
/Nordlöw
|