From: Barry Margolin <barmar@alum.mit.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: Concat var names ?
Date: Mon, 28 May 2012 00:26:37 -0400 [thread overview]
Message-ID: <barmar-2DBE50.00263728052012@news.eternal-september.org> (raw)
In-Reply-To: mailman.1785.1338177648.855.help-gnu-emacs@gnu.org
In article <mailman.1785.1338177648.855.help-gnu-emacs@gnu.org>,
XeCycle <XeCycle@Gmail.com> wrote:
> 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.
You also need to use symbol-value to get the value of the variable
instead of just its name:
(message "%s" (symbol-value (intern (concat "myvar-" suffix"))))
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
next prev parent reply other threads:[~2012-05-28 4:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-28 4:37 Concat var names ? Philippe M. Coatmeur
2012-05-28 3:59 ` XeCycle
[not found] ` <mailman.1785.1338177648.855.help-gnu-emacs@gnu.org>
2012-05-28 4:26 ` Barry Margolin [this message]
2012-05-28 7:39 ` Philippe M. Coatmeur
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=barmar-2DBE50.00263728052012@news.eternal-september.org \
--to=barmar@alum.mit.edu \
--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.