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

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

Re: Concat var names ?


From: XeCycle
Subject: Re: Concat var names ?
Date: Mon, 28 May 2012 11:59:26 +0800
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux)

Philippe M. Coatmeur <philippe.coatmeur@gmail.com> writes:

> Hi ; I have those two functions and I want to make them one :
>
> (defun mail-bug-desktop-notify-one ()
>   (mapcar
>    (lambda (x)
>      (if (not (member x mail-bug-advertised-mails-one))
>        (progn
>          (mail-bug-desktop-notification
>           (format "%s" (first x))
>           (format "%s \n%s" (second x)
>                   (third x))
>           "5000" mail-bug-new-mail-icon-one)
>          (add-to-list 'mail-bug-advertised-mails-one x))))
>    mail-bug-unseen-mails-one))
>
> But I have to create distinct lists, so I'd really like to be able to
> say
>
> (setq suffix "plop")
> (setq myvar-plop "value")
> (message "%s" (concat "myvar-" suffix))
>
> And get "myvar-value" instead of myvar-plop... 

Check what `intern' does.

> Or even better, to use the same mechanism, a mapcar, but what about
> the creation of mail-bug-advertised-mails-SUFFIX ? How do I instruct
> my function to tell one list from the other ?
>
> Phil
>

-- 
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591

Attachment: pgpfEk81sGydE.pgp
Description: PGP signature


reply via email to

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