emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <johnrkitchin@gmail.com>
To: Karl Voit <devnull@Karl-Voit.at>
Cc: Karl Voit <news1142@Karl-Voit.at>, emacs-orgmode@gnu.org
Subject: Re: Org-mode execute functions upon opening and closing
Date: Sun, 11 Jan 2015 12:04:42 -0500	[thread overview]
Message-ID: <m2387h1c5x.fsf@gmail.com> (raw)
In-Reply-To: <m2bnm51cne.fsf@gmail.com> (John Kitchin's message of "Sun, 11 Jan 2015 11:54:13 -0500")

John Kitchin <johnrkitchin@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 <devnull@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.mercovich@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

      reply	other threads:[~2015-01-11 17:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 19:43 Org-mode execute functions upon opening and closing Eduardo Mercovich
2015-01-11 11:01 ` Karl Voit
2015-01-11 16:54   ` John Kitchin
2015-01-11 17:04     ` John Kitchin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2387h1c5x.fsf@gmail.com \
    --to=johnrkitchin@gmail.com \
    --cc=devnull@Karl-Voit.at \
    --cc=emacs-orgmode@gnu.org \
    --cc=news1142@Karl-Voit.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).