emacs - Elisp variable bind to itself -
i have elisp code this:
(setq nil) (defun testa (a) (add-to-list "abcd")) (testa 'a)
what want make a
list ("abcd")
since argument name of function testa
same variable a
, local binding of a
in function itself, doesn't bind value outside of function.
my question is: feature of elisp can't work around if don't rename variable outside or there neat solution?
this intended behavior in elisp. more information on variable scoping elisp, the manual has thorough explanation. this post job of explaining scoping.
it not possible pass reference variable. possible pass function returns or modifies globally (or dynamically) scoped variable. possible have function modifies known variable.
edit: added more detail.
Comments
Post a Comment