all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: widget-create 'menu-choice
Date: Thu, 24 Sep 2009 20:59:39 -0600	[thread overview]
Message-ID: <h9hbmj$9n4$1@ger.gmane.org> (raw)
In-Reply-To: <87177.14397.qm@web111605.mail.gq1.yahoo.com>

Mortimer Cladwell wrote:
> 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")

Ah, I misread the widget-create arguments.  That function's doc string is
practically useless.

> 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.

As Andreas points out, you need apply:

(defvar species '("human" "rat" "mouse"))

(apply 'widget-create
        'menu-choice
        :tag "Select Host Species"
        :value "unknown"
        :notify (lambda (widget &rest ignore)
		 (setq host-species (widget-value widget)))
        (mapcar (lambda (label) (list 'item label))
	       species))

-- 
Kevin Rodgers
Denver, Colorado, USA





  reply	other threads:[~2009-09-25  2:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24 16:13 Re:Re: widget-create 'menu-choice Mortimer Cladwell
2009-09-25  2:59 ` Kevin Rodgers [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-09-26 21:52 Mortimer Cladwell
2009-09-18 18:54 Mortimer Cladwell
2009-09-22  2:28 ` Kevin Rodgers
2009-09-24 17:31 ` Andreas Politz

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='h9hbmj$9n4$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.