27 Jun 2021
1. 键位自定义
1.1. Auto Hot Key
1.1.1. 解决 ctrl-space 问题
如果使用 Emacs 但不能使用 C-SPACE
来选择
:LINK: https://www.zhihu.com/question/22288432/answer/502086049
#IfWinActive ahk_class Emacs ; if in emacs ^Space::^+2 ;(Ctrl+Shift + 2) #IfWinActive ; end if in emacs
2. 终端
2.1. 安装 Windows Terminal
Windows Terminal 确实是 Windows 下颜值比较高的终端软件了。直接在 Windows Store 中就可以安装。
2.2. 安装 msys2
不会用 Windows 下的 Cmd 和 powershell。使用 bash 对我来说还是更舒适一些。
2.2.1. 下载包
下载 Msys2 安装包,国外下载太慢,万幸清华提供了该软件的镜像。
2.2.2. 设置源
原因同上。
sed -i '1 i Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686' /etc/pacman.d/mirrorlist.mingw32 sed -i '1 i Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64' /etc/pacman.d/mirrorlist.mingw64 sed -i '1 i Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch' /etc/pacman.d/mirrorlist.msys
3. Emacs
3.1. 安装 gccemacs
3.1.1. 下载源
git clone -b feature/native-comp --depth=1 https://gitee.com/mirrors/emacs.git
3.1.2. 安装 MINGW64 依赖
$ pacman -S --needed base-devel \ mingw-w64-x86_64-toolchain \ mingw-w64-x86_64-xpm-nox \ mingw-w64-x86_64-libtiff \ mingw-w64-x86_64-giflib \ mingw-w64-x86_64-libpng \ mingw-w64-x86_64-libjpeg-turbo \ mingw-w64-x86_64-librsvg \ mingw-w64-x86_64-lcms2 \ mingw-w64-x86_64-jansson \ mingw-w64-x86_64-libxml2 \ mingw-w64-x86_64-gnutls \ mingw-w64-x86_64-zlib \ mingw-w64-x86_64-harfbuzz
3.1.3. 编译
./autogen.sh ./configure --without-dbus --without-pop --with-nativecomp --prefix=/your/install/path make -j$(nproc) # or make NATIVE_FULL_AOT=1 -j$(nproc) // longer make install
3.2. 添加环境变量
将以下内容添加到
(let ((msys2root "C:\\msys64\\")) (setenv "PATH" (concat msys2root "mingw64\\bin" ";" msys2root "usr\\bin" ";" (getenv "PATH"))) ;;without this the new added $PATH value won't be inherite by exec-path (setq exec-path (split-string (getenv "PATH") path-separator)))
3.3. 启动脚本
@ECHO OFF TITLE Emacs - feature/native-comp SET HOME=C:\Users\yourname C: CD %HOME% IF EXIST .emacs.d\server\server DEL .emacs.d\server\server SET PATH=C:\msys64\mingw64\local\bin;C:\msys64\mingw64\bin;%PATH% C:\msys64\mingw64\bin\emacsclientw.exe -n -a C:\msys64\mingw64\bin\runemacs.exe -e "(make-frame-visible)"
3.4. 在任务栏创建快捷启动方式
在 Windows 下使用 Emacs daemon + Emacs client 的方式可能是最完美的方式了。因为每次启动一个 Client 显然要比启动完整的 Emacs 快很多,并且没带来其他方面的劣势。
但是直接在任务栏上右键固定到任务栏的话,下次启动的是完整的 Emacs,而不是启动 Client。
正确的方式是:
- 右键已经启动的 Emacs 程序任务栏图标,并选择
保存到任务栏
Alt
+Shift
+Right Click
任务栏上的已经保存的图标- 选择
属性
- 修改目标为
C:\msys64\mingw64\bin\emacsclientw.exe -n -c -a ""
最后更新:2022-03-26
首次发布:2021-06-27