From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: Write org variables into own R environment instead of .GlobalEnv Date: Tue, 18 Mar 2014 22:10:30 +0100 Message-ID: <87siqfciwp.fsf@med.uni-goettingen.de> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQ1Hf-0005zU-BJ for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 17:10:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQ1HY-0001aB-9o for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 17:10:51 -0400 Received: from plane.gmane.org ([80.91.229.3]:51711) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQ1HY-0001Zo-2V for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 17:10:44 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WQ1HW-0008Tw-Hf for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 22:10:42 +0100 Received: from vpn-2033.gwdg.de ([134.76.2.33]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Mar 2014 22:10:42 +0100 Received: from andreas.leha by vpn-2033.gwdg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Mar 2014 22:10:42 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Rainer, Rainer M Krug writes: > Hi > > I just send a patch which changes the behaviour of how org variables are > treated in R. At the moment, org variables are simply stored in the > .GlobalEnv which means, that all show up in the variable listing (which > can get cluttered when having many variables), they can accidentaly be > deleted and not be restored from within R and saving all the variables > into from R to make them available after tangling is not that easy. > > Therefore the patch writes the variables into their own environment > (which I simply called org) and locks the environment and the > bindings. This means, that the actual variable values are always in the > environment and can not be accidentally deleted. As the environment is > attached to the search path, they are accessible as before, but they do > not clutter the workspace and do not show up separately e=when using > ls() to list the contents of the workspace. When using ls(org) all can > be seen. > > They can still be "overwritten", but but this only creates a new > variable of the ame name in the .GlobalEnv which is simply hidint the > original variable passed from org. The original variable can be accessed > via org$VARIABLENAME. When removing the defined variable VARIABLENAME > via rm(VARIABLENAME), the value passed from org is back. > > In addition, all variables can be easily be saved to disk by using > save(org, file="/PATH/TO/FILE.Rdata") and reloaded with > (load("/PATH/TO/FILE.Rdata")). This mechanism could actually be included > into tangling as the default mechanism to load the variables to avoid > cluttering the code with all the assignment commands of the org > variables. > > The patch is not yet extensively tested. > Please provide some feedback about the idea and implementation, Currently I lack the time to test the patch. So, this is just a (not-so-helpful) feedback on the idea: Seems to be very good! Regards, Andreas