- publishing free software manuals
The Org Mode 7 Reference Manual
by Carsten Dominik and others
Paperback (6"x9"), 282 pages
ISBN 9781906966089
RRP £9.95 ($14.95)

Sales of this book support the Org project! Get a printed copy>>>

14.12 Batch execution

It is possible to call functions from the command line. This shell script calls org-babel-tangle on every one of its arguments.

Be sure to adjust the paths to fit your system.

#!/bin/sh
# -*- mode: shell-script -*-
#
# tangle files with org-mode
#
DIR=`pwd`
FILES=""
ORGINSTALL="~/src/org/lisp/org-install.el"

# wrap each argument in the code required to call tangle on it
for i in $@; do
        FILES="$FILES \"$i\""
done

emacs -Q --batch -l $ORGINSTALL \
--eval "(progn
(add-to-list 'load-path (expand-file-name \"~/src/org/lisp/\"))
(add-to-list 'load-path (expand-file-name 
                         \"~/src/org/contrib/lisp/\"))
(require 'org)(require 'org-exp)
(require 'ob)(require 'ob-tangle)
(mapc (lambda (file)
       (find-file (expand-file-name file \"$DIR\"))
       (org-babel-tangle)
       (kill-buffer)) '($FILES)))" 2>&1 |grep tangled
ISBN 9781906966089The Org Mode 7 Reference ManualSee the print edition