emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: export-latex-final-hook
@ 2010-04-20  2:28 Matt Price
  2010-04-20  3:43 ` export-latex-final-hook Dan Davison
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Price @ 2010-04-20  2:28 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode, Carsten Dominik

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?

Thanks again,

matt

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: export-latex-final-hook
  2010-04-20  2:28 export-latex-final-hook Matt Price
@ 2010-04-20  3:43 ` Dan Davison
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Davison @ 2010-04-20  3:43 UTC (permalink / raw)
  To: Matt Price; +Cc: emacs-orgmode, Carsten Dominik

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-20  3:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-20  2:28 export-latex-final-hook Matt Price
2010-04-20  3:43 ` export-latex-final-hook Dan Davison

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).