emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer M Krug <r.m.krug@gmail.com>
To: lists@manor-farm.org
Cc: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: [babel] After Tangle Change File Permission
Date: Wed, 09 Feb 2011 10:57:17 +0100	[thread overview]
Message-ID: <4D5264FD.20609@gmail.com> (raw)
In-Reply-To: <4D525B84.9060206@manor-farm.org>

-----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-----

  reply	other threads:[~2011-02-09  9:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09  9:16 [babel] After Tangle Change File Permission Ian Barton
2011-02-09  9:57 ` Rainer M Krug [this message]
2011-02-09 10:18 ` Dan Davison
2011-02-10  1:10   ` Eric Schulte

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=4D5264FD.20609@gmail.com \
    --to=r.m.krug@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=lists@manor-farm.org \
    /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).