From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mortimer Cladwell Newsgroups: gmane.emacs.help Subject: Re: widget-create 'menu-choice Date: Sat, 26 Sep 2009 14:52:47 -0700 (PDT) Message-ID: <372723.63065.qm@web111602.mail.gq1.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0-142366254-1254001967=:63065" X-Trace: ger.gmane.org 1254002003 13806 80.91.229.12 (26 Sep 2009 21:53:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Sep 2009 21:53:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 26 23:53:15 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MrfCa-0004f5-VH for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Sep 2009 23:53:13 +0200 Original-Received: from localhost ([127.0.0.1]:42370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrfCa-0005fW-Hv for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Sep 2009 17:53:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MrfCH-0005fH-FM for help-gnu-emacs@gnu.org; Sat, 26 Sep 2009 17:52:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MrfCD-0005f5-Sl for help-gnu-emacs@gnu.org; Sat, 26 Sep 2009 17:52:53 -0400 Original-Received: from [199.232.76.173] (port=41266 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrfCD-0005f2-QQ for help-gnu-emacs@gnu.org; Sat, 26 Sep 2009 17:52:49 -0400 Original-Received: from n15.bullet.mail.mud.yahoo.com ([68.142.206.42]:20877) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MrfCD-0004MB-BB for help-gnu-emacs@gnu.org; Sat, 26 Sep 2009 17:52:49 -0400 Original-Received: from [68.142.200.226] by n15.bullet.mail.mud.yahoo.com with NNFMP; 26 Sep 2009 21:52:47 -0000 Original-Received: from [68.142.201.252] by t7.bullet.mud.yahoo.com with NNFMP; 26 Sep 2009 21:52:47 -0000 Original-Received: from [127.0.0.1] by omp413.mail.mud.yahoo.com with NNFMP; 26 Sep 2009 21:52:47 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 872463.91188.bm@omp413.mail.mud.yahoo.com Original-Received: (qmail 63472 invoked by uid 60001); 26 Sep 2009 21:52:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1254001967; bh=QWb9dUaubxhKowEp1fpFp4cfPtLqd+PxQ+V2UGfzqDM=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=mGINDjkV6D+PDf5eKr83KZPKZ30EdOV2K3jbrH0SzCAsVjs5DLx833mGu3Lo0/LcoXGpe9i4OyzTLDt/CO4rACcZ3AY0yUPkKgGQvGhOJ3rbFCMQ9swyU4/QqSz7VvqMEqmUoumw4cwrAv/QyRdQ/pfDNrA8tqbmQCEHeDX+nr8= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=gfLjFD+0HDv9AJRURgdjyC5C+zcRiq0efyCh/bmtsVmZIewYQIB0d1zrMbdqsvxrTNPCFeILqhkBKSBpdG4pYt8QFHS/dVtuYvdQ/lC4r5cSS9zIQDVRh9DEAkNFR63R+zZW0cIW5+JIM/fv3CLlbQTguI+mKzN0lb8JtHWgpOM=; X-YMail-OSG: lRd7L1gVM1lihxSGGEqTsoQc9GKBmVQ18cSKJMS1YcT80xwQaCm2qkp3g5pyLFEj3paYYl_7iLmd..k8q4qIyUp_A6_0bRLNHeKcW5pKNKOZx9l6w1bGl24T.bF9t_wJvec2yYjTJ4jbcaicZIYasi7kTOzrT48JyTdFhJM64woTD7VVd56AUn4qcRvV.ybNkPIKpyD58NV2RqBpO2T2z5gAR92m8Ua5N6ZwHCWXXwPsLxf1K77isoXAHG0V4tTWfLva Original-Received: from [98.110.175.189] by web111602.mail.gq1.yahoo.com via HTTP; Sat, 26 Sep 2009 14:52:47 PDT X-Mailer: YahooMailRC/157.18 YahooMailWebService/0.7.347.2 X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:68490 Archived-At: --0-142366254-1254001967=:63065 Content-Type: text/plain; charset=us-ascii (apply 'widget-create 'menu-choice.... Will create multiple dropdown lists. I want a single dropdown that has multiple elements. I am thinking a macro is the way to go. Consider: (defmacro item-element (var) (list 'quote `'(item ,var))) Then (item-element "human") would evaluate to (quote (item "human")) What I haven't been able to do is mapcar item-element over my list ("rat" "human" "mouse") The desired output is: (quote (item "rat")) (quote (item "human")) (quote (item "mouse")) Note the absence of circumscribed parenthesis, i.e. this is not a list. Suggestions? Thanks Mortimer ---------------------------------------------------------- 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 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --0-142366254-1254001967=:63065 Content-Type: text/html; charset=us-ascii
(apply 'widget-create 'menu-choice....
Will create multiple dropdown lists. I want a single dropdown that has
multiple elements. I am thinking a macro is the way to go. Consider:

(defmacro item-element (var)
(list 'quote `'(item ,var)))

Then (item-element "human") would evaluate to (quote (item "human"))

What I haven't been able to do is mapcar item-element over my list

("rat" "human" "mouse")

The desired output is:

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

Note the absence of circumscribed parenthesis, i.e . this is not a list.
Suggestions?
Thanks

Mortimer

----------------------------------------------------------

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


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com --0-142366254-1254001967=:63065--