From: Philippe M. Coatmeur <philippe.coatmeur@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Concat var names ?
Date: Mon, 28 May 2012 07:39:14 +0000 [thread overview]
Message-ID: <lzk3zwvjod.wl%philippe.coatmeur@gmail.com> (raw)
In-Reply-To: <barmar-2DBE50.00263728052012@news.eternal-september.org>
At Mon, 28 May 2012 00:26:37 -0400,
Barry Margolin wrote:
>
> 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 :
(...)
> > >
> > > 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"))))
Guys, thank you very much, it works like a charm, and with
"symbol-value" I can do pretty much whatever I want with the object
returned.
Phil
>
> --
> Barry Margolin, barmar@alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***
prev parent reply other threads:[~2012-05-28 7:39 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
2012-05-28 7:39 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=lzk3zwvjod.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).