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

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

Re: How do I use a var as a string?


From: John Mastro
Subject: Re: How do I use a var as a string?
Date: Fri, 29 Jul 2016 10:20:23 -0700

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 via email to

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