John Kitchin <johnrkitc...@gmail.com> writes: I guess this technically only runs when you open it.
To run something on closing, you might add something to kill-buffer-hook. That function would need to check if it should run, e.g. if you are closing an org-buffer that meets some criteria. You could also look at find-file-hook for an alternative to opening. > * Load lisp code on opening an org-file > > Put this at the end of your org-file: > #+BEGIN_EXAMPLE > ### Local Variables: > ### mode: org > ### eval: (load-file "my-lib.el") > ### End: > #+END_EXAMPLE > > Create my-lib.el, e.g. > > #+BEGIN_SRC emacs-lisp :tangle my-lisp.el > (message-box "Loaded!") > #+END_SRC > > The next time you open this file, you will be prompted whether to eval > the local variable. Type y to approve it once, or ! to approve it > forever. You can put whatever you want in this library. > > ### Local Variables: > ### mode: org > ### eval: (load-file "my-lib.el") > ### End: > > > > Karl Voit <devn...@karl-voit.at> writes: > >> Hello Eduardo! >> >> <shameless plug> >> >> This is not an answer to your original question regarding hooks >> where http://www.emacswiki.org/emacs/LocalVariables together with a >> bit of Elisp might be a possible solution. >> >> However, we seem to share the same mind-set or motivation to use >> Org-mode in order to get independent from any cloud-based or closed >> source service. >> >> * Eduardo Mercovich <eduardo.mercov...@gmail.com> wrote: >>> >>> The big plan (rant for another thread) is to eventually integrate all >>> the information I use into this system, as many already did: >>> * people (org-contacts, BBDB, google-contacts, other?), >>> * events (calfw+org-mode?) >>> * mail (mu4e in my case, but there are other possible tools too). >>> * documents (org-mode itself) >>> * references (org-mode itself) >>> * etc. >> >> You might be interested in taking a look at Memacs (URL below) and >> http://karl-voit.at/2014/12/03/emacs-chat + other blog posts there. > > -- > ----------------------------------- > John Kitchin > Professor > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > http://kitchingroup.cheme.cmu.edu > > -- ----------------------------------- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu