* Exporting a given file (not buffer)
@ 2015-02-13 22:13 Marcin Borkowski
2015-02-13 22:20 ` Sebastien Vauban
0 siblings, 1 reply; 2+ messages in thread
From: Marcin Borkowski @ 2015-02-13 22:13 UTC (permalink / raw)
To: Org-Mode mailing list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Exporting a given file (not buffer)
2015-02-13 22:13 Exporting a given file (not buffer) Marcin Borkowski
@ 2015-02-13 22:20 ` Sebastien Vauban
0 siblings, 0 replies; 2+ messages in thread
From: Sebastien Vauban @ 2015-02-13 22:20 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-13 22:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-13 22:13 Exporting a given file (not buffer) Marcin Borkowski
2015-02-13 22:20 ` Sebastien Vauban
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).