[Top][All Lists]

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

Re: [O] help regarding babel to set in-buffer specific keybinding

From: Torsten Wagner
Subject: Re: [O] help regarding babel to set in-buffer specific keybinding
Date: Thu, 9 Feb 2012 08:32:20 +0900

Recently I started to use source code blocks as a kind of init for a certain task,  set variables,  modify stuff.  That is,  execution of a source code block once at the beginning, e.g.  after opening an org file.
Thus, I was thinking about automatically execution too. 
Would it help if there would be a approval necessary by the user.  A list of trusted organisation files could be compared to execute a start block without approval. 
Sure there are still possible attack scenarios but that's what you pay for more comfort ;)

On Feb 9, 2012 2:28 AM, "Eric S Fraga" <address@hidden> wrote:
Eric Schulte <address@hidden> writes:

> Thomas Alexander Gerds <address@hidden> writes:


>> now, I would like to tell org to evaluate the lisp code at startup, when
>> the org-file is opened. can this be achieved? particularly, is there a
>> startup special line which tells org to evaluate the lisp src block?  I
>> could add a suitable function to org-mode-hook, but is this the
>> recommended way?
>> Tomy
> There is not currently any support for evaluating specific code blocks
> on buffer open.  You could move your elisp code into a
> buffer-local-variable block (which can house functions) and which are
> evaluated when buffers are opened.  I believe all changes made in such
> blocks are buffer local, so that may be your best bet.

and I would be uncomfortable having code execute automatically upon
visiting an org file...

however, I would imagine it should be possible to add something to
org-mode-hook that would execute a predefined src code block, e.g. maybe
one named "startup" or probably a bit more specific?  I wouldn't know
the babel invocation required, mind you, but I'm others can help here!

: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs
: using Org-mode version 7.8.03 (release_7.8.03.325.g5847)

reply via email to

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