From: Nick Dokos <ndokos@gmail.com>
To: Eric S Fraga <e.fraga@ucl.ac.uk>, Nick Dokos <ndokos@gmail.com>,
"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: automatically run code blocks when loading an org-mode document
Date: Sun, 24 Jul 2016 15:24:03 -0400 [thread overview]
Message-ID: <CANU-iVARo7Y2O=eKNxa4Y=1vkS=d1MWifOQUKDKK9hZtB3EgYg@mail.gmail.com> (raw)
In-Reply-To: <87invv30gg.fsf@ucl.ac.uk>
[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]
That's a better solution indeed.
On Sun, Jul 24, 2016 at 4:27 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
> On Friday, 22 Jul 2016 at 22:11, Nick Dokos wrote:
>
> [...]
>
> > # -*- find-file-hook: org-babel-execute-buffer -*-
> > #+BEGIN_SRC emacs-lisp
> > (defun handy-stuff(arg)
> > (message arg))
> > #+END_SRC
> >
> > [[elisp:(handy-stuff "foo")][foo]]
> > [[elisp:(handy-stuff "bar")][bar]]
> >
> > will do that (but you get a question re. "safe" local variables when
> > you open the file). It also executes *every* code block in the buffer
> > which you might not want to do (although it does not matter in this
> > case).
>
> For the OP, instead of evaluating every code block, it is possible to
> evaluate just one code block. I have:
>
> # Local Variables:
> # eval: (esf/execute-startup-block)
> # End:
>
> in my org file with
>
> #+begin_src emacs-lisp
> (defun esf/execute-startup-block ()
> (interactive)
> (org-babel-goto-named-src-block "startup")
> (org-babel-execute-src-block))
> #+end_src
>
> and so only a block named startup will be executed.
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 25.0.94.1, Org
> release_8.3.4-1049-g481709
>
[-- Attachment #2: Type: text/html, Size: 1827 bytes --]
prev parent reply other threads:[~2016-07-24 19:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 21:11 automatically run code blocks when loading an org-mode document grewil3 .
2016-07-22 22:11 ` Nick Dokos
2016-07-23 4:46 ` grewil3 .
[not found] ` <4bce9e43b5d240aba4583f721502ac02@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-07-24 8:27 ` Eric S Fraga
2016-07-24 19:24 ` Nick Dokos [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANU-iVARo7Y2O=eKNxa4Y=1vkS=d1MWifOQUKDKK9hZtB3EgYg@mail.gmail.com' \
--to=ndokos@gmail.com \
--cc=e.fraga@ucl.ac.uk \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.