unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: John Mastro <john.b.mastro@gmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Cc: Tom Browder <tom.browder@gmail.com>
Subject: Re: How do I use a var as a string?
Date: Fri, 29 Jul 2016 10:20:23 -0700	[thread overview]
Message-ID: <CAOj2CQS6N+7SYWBFpisJFATZAYQfWpCFxafdQhU-OP1vxDhzTg@mail.gmail.com> (raw)
In-Reply-To: <CAFMGiz8Yp8JR5HPvcz2fqLxzsDjKMKnVqjBASb5TBAOR0xWGgg@mail.gmail.com>

Tom Browder <tom.browder@gmail.com> wrote:
> Here is the best I can do for the moment to show my actual problem.
> The code is from an attempt at modifying the following code chunk
> which is part of the file "perl6-imenu.el" (branch "my-branch") found
> at my github account at:
>
>   https://github.com/tbrowder/perl6-mode
>
> The working code chunk is at:
>
>   https://gist.github.com/tbrowder/effb3ed0540591506015846b0511a045
>
> and the chunk I'm trying to replace it with is here:
>
>   https://gist.github.com/tbrowder/7959e77fcf5aee4be3edb342503cc282
>
> The substitution of the explicit regex with the string var doesn't
> work.  It may be because of some problem with the scope of the
> variables, and that is WAY beyond my elisp understanding at the
> moment.

I haven't followed this discussion in detail, but try this[1].

You used a quoted list in your definition of
perl6-imenu-generic-expression, meaning the list isn't evaluated,
meaning it contained the symbol `perl6-vars' rather than the value bound
to that symbol (the regular expression you constructed). Instead, you
probably want to use backquote.

This is all a bit difficult to explain succinctly in an email, but this
is a common point of confusion so there's plenty of material on "quote"
and "backquote" (or sometimes "quasiquote") in Lisp out there. In
Emacs's Elisp manual, check out the node "(elisp) Backquote".

[1] https://gist.github.com/johnmastro/53535e8cbddf7c669788bc2a9105f70e

Hope that helps

        John



  reply	other threads:[~2016-07-29 17:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28 16:42 How do I use a var as a string? Tom Browder
2016-07-28 16:47 ` Drew Adams
2016-07-28 17:11   ` Tom Browder
     [not found]   ` <mailman.2218.1469725870.26859.help-gnu-emacs@gnu.org>
2016-07-29  2:39     ` Emanuel Berg
2016-07-29 14:50 ` Tom Browder
2016-07-29 14:59   ` Drew Adams
2016-07-29 15:06     ` Tom Browder
2016-07-29 16:52 ` Tom Browder
2016-07-29 17:20   ` John Mastro [this message]
2016-07-29 17:24     ` John Mastro
2016-07-29 17:56       ` Tom Browder
2016-07-29 18:39         ` Tom Browder
     [not found] <mailman.2209.1469724157.26859.help-gnu-emacs@gnu.org>
2016-07-28 16:46 ` Emanuel Berg

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=CAOj2CQS6N+7SYWBFpisJFATZAYQfWpCFxafdQhU-OP1vxDhzTg@mail.gmail.com \
    --to=john.b.mastro@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tom.browder@gmail.com \
    /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).