New answers tagged

2

You can use symbol-value to look up dynamically bound variables. The easiest way to ensure that is by using defvar/defconst/defcustom for such variables, that way they'll always be dynamically bound, even with lexical-binding enabled. Plain setq will not do as soon as lexical binding is used and is discouraged for defining variables for that reason. To ...


1

You can eval to recover the value of a variable symbol. To modify it you can use setf: (setq x 1) (setq xref 'x) (eval xref) ;; Returns 1 (setf (symbol-value xref) 2) (eval xref) ;; Returns 2 The value of x is now 2 setf is the generalized version of setq that lets you place values in arbitrary "places" within an object. For example you can change ...


Top 50 recent answers are included