(一)安装Emacs

Emacs被称为“神”的编辑器,在开始讲解Emacs使用前,我们首先介绍Emacs的安装。

一、windows环境下安装emacs

有三种方法:

  • 直接二进制文件包安装。
  • 安装MSYS2环境,然后通过pacman 包管理器进行安装。
  • 在MSYS2环境中,进行源代码编译安装。(推荐

1.1 二进制文件包安装

1.1.1 下载emacs及附加包
  1. 下载emacs
    地址:ftp://ftp.gnu.org/gnu/emacs/windows/
    注意有64位、32位不同的版本。这里使用64位版本。
    这里选择下载emacs-25.3_1-x86_64.zip
  2. 下载附加包
    对应于emacs-25.3_1-x86_64.zip文件,这里下载emacs-25-x86_64-deps.zip
1.1.2 安装
  1. 将下载的安装文件解压到安装目录,例如 d:\emacs25
    解压emacs-25.3_1-x86_64.zip到安装目录
    解压emacs-25-x86_64-deps.zip到同样的安装目录。
  2. 可选的依赖库
    emacs内置了对XBM、PPM/PGM/PBM图像的支持,libXpm库提供了XPM支持,这些已经包含在了上面的依赖库中。
    emacs还有很多可选功能,这需要额外的库支持。这些是在独立的依赖包中提供的。这些可选的依赖包支持一下内容:
    – 显示多种类型的内联图像(PNG、JPEG、GIF、TIFF、SVG)
    – SSL/TLS安全网络通信(https、imaps等)
    – HTML和XML解析(内置EWW浏览器所必需)
    – 压缩文本的内置解压缩
    可选的依赖库位于压emacs-25-x86_64-deps.zip中。
    新的/更新的版本位于http://msys2.github.io/或者http://sourceforge.net/projects/ezwinports/files/
    至此安装完毕。
  3. 安装命令菜单(可选,不建议安装)
    执行bin目录下你的addpm.exe
1.1.3 扩展

一些emacs特性需要一些unix工具支持,例如:

  • 拼写检查需要aspell
  • 图片缩略图预览需要ImageMagick
  • 文件比较需要diff
  • 列出指定后缀的文件需要find

有几种方法来获得这些linux工具:

下面简要说明:

  1. 安装WSL
    不是所有的Windows 10系统都能运行WSL,要满足两个基本要求:64位和Build号不低于14393.0(笔者使用的两个版本分别是14393.1198和14393.479)。
  2. 安装Cygwin
    见后述。
1.1.4 运行emacs
  1. GUI方式运行
    执行bin目录下的 runemacs.exe
  2. 在控制台窗口中运行
    在命令行使用下面的命令:
C:\\Users\\joe\\apps\\emacs-24.1\\bin\\emacs.exe --no-window-system
1.1.5 其他Emacs执行文件

emacs25\bin目录下有很多执行文件,说明如下:

  • emacs.exe - The main Emacs executable. As this is designed to run as both a text-mode application (emacs -nw) and as a GUI application, it will pop up a command prompt window if run directly from Explorer.
  • runemacs.exe - A wrapper for running Emacs as a GUI application without popping up a command prompt window. If you create a desktop shortcut for invoking Emacs, make it point to this executable, not to emacs.exe. If you pin Emacs to the task bar, edit the properties of the pinned shortcut (with Shift-right mouse click) to point to this executable.
  • emacsclient.exe - A command-line client program that can communicate with a running Emacs process. See the `Emacs Server’ node of the Emacs manual.
  • emacsclientw.exe - A version of emacsclient that does not open a command-line window.
  • addpm.exe - A basic installer that adds Emacs to “Start” menus and adds Emacs-related entries to the Windows Registry.
  • ctags.exe, etags.exe - Tools for generating tag files. See the `Tags’ node of the Emacs manual.
  • ebrowse.exe - A tool for generating C++ browse information. See the `Ebrowse’ manual.
    还有几个执行文件在(所版本不同,路径可能不同)相应的目录:
  • cmdproxy.exe - Used internally by Emacs to work around problems with the native shells in various versions of Windows.
  • ddeclient.exe - A tool for interacting with DDE servers. To be invoked as “ddeclient SERVER [TOPIC]”, where SERVER is the DDE server name, and sends each line of its standard input to the DDE server using the DdeClientTransaction API. This program is supposed to be invoked via the ‘call-process-region’ Emacs primitive.
  • hexl.exe - A tool for producing hex dumps of binary files. See the `Editing Binary Files’ node of the Emacs manual.
  • movemail.exe - A helper application for safely moving mail from a mail spool or POP server to a local user mailbox. See the `Movemail’ node of the Emacs manual.
  • profile.exe - A helper program that generates periodic events for profiling Emacs Lisp code.
  • update-game-score.exe - A utility for updating the score files of Emacs games.

1.2 MSYS2环境下的直接安装

1.2.1 安装和准备msys2
  1. 下载MSYS2
    从站点下载最新的msys2安装文件,其文件名为msys2-<架构>-<日期>.exe 的文件(如 msys2-x86_64-20200720.exe)。推荐从国内下载。
    https://mirrors.tuna.tsinghua.edu.cn/msys2/distrib/x86_64/
    https://www.msys2.org/
  2. 安装msys2
    点击运行msys2-x86_64-20200720.exe,按照提示进行安装。这里安装到目录
    c:\msys64.
    注意,安装结束后先不运行msys2
  3. 配置msys2
    关于各种镜像站的操作:找到 c:\msys64\etc\pacman.d 文件夹,里面有三个文件: mirrorlist.mingw32 、mirrolist.mingw64 、mirrorlist.msys,分别编辑其内容为:
## mirrorlist.mingw32
##
## 32-bit Mingw-w64 repository mirrorlist
##
## 清华大学软件镜像
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686/
## 中科大镜像
Server = http://mirrors.ustc.edu.cn/msys2/mingw/i686/
## msys2.org
Server = http://repo.msys2.org/mingw/i686/
## Sourceforge 镜像
Server = https://sourceforge.net/projects/msys2/files/REPOS/MINGW/i686/
## The UK Mirror Service Sourceforge mirror
Server = http://sourceforge.mirrorservice.org/m/ms/msys2/REPOS/MINGW/i686/
## Sourceforge.net
Server = http://downloads.sourceforge.net/project/msys2/REPOS/MINGW/i686
## FutureAt 镜像
Server = http://www2.futureware.at/~nickoe/msys2-mirror/msys/i686/

## mirrorlist.mingw64
##
## 64-bit Mingw-w64 repository mirrorlist
##
## 清华大学软件镜像
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86\_64/
## 中科大镜像
Server = http://mirrors.ustc.edu.cn/msys2/mingw/x86\_64/
## msys2.org
Server = http://repo.msys2.org/mingw/x86\_64/
## Sourceforge 镜像
Server = https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86\_64/
## The UK Mirror Service Sourceforge mirror
Server = http://sourceforge.mirrorservice.org/m/ms/msys2/REPOS/MINGW/x86\_64/
## Sourceforge.net
Server = http://downloads.sourceforge.net/project/msys2/REPOS/MINGW/x86\_64
## FutureAt 镜像
Server = http://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/

## mirrorlist.msys
##
## MSYS2 repository mirrorlist
##
## 清华大学软件镜像
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch
## 中科大镜像
Server = http://mirrors.ustc.edu.cn/msys2/msys/$arch
## msys2.org
Server = http://repo.msys2.org/msys/$arch
## Sourceforge 镜像
Server = https://sourceforge.net/projects/msys2/files/REPOS/msys/$arch
## The UK Mirror Service Sourceforge mirror
Server = http://sourceforge.mirrorservice.org/m/ms/msys2/REPOS/msys/$arch
## Sourceforge.net
Server = http://downloads.sourceforge.net/project/msys2/REPOS/msys/$arch
## FutureAt 镜像
Server = http://www2.futureware.at/~nickoe/msys2-mirror/msys/$arch
  1. 更新软件源
    运行msys2,然后测试以下软件源是否可用,并更新软件包数据。
pacman –Syuu
  1. 运行autorebase.bat
C:\\msys64>autorebase.bat
ReBaseImage (/usr/bin/msys-gnutls-30.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-intl-8.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-unistring-2.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-gpg-error-0.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-ffi-7.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-ksba-8.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-gcrypt-20.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-npth-0.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-p11-kit-0.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-idn2-0.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-iconv-2.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-tasn1-6.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-hogweed-6.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-gmp-10.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-assuan-0.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-nettle-8.dll) failed with last error = 2
ReBaseImage (/usr/bin/msys-gcc\_s-seh-1.dll) failed with last error = 2
The following DLLs couldn't be rebased because they were in use:
/usr/bin/msys-gnut
  • 5
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值