;;-*-mode: emacs-lisp; coding: utf-8;-*-
;; Copyright: 2016 Mitchell Tishmack
;; Tangle an org mode file with babel using emacs.
(require 'org-install)
(require 'org)

(defun tangle/yn (p) (if (bound-and-true-p p) "yes" "no"))
(defun tangle/file (file p) (if (eval p) (concat "tmp/" file) "no"))

(if (getenv "USEROPTS")
    (dolist (fnam (split-string (getenv "USEROPTS") ":"))
      (if (not (member fnam '("" nil)))
          (if (file-readable-p (concat "./options/" fnam ".el"))
              (load-file (concat "./options/" fnam ".el")))
        ))
  )

;; Iterate through all the files given and tangle them
(dolist
    (file command-line-args-left)
  (print (format "tangling: %s" file))
  (org-babel-tangle-file file))
