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
# -*- 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
Ido Magal <i...@idomagal.com> 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
_______________________________________________ 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