Reputation: 6032
I'm writing a function that I want to operate on one of a number of different global variables (in this case global-mark-list, a buffers mark-list or an arbitrary list of marks). As the function is called from a tabulated-menu function I need to stash the reference in a buffer local variable for later access.
What's the best way to handle this is elisp? Looking through the manual there is mention of defvaralias and indirect-variable but this seems more set up for permanent global aliasing rather than a temporary reference. Am I missing some subtly of lisp that means this should be very easy?
Upvotes: 0
Views: 331
Reputation: 28531
In Emacs's trunk (to become 24.4) you can also use gv-ref
and gv-deref
, which work similarly to C's &
and *
respectively.
Upvotes: 2
Reputation: 17707
Save the variable's name as a symbol and use symbol-value
or eval
.
A lot of dynamic languages have eval
.
Upvotes: 3