Matthew Oesting
2012-08-13 18:15:45 UTC
I recently wrote what I thought to be a very simply she'll script to tangle a file; simply call the script on a file, e.g. 'tangle corgi.org' and a file, 'corgi.rb' (assuming one uses Ruby) appears in the local directory.
Tangling the file from within Emacs works normally. Tangling from this script does not work; the only interesting response is "tangled 0 code blocks from corgi.org". The same file tangles two blocks from within Emacs.
It seems that the org-babel-tangle function is using some piece of information present in the normal Emacs loading sequence which is not found during the script load. I could provide a large number of files, but I imagine that the problem will be obvious to someone here.
What is wrong with this code?
#!/usr/bin/emacs --script
;; The subdirectory ~/.emacs.d is to be added to the top-level elisp
;; file search.
(progn (cd "~/.emacs.d") (normal-top-level-add-subdirs-to-load-path))
;; Org-Mode, Org-Babel, and the tangle library are required, if we are
;; to proceed further.
(require 'org-install)
(require 'org)
(require 'ob-tangle)
;; Load the main configuration and setup file.
(require 'ob-ruby)
(require 'ob-python)
(require 'ob-emacs-lisp)
(require 'ob-lisp)
;; Tangle all files given.
(dolist (file command-line-args-left)
(princ file)
(org-babel-tangle-file file))
Tangling the file from within Emacs works normally. Tangling from this script does not work; the only interesting response is "tangled 0 code blocks from corgi.org". The same file tangles two blocks from within Emacs.
It seems that the org-babel-tangle function is using some piece of information present in the normal Emacs loading sequence which is not found during the script load. I could provide a large number of files, but I imagine that the problem will be obvious to someone here.
What is wrong with this code?
#!/usr/bin/emacs --script
;; The subdirectory ~/.emacs.d is to be added to the top-level elisp
;; file search.
(progn (cd "~/.emacs.d") (normal-top-level-add-subdirs-to-load-path))
;; Org-Mode, Org-Babel, and the tangle library are required, if we are
;; to proceed further.
(require 'org-install)
(require 'org)
(require 'ob-tangle)
;; Load the main configuration and setup file.
(require 'ob-ruby)
(require 'ob-python)
(require 'ob-emacs-lisp)
(require 'ob-lisp)
;; Tangle all files given.
(dolist (file command-line-args-left)
(princ file)
(org-babel-tangle-file file))