From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: How define a hook function for `org-babel-post-tangle-hook' for a single file? Date: Sun, 03 Jan 2016 14:08:21 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFo0w-0000Sh-Ta for emacs-orgmode@gnu.org; Sun, 03 Jan 2016 14:08:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aFo0t-00075m-Ni for emacs-orgmode@gnu.org; Sun, 03 Jan 2016 14:08:26 -0500 Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]:35793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFo0t-00075i-Iq for emacs-orgmode@gnu.org; Sun, 03 Jan 2016 14:08:23 -0500 Received: by mail-qg0-x22d.google.com with SMTP id o11so241700783qge.2 for ; Sun, 03 Jan 2016 11:08:23 -0800 (PST) In-reply-to: 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: Grant Rettke Cc: "emacs-orgmode@gnu.org" It sounds a little circular. This org-file adds a hook function when loaded. Maybe you can adapt something like this? ymmv... #+BEGIN_SRC emacs-lisp :tangle my-local-hook.el (+ 9 9) #+END_SRC * hook function #+name: my-hook-function #+BEGIN_SRC emacs-lisp (defun my-special-hook () (message-box "tangled from org")) #+END_SRC #+RESULTS: my-hook-function : my-special-hook # Local Variables: # eval: (progn (re-search-forward "my-hook-function") (org-babel-execute-src-block) (add-hook 'org-babel-post-tangle-hook 'my-special-hook)) # End: Grant Rettke writes: > Good morning, > > * Desire > > - I've got a file X > - I've got a hook function H > - It does post-processing, copying the tangled results to different > directories > - I want to defined H in X > - I want H to be evaluated and run when X is tangled > > * Research > > - Emacs 25, Org Git current > - org-babel-post-tangle-hook > - File local variables and eval > > * Question > > What is the best way to do something like this? > > Sincerely, > > Grant Rettke -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu