如何让 emacs Zip-Archive 模式在 Windows 上工作

发布于 2024-07-19 19:55:48 字数 57 浏览 2 评论 0原文

Zip 存档模式适用于具有 zip/unzip 功能的系统。 如何让它在 Wnidows 上工作?

Zip-Archive mode works on systems with zip/unzip. How do you get it to work on Wnidows?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

半边脸i 2024-07-26 19:55:48

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 设置内部某处的等效目录。 如果可执行文件不在您的常规路径中,则可以在此处查找它们。

您可以从此站点下载pkunzip,安装它,并使用<添加安装路径代码>(添加到列表'执行路径“c:/path/to/pkunzip”)

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

风吹短裙飘 2024-07-26 19:55:48

您可以使用 [chololaty]: https://chocolatey.org/ Windows 包管理器来安装 unzip 。

choco install unzip

you can use [chololatey]: https://chocolatey.org/ , the package management for windows , to install unzip.

choco install unzip
仲春光 2024-07-26 19:55:48

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

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

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

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

  1. 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 the exec-path (which is the operating systems PATH environment). This can be customised using archive-zip-extract and archive-zip-expunge.
  2. 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/).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文