如何让emacs Zip-Archive模式在Windows上运行

问题描述 投票:6回答:3

Zip-Archive模式适用于具有zip / unzip的系统。你如何让它在Wnidows上工作?

windows emacs zip
3个回答
7
投票

EMACS使用外部程序进行压缩/解压缩。它所需要的只是知道正确的程序。


一些扩展的讨论:

正如我所说,我没有Windows框,但LISP代码在arc-mode.el大约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)

观察功能executable-find。它在您的EMACS exec-path中搜索,其中包括一些不在您的普通PATH变量中的EMACS可执行目录。就我而言,它是:

("/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")

其中包括EMACS包中的两个目录。您的Windows安装将在EMACS设置的内部某处包含等效目录。如果可执行文件不在您的常规路径中,那就是在哪里查找。

您可以从this site下载pkunzip,安装它,并使用(add-to-list 'exec-path "c:/path/to/pkunzip")添加安装路径


2
投票

emacs如何处理压缩文件可能有点令人困惑,但这里是尝试总结这种情况。有两个主要的压缩包:arc-mode(例如zip-archive模式)和jka-compr模式(auto-compression-mode)。

  1. arc-mode:将显示多文件存档(arc,lzh,zip,zoo)中的目录(即存档中包含的简单文件名列表),而不需要在系统上存在相关的第三方工具。如果您确实想要使用arc-mode查看/编辑存档中包含的实际文件,您肯定需要在系统和适当的位置安装第三方工具。例如。对于zip文件,它默认在exec-path(这是操作系统PATH环境)中压缩/解压缩。这可以使用archive-zip-extractarchive-zip-expunge定制。
  2. jka-comprauto-compression-mode):将自动压缩/解压缩单个文件存档(gz,Z,bz2,tbz等),并要求系统上存在相关的第三方工具。

因此,要让zip-archive模式在Windows上完全正常工作,您只需要找到命令行zip / unzip的Windows版本并将它们放入PATH中的目录(例如,请参阅http://gnuwin32.sourceforge.net/的解压缩包)。


1
投票

您可以使用[chololatey]:https://chocolatey.org/(Windows的包管理)来安装解压缩。

choco install unzip
© www.soinside.com 2019 - 2024. All rights reserved.