From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: automatically run code blocks when loading an org-mode document Date: Sun, 24 Jul 2016 09:27:27 +0100 Message-ID: <87invv30gg.fsf@ucl.ac.uk> References: <4bce9e43b5d240aba4583f721502ac02@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> Reply-To: Eric S Fraga Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRHTV-0003TG-0Q for emacs-orgmode@gnu.org; Sun, 24 Jul 2016 07:21:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRHTP-00041J-19 for emacs-orgmode@gnu.org; Sun, 24 Jul 2016 07:21:35 -0400 Received: from mail-db5eur01on0104.outbound.protection.outlook.com ([104.47.2.104]:38016 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRHTO-0003sP-NF for emacs-orgmode@gnu.org; Sun, 24 Jul 2016 07:21:30 -0400 In-Reply-To: <4bce9e43b5d240aba4583f721502ac02@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> (Nick Dokos's message of "Fri, 22 Jul 2016 22:11:57 +0000") 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" To: Nick Dokos Cc: "emacs-orgmode@gnu.org" 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