From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Write org variables into own R environment instead of .GlobalEnv Date: Tue, 18 Mar 2014 15:18:20 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPuqw-0007qT-1n for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 10:18:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPuqo-0007S9-Ov for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 10:18:50 -0400 Received: from plane.gmane.org ([80.91.229.3]:46222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPuqo-0007Ry-HU for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 10:18:42 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WPuqh-0000FD-Df for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 15:18:35 +0100 Received: from arn78-1-88-186-171-7.fbx.proxad.net ([88.186.171.7]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Mar 2014 15:18:35 +0100 Received: from Rainer by arn78-1-88-186-171-7.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Mar 2014 15:18:35 +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 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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=3Dwhen 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=3D"/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, Cheers, Rainer =2D-=20 Rainer M. Krug email: RMKruggmailcom PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJTKFWxAAoJENvXNx4PUvmCyrEH/iU1aJGy5/lchk0t6iB6BtdK NXnVNi8iH4m5Spwsajz180Aduv+biojjfuFeFYEtPVFj1hyTg1sf160m4YBixBHX LJMEGA08zgpwDCs4Y9wvgNtyIgkJcSov/yxB+NVaarJ3hqZCzokSFvmGkD5IMGy9 WkqCPA+H6zNoa28ABMET4ARMoPebtm7lGT+wmRiPdcDd6IgyepH9IatcReugUxWc smSpMSuqfvxOt9P4A4ai+mbqBAEWE2iJgGGDP6iWzSgm5RINqU3+OCyZRKMKOEWd fq17i2eKBzGpGTZ/0tPtoaZsJXVegQz/Jn8O9KoI6miDkixvJuDdrzHP1reqQt0= =RDlf -----END PGP SIGNATURE----- --=-=-=--