[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: What is the :eval form ?
From: |
Drew Adams |
Subject: |
RE: What is the :eval form ? |
Date: |
Fri, 8 Jun 2012 11:10:03 -0700 |
> 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)))))
- What is the :eval form ?, Philippe M . Coatmeur, 2012/06/08
- Re: What is the :eval form ?, Eli Zaretskii, 2012/06/08
- RE: What is the :eval form ?, Drew Adams, 2012/06/08
- Re: What is the :eval form ?, Tassilo Horn, 2012/06/08
- Re: What is the :eval form ?, Tassilo Horn, 2012/06/08
- RE: What is the :eval form ?,
Drew Adams <=
- Re: What is the :eval form ?, Barry Margolin, 2012/06/08
- Message not available