help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

completing-read() on list of vectors


From: Nordlöw
Subject: completing-read() on list of vectors
Date: Fri, 12 Sep 2008 03:30:53 -0700 (PDT)
User-agent: G2/1.0

If I have the following association list (alist):

(defvar c++-stl-algorithms
  '(
    ("adjacent_difference" "<numeric>" "Compute the differences
between adjacent elements in a range")
    ("adjacent_find" "<algorithm>" "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" "<numeric>" "Compute the differences
between adjacent elements in a range"]
    ["adjacent_find" "<algorithm>" "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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]