From mboxrd@z Thu Jan 1 00:00:00 1970 From: Torsten Wagner Subject: Re: help regarding babel to set in-buffer specific keybinding Date: Thu, 9 Feb 2012 08:32:20 +0900 Message-ID: References: <87ty31nzor.fsf@gmx.com> <87haz171cg.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec51d20d89887c604b87c4efc Return-path: Received: from eggs.gnu.org ([140.186.70.92]:53581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvGzw-0007Tf-3S for emacs-orgmode@gnu.org; Wed, 08 Feb 2012 18:32:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvGzu-0002sv-Kw for emacs-orgmode@gnu.org; Wed, 08 Feb 2012 18:32:24 -0500 Received: from mail-vx0-f169.google.com ([209.85.220.169]:51560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvGzu-0002so-GV for emacs-orgmode@gnu.org; Wed, 08 Feb 2012 18:32:22 -0500 Received: by vcbf13 with SMTP id f13so904377vcb.0 for ; Wed, 08 Feb 2012 15:32:20 -0800 (PST) In-Reply-To: <87haz171cg.fsf@ucl.ac.uk> 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, Eric Schulte , Thomas Alexander Gerds --bcaec51d20d89887c604b87c4efc Content-Type: text/plain; charset=ISO-8859-1 Hmmm, 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 ;) Totti On Feb 9, 2012 2:28 AM, "Eric S Fraga" wrote: > Eric Schulte writes: > > > Thomas Alexander Gerds 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 24.0.92.1 > : using Org-mode version 7.8.03 (release_7.8.03.325.g5847) > > > --bcaec51d20d89887c604b87c4efc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

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

On Feb 9, 2012 2:28 AM, "Eric S Fraga"= <e.fraga@ucl.ac.uk> wrote:<= br type=3D"attribution">
Eric Schulte <eric.schulte@gmx.c= om> writes:

> Thomas Alexander Gerds <tagte= am@sund.ku.dk> 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 the= re a
>> startup special line which tells org to evaluate the lisp src bloc= k? =A0I
>> 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. =A0You could move your elisp code into a
> buffer-local-variable block (which can house functions) and which are<= br> > evaluated when buffers are opened. =A0I believe all changes made in su= ch
> 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? =A0I wouldn&= #39;t know
the babel invocation required, mind you, but I'm others can help here!<= br>
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.92.1
: using Org-mode version 7.8.03 (release_7.8.03.325.g5847)


--bcaec51d20d89887c604b87c4efc--