help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the :eval form ?


From: Tassilo Horn
Subject: Re: What is the :eval form ?
Date: Fri, 08 Jun 2012 20:08:29 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.0.97 (gnu/linux)

Philippe M. Coatmeur <philippe.coatmeur@gmail.com> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]