Re: completing-read() on list of vectors
  Home FAQ Contact Sign in
gnu.emacs.help only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: completing-read() on list of vectors         

Group: gnu.emacs.help · Group Profile
Author: Nordlö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
no comments
diggit! del.icio.us! reddit!