emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] export-latex-final-hook


From: Dan Davison
Subject: Re: [Orgmode] export-latex-final-hook
Date: Mon, 19 Apr 2010 23:43:06 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Matt Price <address@hidden> 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.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode




reply via email to

[Prev in Thread] Current Thread [Next in Thread]