all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philippe M. Coatmeur <philippe.coatmeur@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: What is the :eval form ?
Date: Fri, 08 Jun 2012 19:19:49 +0000	[thread overview]
Message-ID: <lzaa0d1ui2.wl%philippe.coatmeur@gmail.com> (raw)
In-Reply-To: <mailman.2446.1339178928.855.help-gnu-emacs@gnu.org>

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

> 
> 



      parent reply	other threads:[~2012-06-08 19:19 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
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 [this message]

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=lzaa0d1ui2.wl%philippe.coatmeur@gmail.com \
    --to=philippe.coatmeur@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.