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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -