10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-14 01:53:39 +01:00
QCaml/bin/tangle.sh

102 lines
2.2 KiB
Bash
Raw Normal View History

2020-12-28 01:55:03 +01:00
#!/bin/bash
# Usage: $0 [DIR]
if [[ -z $1 ]] ; then
echo "Usage: $0 [DIR]"
exit -1
fi
if [[ $(basename $PWD) != "QCaml" ]] ; then
echo "This script needs to be run in the QCaml directory"
exit -1
fi
DIR=${1%/}
2020-12-29 01:08:37 +01:00
cat << EOF > ${PWD}/tmpfile_$DIR
2020-12-28 01:55:03 +01:00
(package-initialize)
(add-to-list 'package-archives
'("gnu" . "https://elpa.gnu.org/packages/"))
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(setq package-archive-priorities '(("melpa-stable" . 100)
("melpa" . 50)
("gnu" . 10)))
(require 'cl)
(let* ((required-packages
'(dash
htmlize
ess
evil
gnuplot
tuareg
tramp
bibtex-completion
org-ref
org-gnome
org-evil
org-bullets
org-mime
magit
rustic
auctex))
(missing-packages (remove-if #'package-installed-p required-packages)))
(when missing-packages
(message "Missing packages: %s" missing-packages)
(package-refresh-contents)
(dolist (pkg missing-packages)
(package-install pkg)
(message "Package %s has been installed" pkg))))
(setq org-alphabetical-lists t)
(setq org-src-fontify-natively t)
(setq org-src-preserve-indentation t)
(setq org-confirm-babel-evaluate nil)
(org-babel-do-load-languages
'org-babel-load-languages
'(
(emacs-lisp . t)
(shell . t)
(python . t)
(C . t)
(ocaml . t)
(gnuplot . t)
(latex . t)
(ditaa . t)
(dot . t)
(org . t)
(makefile . t)
))
(setq pwd (file-name-directory buffer-file-name))
(setq name (file-name-nondirectory (substring buffer-file-name 0 -4)))
(setq lib (concat pwd "lib/"))
(setq testdir (concat pwd "test/"))
(setq mli (concat lib name ".mli"))
(setq ml (concat lib name ".ml"))
(setq c (concat lib name ".c"))
(setq test-ml (concat testdir name ".ml"))
(org-babel-tangle)
EOF
cd $DIR
for i in *.org
do
echo "--- $i ----"
2020-12-29 01:08:37 +01:00
emacs --batch ./$i --load=../tmpfile_$DIR
2020-12-28 01:55:03 +01:00
done
2020-12-29 01:08:37 +01:00
rm ../tmpfile_$DIR
2020-12-28 01:55:03 +01:00