Re: [Orgmode] export (as latex) a large number of org files in a directory
Thanks yet again! That makes sense... works now!! > I tried your code with both > > > orglib=/Applications/Emacs.app/Contents/Resources/lisp/org > > and > > orglib=$HOME/elisp/org-mode/lisp > > You need the former - the latter is where I keep my org.el[c] (sorry, forgot to mention that I created and copied my files to the latter directory to try it out) > #! /bin/bash > > orglib=/Applications/Emacs.app/Contents/Resources/lisp/org > emacs --batch \ > --eval "(add-to-list 'load-path \"$orglib\")" \ # need a backslash here. > --load=$orglib/org.elc \ > --eval "(setq org-export-headline-levels 2)" \ > --visit=$1 --funcall org-export-as-latex-batch > (yes, caught that!) Thanks again very much, Nick - this had been on my mind for a while. Stephen ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] export (as latex) a large number of org files in a directory
Hi Nick, thanks for the response! Actually in the code that I had pasted, the emacs --batch call is all on one line (so no need to escape newlines there). I tried your code with both orglib=/Applications/Emacs.app/Contents/Resources/lisp/org and orglib=$HOME/elisp/org-mode/lisp but got Cannot open load file: org-macs in both cases I also added a line, --eval "(load \"/Applications/Emacs.app/Contents/Resources/lisp/org/org.elc\")" \ to replace the --load option but same deal. I do in fact have org-macs in my 'orglib' directories so I tried loading them explicitly (with multiple --load specifications), but it still doesn't work (Still "Cannot open load file" pointing to some org file or subst-ksc, depending on how many or in what order org .el files are loaded). Any more ideas? Thanks...! Stephen - Original Message From: Nick Dokos To: Stephen Tucker Cc: emacs-orgmode@gnu.org; nicholas.do...@hp.com Sent: Sunday, August 30, 2009 8:04:06 AM Subject: Re: [Orgmode] export (as latex) a large number of org files in a directory Stephen Tucker wrote: > Hi, I am trying to export a bunch of .org files stored in a directory as > latex files. I have tried two methods: > > (1) > --- > At the bash prompt (I am using OS X): > > bash$ emacs --batch > --load=/Applications/Emacs.app/Contents/Resources/lisp/org/org.elc > --visit=file.org --funcall org-export-as-latex-batch' > > and I get an error: > "Cannot open load file: subst-ksc" > > If I can get this to work, then I can embed this system call in a shell > script and call it iteratively on a list of .org files retrieved from, say, > Python or Bash (changing 'file.org' appropriately each time). > Did you escape the newlines? If you cut-n-pasted from the org-export-as-latex-batch help, you fell into the trap :-) Maybe the documentation of the function could be changed to add the backslashes? The following script (I call it org-to-latex) works fine on linux: --8<---cut here---start->8--- #! /bin/bash orglib=$HOME/elisp/org-mode/lisp emacs --batch \ --load=$orglib/org.elc \ --eval "(setq org-export-headline-levels 2)" \ --visit=$1 --funcall org-export-as-latex-batch --8<---cut here---end--->8--- You can add a loop in it too - or do the loop by hand: --8<---cut here---start->8--- for x in *.org do org-to-latex $x done --8<---cut here---end--->8--- HTH, Nick ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] export (as latex) a large number of org files in a directory
Hi, I am trying to export a bunch of .org files stored in a directory as latex files. I have tried two methods: (1) --- At the bash prompt (I am using OS X): bash$ emacs --batch --load=/Applications/Emacs.app/Contents/Resources/lisp/org/org.elc --visit=file.org --funcall org-export-as-latex-batch' and I get an error: "Cannot open load file: subst-ksc" If I can get this to work, then I can embed this system call in a shell script and call it iteratively on a list of .org files retrieved from, say, Python or Bash (changing 'file.org' appropriately each time). (2) --- I created the following function which is intended to take a filename argument, load it into a temporary buffer, and export that buffer as a latex file. I thought to apply (map) this function to a list of file names generated by the directory-files() function. (defun orgexpastex (filenm) (let (buffer-file-name) (with-temp-buffer (setq buffer-file-name "test") (insert-file-contents filenm) (org-export-as-latex 3)) ;;or (org-export-as-latex-batch)) ) ) But, upon testing this function, (orgexpastex "file.org") I get [-] = =*Backtrace*-- Debugger entered--Lisp error: (wrong-type-argument stringp nil) re-search-forward(nil nil t) org-export-remove-headline-metadata((:for-LaTeX t :emph-multiline t :add-text nil :comments nil :skip-before-1st-heading nil :LaTeX-fragments nil :timestamps t :footnotes t)) org-export-preprocess-string("" :for-LaTeX t :emph-multiline t :add-text nil :comments nil :skip-before-1st-heading nil :LaTeX-fragments nil :timestamps t :footnotes t) org-export-latex-first-lines((:latex-image-options "width=10em" :exclude-tags ("noexport") :select-tags ("export") :auto-postamble t [...snip...] --- I wonder if it is obvious to anyone what I am doing wrong, or if there is a better way to go about exporting a bunch of org files with a program. Thanks much! Stephen ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode