From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philippe M. Coatmeur Newsgroups: gmane.emacs.help Subject: Re: What is the :eval form ? Date: Fri, 08 Jun 2012 19:19:49 +0000 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: dough.gmane.org 1339180060 23467 80.91.229.3 (8 Jun 2012 18:27:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2012 18:27:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 08 20:27:40 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sd3uM-0007ur-Cc for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Jun 2012 20:27:38 +0200 Original-Received: from localhost ([::1]:34987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sd3uM-0004vA-0I for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Jun 2012 14:27:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sd3uG-0004ti-As for help-gnu-emacs@gnu.org; Fri, 08 Jun 2012 14:27:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sd3uE-0004M3-HZ for help-gnu-emacs@gnu.org; Fri, 08 Jun 2012 14:27:31 -0400 Original-Received: from mail-wg0-f49.google.com ([74.125.82.49]:65434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sd3uE-0004Ln-BI for help-gnu-emacs@gnu.org; Fri, 08 Jun 2012 14:27:30 -0400 Original-Received: by wgbds1 with SMTP id ds1so838942wgb.30 for ; Fri, 08 Jun 2012 11:27:27 -0700 (PDT) Original-Received: by 10.180.106.137 with SMTP id gu9mr2554514wib.8.1339180047219; Fri, 08 Jun 2012 11:27:27 -0700 (PDT) Original-Received: from moe.ocean.gmail.com ([41.142.13.74]) by mx.google.com with ESMTPS id fo7sm2763961wib.9.2012.06.08.11.27.25 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Jun 2012 11:27:26 -0700 (PDT) Original-Newsgroups: gnu.emacs.help In-Reply-To: User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/24.1 Mule/6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.49 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85166 Archived-At: At Fri, 08 Jun 2012 20:08:29 +0200, Tassilo Horn wrote: > > Philippe M. Coatmeur writes: > > Hi Philippe, > > > BTW what I'm trying to do is to use a variable to pass the ("2" in the > > example) argument to the function, to use it in a loop, like this : > > > > (loop for i from 1 to 3 do > > (add-to-list 'global-mode-string > > '(:eval (mail-bug-mode-line-all (format "%s" i))))) > > > > but i's value is always stuck at 1 :( > > Not sure what you are trying to do, but since you quote (') the :eval > form, what's actually added to the `global-mode-string' list is > literally > > (:eval (mail-bug-mode-line-all (format "%s" i))) > > with i not substituted with 1, 2, or 3. And since `add-to-list' only > adds if that elements is not included already, you end up with exactly > one occurence. > > I guess, you want this: > > (loop for i from 1 to 3 do > (add-to-list 'global-mode-string > `(:eval (mail-bug-mode-line-all (format "%s" ,i))))) > > Bye, > Tassilo This worked perfectly. The magic is that even if the element has changed, it gets replaced notheless. Big thanks to all of you guys (boy that was fast), especially the documentation bits (now I can dig in on that backtick/comma construct) :) Phil > >