unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* completing-read() on list of vectors
@ 2008-09-12 10:30 Nordlöw
  2008-09-12 11:19 ` Nordlöw
  2008-09-12 17:58 ` Nikolaj Schumacher
  0 siblings, 2 replies; 3+ messages in thread
From: Nordlöw @ 2008-09-12 10:30 UTC (permalink / raw)
  To: help-gnu-emacs

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


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

end of thread, other threads:[~2008-09-12 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-12 10:30 completing-read() on list of vectors Nordlöw
2008-09-12 11:19 ` Nordlöw
2008-09-12 17:58 ` Nikolaj Schumacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).