Re: [O] Exporting a given file (not buffer)

2015-02-13 Thread Sebastien Vauban
Marcin Borkowski wrote:
 I need a function, which – given an org file's name – opens it silently,
 exports to a file, and closes.

 I can write it myself, but maybe such a function already exists?  It
 seems that `org-export-to-file' exports the current buffer, so I could
 make a new buffer, `insert-file-contents' the given file to it, turn on
 `org-mode', do my export and close the buffer (probably using
 `with-temp-buffer' in the first place) – but is it really necessary to
 code it, or is it ready somewhere in Org?

This is the core part of the code which would do that:

--8---cut here---start-8---
  (with-temp-buffer
(insert-file-contents orgfile)
(setq htmlcontents (org-export-as 'html))
(delete-region (point-min) (point-max))
(insert htmlcontents)
(buffer-string))
--8---cut here---end---8---

Best regards,
  Seb

-- 
Sebastien Vauban




[O] Exporting a given file (not buffer)

2015-02-13 Thread Marcin Borkowski
Hello fellow Orgers,

I need a function, which – given an org file's name – opens it silently,
exports to a file, and closes.

I can write it myself, but maybe such a function already exists?  It
seems that `org-export-to-file' exports the current buffer, so I could
make a new buffer, `insert-file-contents' the given file to it, turn on
`org-mode', do my export and close the buffer (probably using
`with-temp-buffer' in the first place) – but is it really necessary to
code it, or is it ready somewhere in Org?

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University