From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: [babel] After Tangle Change File Permission Date: Wed, 09 Feb 2011 10:57:17 +0100 Message-ID: <4D5264FD.20609@gmail.com> References: <4D525B84.9060206@manor-farm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=41203 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pn6nb-0001p3-R8 for emacs-orgmode@gnu.org; Wed, 09 Feb 2011 04:57:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pn6na-0007Ug-Cy for emacs-orgmode@gnu.org; Wed, 09 Feb 2011 04:57:23 -0500 Received: from mail-bw0-f41.google.com ([209.85.214.41]:60834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pn6na-0007UR-5z for emacs-orgmode@gnu.org; Wed, 09 Feb 2011 04:57:22 -0500 Received: by bwz16 with SMTP id 16so759258bwz.0 for ; Wed, 09 Feb 2011 01:57:21 -0800 (PST) In-Reply-To: <4D525B84.9060206@manor-farm.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: lists@manor-farm.org Cc: Org Mode Mailing List -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 02/09/2011 10:16 AM, Ian Barton wrote: > I am starting to use babel to maintain my collection of shell scripts. I > want to automate the process as much as possible, so I would like to be > able to set the execute bit on my tangled .sh scripts after the tangle > process. > > I see that there is an after-tangle hook. Can anyone give me some hints > as to how I might use this to execute a chmod *.sh on the directory > containing my tangles shell scripts. Below an example how I use this: 1) I create a postTangleScript.sh, which I want to execute after tangling. In this script, I put all the things I want to do. 2) I set the post-tangle-hook, so that the script is executed. 3) if you want to have the name of the tangled file automatically in your post tangle script, you can use variables (but don't ask me how to get the name of the tangled file) Hope this helps, Rainer * Internal configurations :noexport: ** Post tangle script #+begin_src sh :tangle postTangleScript.sh :var BUFFERFILENAME=(buffer-file-name) # do whatever #+end_src ** Evaluate to run post tangle script #+begin_src emacs-lisp :results silent :tangle no :exports none (add-hook 'org-babel-post-tangle-hook ( lambda () (call-process-shell-command "./postTangleScript.sh" nil 0 nil) ) ) #+end_src > > Ian. > > _______________________________________________ > 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 - -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Natural Sciences Building Office Suite 2039 Stellenbosch University Main Campus, Merriman Avenue Stellenbosch South Africa Tel: +33 - (0)9 53 10 27 44 Cell: +27 - (0)8 39 47 90 42 Fax (SA): +27 - (0)8 65 16 27 82 Fax (D) : +49 - (0)3 21 21 25 22 44 Fax (FR): +33 - (0)9 58 10 27 44 email: Rainer@krugs.de Skype: RMkrug -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1SZP0ACgkQoYgNqgF2egogZACeK/GohKqClBenIaVsvqSboC/f bX4AnA8+lCDUON76x7hFVAGTbmJv9zIA =WgSG -----END PGP SIGNATURE-----