I have a directory ~/foo/
with hundreds of org documents among other types of files. I want to export each org file to ASCII. The only way I know how to do this is to follow the following procedure
- open each file with emacs and issue
C-c C-e t a
- answer
yes
to the questionEvaluate this emacs-lisp code block on your system?
Can this procedure be automated from the command line?
Update: with the help of @zck's answer, my script now looks like
#!/bin/bash
for file in ~/foo/*.org; do
emacs --batch -l ~/.emacs \
--eval "(require 'org)" \
--insert "${file}" \
--eval "(org-ascii-export-as-ascii nil nil nil nil '(:ascii-charset ascii))" \
--eval "(write-file \"${file}.report\")" \
--kill
done
This does the job but... I have to answer "yes" to the question Evaluate this emacs-lisp code block on your system?
for each file. Is there a way to automatically answer yes
to this question?