Skip to content

Instantly share code, notes, and snippets.

@dakrone
Created November 2, 2015 16:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dakrone/432e60e937afbe3ea3dd to your computer and use it in GitHub Desktop.
Save dakrone/432e60e937afbe3ea3dd to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
# -*- mode: shell-script -*-
#
# Tangle .org files with org-mode
# Example usage:
# ∴ tangle nested-in-all.org
# Files: "nested-in-all.org", Dir: /Users/hinmanm/es-scripts
# Tangled 6 code blocks from nested-in-all.org
# Set this to the location of your emacs executable
EMACSCMD="emacs"
# wrap each argument in the code required to call tangle on it
DIR=`pwd`
FILES=""
for i in $@; do
echo "File: $i"
$EMACSCMD -nw --batch --eval "
(progn
(require 'org-install)
(find-file (expand-file-name \"$i\" \"$DIR\"))
(org-babel-tangle)
(kill-buffer))" 2>&1 | grep "Tangled"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment