all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mortimer Cladwell <mbcladwell@yahoo.com>
To: kevin.d.rodgers@gmail.com, help-gnu-emacs@gnu.org
Subject: Re:Re: widget-create 'menu-choice
Date: Thu, 24 Sep 2009 09:13:14 -0700 (PDT)	[thread overview]
Message-ID: <87177.14397.qm@web111605.mail.gq1.yahoo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]

Your suggestion evaluates to:

((item "human") (item "rat") (item "mouse"))

which when inserted into a form results in the error:

widget-create: Invalid function: (item "human")

Evaluations that would work are:

'(item "human") '(item "rat") '(item "mouse")
OR 

(quote (item "human"))  (quote (item "rat")) (quote (item "mouse"))

Note that there are no enclosing parenthesis around the list.
Thanks
Mortimer-----------------------------------------------------------------

Mortimer Cladwell wrote: 
Hi,
>I would like to dynamically populate a dropdown widget from a database. the 'menu-choice widget looks like
>(widget-create 'menu-choice
>:tag "Select Host Species"
>:value "unknown"
>:notify (lambda (widget &rest ignore)
>(setq host-species (widget-value widget)))
>'(item "human")
>'(item "rat")
>'(item "mouse"))
>Suppose I can generate a list '( "human "rat" "mouse") from the database. How to create
>'(item "human")
>'(item "rat")
>'(item "mouse")
>on the fly? The closest I can come is
>(progn
>(setq var '( "human" "rat" "mouse"))
>(mapcar '(lambda (a) `'(item ,a)) var)
>) 

i.e.

(let ((var '("human" "rat" "mouse")))
  (mapcar (lambda (label) (list 'item label))
          var))

--
Kevin Rodgers
Denver, Colorado, USA


      

[-- Attachment #2: Type: text/html, Size: 2323 bytes --]

             reply	other threads:[~2009-09-24 16:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24 16:13 Mortimer Cladwell [this message]
2009-09-25  2:59 ` widget-create 'menu-choice Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87177.14397.qm@web111605.mail.gq1.yahoo.com \
    --to=mbcladwell@yahoo.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=kevin.d.rodgers@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.