From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Org-mode execute functions upon opening and closing Date: Sun, 11 Jan 2015 12:04:42 -0500 Message-ID: References: <2015-01-11T11-56-44@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YALwX-0006IP-Ku for emacs-orgmode@gnu.org; Sun, 11 Jan 2015 12:04:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YALwU-0004G0-Eq for emacs-orgmode@gnu.org; Sun, 11 Jan 2015 12:04:49 -0500 Received: from mail-qg0-x22e.google.com ([2607:f8b0:400d:c04::22e]:39578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YALwU-0004Fw-Bv for emacs-orgmode@gnu.org; Sun, 11 Jan 2015 12:04:46 -0500 Received: by mail-qg0-f46.google.com with SMTP id q107so14905983qgd.5 for ; Sun, 11 Jan 2015 09:04:46 -0800 (PST) In-Reply-To: (John Kitchin's message of "Sun, 11 Jan 2015 11:54:13 -0500") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Karl Voit Cc: Karl Voit , emacs-orgmode@gnu.org John Kitchin 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 writes: > >> Hello Eduardo! >> >> >> >> 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 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