From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Embedded code Date: Mon, 17 Jan 2011 16:48:20 -0700 Message-ID: <87aaizhz23.fsf@gmail.com> References: <2324250583714673900@unknownmsgid> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=48235 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PeyoI-0003a1-Ef for emacs-orgmode@gnu.org; Mon, 17 Jan 2011 18:48:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PeyoE-0001IH-U0 for emacs-orgmode@gnu.org; Mon, 17 Jan 2011 18:48:28 -0500 Received: from mail-iy0-f169.google.com ([209.85.210.169]:40044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PeyoE-0001I9-MA for emacs-orgmode@gnu.org; Mon, 17 Jan 2011 18:48:26 -0500 Received: by iyj17 with SMTP id 17so5877889iyj.0 for ; Mon, 17 Jan 2011 15:48:26 -0800 (PST) In-Reply-To: (Ido Magal's message of "Mon, 17 Jan 2011 14:01:19 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Ido Magal Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi, This is possible using Babel, the attached org-mode file will execute its code block every time it is opened. You can replace the contents of the code block with any arbitrary elisp you would like to have executed in the file. To see this work, save the attached org-mode file to your system, open the file, answer "y" to allow execution, and then check your messages buffer for the "I have been run" message to see that the code block has in fact been evaluated. Best -- Eric --=-=-= Content-Type: text/org Content-Disposition: inline; filename=code-on-startup.org # -*- eval: (org-babel-execute-buffer) -*- #+Title: Evaluates code on startup * contents * COMMENT statup code #+begin_src emacs-lisp :results silent (message "I have been run") #+end_src --=-=-= Content-Type: text/plain Ido Magal writes: > Hello, > > Is it possible to put a block of code in a document such that it gets > evaluated when the document is opened? For example, I'd like to have > a link-back section in each note. > > I'm aware of babel but I neither understand how to make it auto-evaluate on > open nor do i know if > making it compact ( and avoid having code and result blocks ) is possible. > I see examples where it's used for export but haven't seen one for general > org usage. > > Thanks in advance. > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--