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: Philippe M . Coatmeur
Subject: Re: What is the :eval form ?
Date: Fri, 08 Jun 2012 19:19:49 +0000
User-agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/24.1 Mule/6.0 (HANACHIRUSATO)

At Fri, 08 Jun 2012 20:08:29 +0200,
Tassilo Horn wrote:
> 
> 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

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

> 
> 



reply via email to

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