From: "grewil3 ." <grewil@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: automatically run code blocks when loading an org-mode document
Date: Sat, 23 Jul 2016 06:46:11 +0200 [thread overview]
Message-ID: <CAB_kak2ExuBnM9TDVbSzu=q+keEuPyARHY-gPUNFNMKu_P8YHQ@mail.gmail.com> (raw)
In-Reply-To: <87bn1pe30y.fsf@alphaville.usersys.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]
Sir, you are a great genius - many thanks!
On Sat, Jul 23, 2016 at 12:11 AM, Nick Dokos <ndokos@gmail.com> wrote:
> "grewil3 ." <grewil@gmail.com> writes:
>
> > Hi! When I load the document below, I first need to manually evaluate
> the code block before I can use
> > the links. I would like the code block to be automatically evaluated
> when I load the document, making
> > the links usable at once.
> >
> > Is there some clever in-buffer-setting I can use, to specify that I want
> the block called on loading,
> > some kind of post-load hook?
> >
> > #+BEGIN_SRC emacs-lisp
> > (defun handy-stuff(arg)
> > (message arg))
> > #+END_SRC
> >
> > [[elisp:(handy-stuff "foo")][foo]]
> > [[elisp:(handy-stuff "bar")][bar]]
> >
>
> --8<---------------cut here---------------start------------->8---
> # -*- 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]]
>
> --8<---------------cut here---------------end--------------->8---
>
> 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).
>
> --
> Nick
>
>
>
[-- Attachment #2: Type: text/html, Size: 2024 bytes --]
next prev parent reply other threads:[~2016-07-23 4:46 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 . [this message]
[not found] ` <4bce9e43b5d240aba4583f721502ac02@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-07-24 8:27 ` Eric S Fraga
2016-07-24 19:24 ` Nick Dokos
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAB_kak2ExuBnM9TDVbSzu=q+keEuPyARHY-gPUNFNMKu_P8YHQ@mail.gmail.com' \
--to=grewil@gmail.com \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).