How to get emacs Zip-Archive mode to work on Windows
EMACS uses an external program to do the compression/uncompression. All it needs is to know the right program to use.
Some extended discussion:
As I say, i've got no Windows box, but the LISP code is in arc-mode.el at about line 230:
(defcustom archive-zip-extract
(if (and (not (executable-find "unzip"))
(executable-find "pkunzip"))
'("pkunzip" "-e" "-o-")
'("unzip" "-qq" "-c"))
"*Program and its options to run in order to extract a zip file member.
Extraction should happen to standard output. Archive and member name will
be added."
:type '(list (string :tag "Program")
(repeat :tag "Options"
:inline t
(string :format "%v")))
:group 'archive-zip)
Observe the function executable-find
. It searches in your EMACS exec-path
, which includes some EMACS executable directories that aren't in your normal PATH variable. In my case, it's:
("/usr/bin"
"/bin"
"/usr/sbin"
"/sbin"
"/Applications/Emacs.app/Contents/MacOS/libexec"
"/Applications/Emacs.app/Contents/MacOS/bin"
"~/bin"
"/usr/local/bin"
"/usr/X11R6/bin")
which includes the two directories inside the EMACS package. Your Windows installation will include equivalent directories somewhere down in the guts of the EMACS setup. That's where to look for the executables if they're not in your regular path.
You can download pkunzip from this site, install it, and add the path to the installation with (add-to-list 'exec-path "c:/path/to/pkunzip")
How emacs handles compressed files can be a little confusing, but here is an attempt to summarise the situation. There are two main compression packages: arc-mode
(e.g. zip-archive
mode) and jka-compr
mode (auto-compression-mode
).
arc-mode
: will display the table-of-contents (i.e. simple list of filenames contained within the archive) of multi-file archives (arc, lzh, zip, zoo) without requiring the relevant third-party tool to exist on your system. If you actually want to do any viewing/editing of the actual files contained within the archive using arc-mode you will definitely need the third-party tool to be installed on your system and in the appropriate location. E.g. for zip files it defaults to zip/unzip in theexec-path
(which is the operating systems PATH environment). This can be customised usingarchive-zip-extract
andarchive-zip-expunge
.jka-compr
(auto-compression-mode
): will automatically compress/uncompress single file archives (gz, Z, bz2, tbz, etc) and requires the relevant third-party tool to exist on your system.
So to get zip-archive
mode fully working on Windows you will just need to find a windows version of command-line zip/unzip and put them into a directory that is in your PATH (e.g. see unzip package at http://gnuwin32.sourceforge.net/).