all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Philippe M. Coatmeur'" <philippe.coatmeur@gmail.com>,
	<help-gnu-emacs@gnu.org>
Subject: RE: What is the :eval form ?
Date: Fri, 8 Jun 2012 11:10:03 -0700	[thread overview]
Message-ID: <98F53EC4A5444A2FB6BA710FCF03D030@us.oracle.com> (raw)
In-Reply-To: <lzvcj1tzqd.wl%philippe.coatmeur@gmail.com>

> 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 :(

That's because you want to evaluate (format "%s" i) when the `loop' is executed,
but you have put it inside '(...).  So your iterator puts this into
`global-mode-string' at each iteration:

(:eval (mail-bug-mode-line-all (format "%s" i)))

What you really want is this (or equivalent):

(loop for i from 1 to 3 do
  (add-to-list
    'global-mode-string
    `(:eval (mail-bug-mode-line-all ,(format "%s" i)))))




  parent reply	other threads:[~2012-06-08 18:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08 18:39 What is the :eval form ? Philippe M. Coatmeur
2012-06-08 17:56 ` Eli Zaretskii
2012-06-08 18:01 ` Drew Adams
2012-06-08 18:02 ` Tassilo Horn
2012-06-09  6:40   ` Richard Riley
2012-06-09  8:34     ` Thien-Thi Nguyen
2012-06-09 14:08     ` Drew Adams
2012-06-08 18:08 ` Tassilo Horn
2012-06-08 18:10 ` Drew Adams [this message]
2012-06-08 18:21 ` Barry Margolin
     [not found] ` <mailman.2446.1339178928.855.help-gnu-emacs@gnu.org>
2012-06-08 19:19   ` Philippe M. Coatmeur

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=98F53EC4A5444A2FB6BA710FCF03D030@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=philippe.coatmeur@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.