emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: Matt Price <moptop99@gmail.com>
Cc: emacs-orgmode@gnu.org, Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: export-latex-final-hook
Date: Mon, 19 Apr 2010 23:43:06 -0400	[thread overview]
Message-ID: <87wrw2dc1h.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <x2zf22f52181004191928r7fb966cfv5c978accac9d3abc@mail.gmail.com> (Matt Price's message of "Mon, 19 Apr 2010 22:28:45 -0400")

Matt Price <moptop99@gmail.com> writes:

> Thanks to Dan and Carsten,
>
> I now have this:
>
>
> (defun  mwp/push-latex-to-odt ()
>   "takes the exported tex file from org-mode and converts it to odt,
> then launches openoffice"
>   (shell-command
>    (format  "mk4ht oolatex  %s.tex"
> 	    (file-name-sans-extension (buffer-name))))
>   (shell-command
>    (format  "ooffice  %s.odt &"
> 	    (file-name-sans-extension (buffer-name)))))
>
> (add-hook 'org-export-latex-final-hook
> 	  'mwp/push-latex-to-odt)
>
>
> which works fine.  The only issue is that the first shell command,
> mk4ht oolatex, sometimes takes a while to finish processing & would be
> nice to have running in the background.  Should  just write a shell
> script that runs the two commands, and then fork that process? Or is
> there a slightly more elegant way that keeps all of the programming
> contained in a lisp file?

Hi Matt,

It's either start-process or start-process-shell-command you want I
think. Also, I believe we may have hit on not-quite-the-correct export
hook. This seems to work:

(defun  mwp/push-latex-to-odt ()
  "takes the exported tex file from org-mode and converts it to odt,
then launches openoffice"
  (let* ((file-name (file-name-sans-extension (buffer-name)))
         (output-buffer "*latex-to-odt output*")
         (cmd (format  "mk4ht oolatex %s.tex && ooffice %s.odt"
                      file-name file-name)))
    (message "Converting latex to odt")
    (start-process-shell-command
     "latex-to-odt" output-buffer cmd)))

(add-hook 'org-export-latex-after-save-hook
          'mwp/push-latex-to-odt)

Dan

>
> Thanks again,
>
> matt
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

      reply	other threads:[~2010-04-20  3:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20  2:28 export-latex-final-hook Matt Price
2010-04-20  3:43 ` Dan Davison [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wrw2dc1h.fsf@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).