I simply need to take the output of org-element-parse-buffer
and put it in a file -- maybe with some "if-does-not-exist" etc. bells and whistles. In CL I have with-open-file
and write
as tools. For example, here's CL to read a file containing lines like foo=bar
and output to a new file like this (foo . bar)
(defun arabic_to_roman (filename)
(cl-flet ((read-it ()
(with-open-file (in filename
:direction :input
:if-does-not-exist nil)
(loop for line = (read-line in nil)
for pos = (position \= line)
while line collect (cons (subseq line 0 pos)
(subseq line (1+ pos))))))
(write-it (list)
(with-open-file (cl-stream #p"ar_out.txt"
:direction :output
:if-exists :overwrite
:if-does-not-exist :create)
(write list :stream stream :escape nil :readably nil :pretty nil))))
(write-it (read-it))
'done-read-write))
This is someone abstruse compared to other languages -- but then I don't find anything like this in elisp. How is read-write done in elisp. What I find seems only buffer-oriented. . . .