2

After asking this question, I have downloaded 7zip for Windows.

When I try to export to .odt, I am still getting this: "OpenDocument export failed: Executable "zip" needed for creating OpenDocument files."

What is my next step?

1

After you have associated 7zip with files that have a give extension (e.g. .zip), in the usual way for MS Windows (I don't think that's your question), you can have Emacs open such files using that associated program.

To do that, start with the Emacs Wiki Category W32. There you will find, among other things:

  • MS Shell Execute - tell Emacs to use Windows programs associated with given file types

  • Dired+ - open files from Dired using the associated Windows programs

  • Bookmark+ - use Windows file associations as bookmark actions

1

Might be a little late for an answer but here it goes anyway. If you search ox-odt.el you can see that the error message you're getting comes from org-odt--export-wrap which is the macro called by org-odt-export-to-odf and org-odt-export-to-odt to create the actual ODT file. Inside ox-odt--export-wrap there is this little piece of code:

(unless (executable-find "zip")
     ;; Not at all OSes ship with zip by default
     (error "Executable \"zip\" needed for creating OpenDocument files"))

that will prevent the process to continue unless the zip excecutable exists in your PATH. Also a few lines below there's this:

(cmds `(("zip" "-mX0" ,target-name "mimetype")
          ("zip" "-rmTq" ,target-name ".")))

which defines how to call the zip command in order to create an ODT file. Considering all of the above you have at least three options here:

  1. Modify the ox-odt.el file so it uses the 7z command instead of zip.
  2. Wrap your calls to 7z into some kind of zip.cmd command.
  3. Download zip for Windows, in fact you should get GNU on Windows or Cygwin, any of them will save you a lot of troubles while working with Emacs.
0

If you just need export org to odt, see org-mode zip needed, how to over come?.

If you need 7-Zip as your zip program, you need download 7-Zip Extra: standalone console version and put 7-zip extra in Windows %PATH%.

Call (make-zip-bat (executable-find "7za")) to generate zip.bat and put it in your %PATH% and exec-path.

zip.bat for 7za looks like:

@echo off
REM zip.bat for 7za on Windows
REM generated by More Reasonable Emacs https://github.com/junjiemars/.emacs.d

REM local variable declaration

setlocal EnableDelayedExpansion

set _OPT=%*
set _ZIP=
set _ARGV=

REM parsing command line arguments

:getopt
if "%1"=="-mX0" set _OPT=%_OPT:-mX0=-mx0% & shift & goto :getopt
if "%1"=="-0" set _OPT=%_OPT:-0=-mx0% & shift & goto :getopt
if "%1"=="-9" set _OPT=%_OPT:-9=-mx9% & shift & goto :getopt

REM ignore options
if "%1"=="-r" set _OPT=%_OPT:-r=% & shift & goto :getopt
if "%1"=="--filesync" set _OPT=%_OPT:--filesync=% & shift & goto :getopt
if "%1"=="-rmTq" set _OPT=%_OPT:-rmTq=% & shift & goto :getopt

REM extract zip and argv
if not "%1"=="" (
  if "%_ZIP%"=="" (
    if "%_ARGV%"=="" (
      set _ZIP=%1
    )
  ) else (
    set _ARGV=%_ARGV% %1
  )
  set _OPT=!_OPT:%1=!
  shift
  goto :getopt
)

REM 7za call
7za a %_OPT% -tzip -- %_ZIP% %_ARGV%
if exist %_ZIP% (
  7za d %_OPT% -tzip -- %_ZIP% %_ZIP%
)

Now, export org to odt should works, see more More Reasonable Emacs: zip program

0

When I try to export to .odt, I am still getting this: "OpenDocument export failed: Executable "zip" needed for creating OpenDocument files."

Based on https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg00489.html, you can use the zip package from following links

http://gnuwin32.sourceforge.net/packages.html
http://gnuwin32.sourceforge.net/packages/zip.htm

Based on https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg00538.html, you may also use the zip executable from

https://fossies.org/windows/misc/zip300xn.zip/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.