emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Embedded code


From: Rainer M Krug
Subject: Re: [Orgmode] Embedded code
Date: Tue, 18 Jan 2011 17:44:57 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14pre) Gecko/20110114 Lightning/1.0b2 Shredder/3.1.8pre

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/18/2011 05:16 PM, Eric Schulte wrote:
> Rainer M Krug <address@hidden> writes:
> 
>> On 01/18/2011 12:48 AM, Eric Schulte wrote:
>>> Hi,
>>>
>>> This is possible using Babel, the attached org-mode file will execute
>>> its code block every time it is opened.  You can replace the contents of
>>> the code block with any arbitrary elisp you would like to have executed
>>> in the file.
>>>
>>> To see this work, save the attached org-mode file to your system, open
>>> the file, answer "y" to allow execution, and then check your messages
>>> buffer for the "I have been run" message to see that the code block has
>>> in fact been evaluated.
>>
>> This is indeed very useful (e.g. if I open an R script, to open an R
>> session and source the file).
>>
>> But it seems that all code blocks are evaluated on loading. Is there a
>> way of only executing a specific code block?
>>
> 
> Yes, replace the 
> 
> # -*- eval: (org-babel-execute-buffer) -*-
> 
> with
> 
> # -*- eval: (save-excursion (org-babel-goto-named-src-block NAME) 
> (org-babel-execute-src-block)) -*-
> 
> where NAME is replaced with the name of the code block to execute.

Thanks - sounds perfect.

Cheers,

Rainer

> 
> Cheers -- Eric


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      address@hidden

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk01w4kACgkQoYgNqgF2egpHFACfaspSlVeXg9oQ6Dr5zJIsEN1z
zT0An2UoPkOi6GiQcmZfzKiFTbQgrCex
=eICm
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]