emacs--versionGNUEmacs27 1Copyright(C)2020Fr">
呼萬喚,等到了emacs-windows版本。
PS C:\Users\gaowei> emacs --version
GNU Emacs 27.1
Copyright (C) 2020 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
本文探討安裝和配置emacs最可靠的姐姐方案。
配置好‘包管理’工具,比如scoop,請參閱 最有效率的工作方式?Win10上安裝包管理工具scoop
Emacs的windows版本默認動作將目錄C:\Users\USERNAME\AppData\Roaming當作HOME,我們要將其修改為C:\Users\USERNAME\。
同時將doom\bin放到路徑中,即Path中添加C:\Users\USERNAME\.emacs.d\bin。
變更環境變量的步驟分解請參閱 Windows10如何修改環境變量,更改Home目錄?
在windows-terminal中輸入下列腳本
scoop bucket add extras
scoop install git emacs ripgrep fd llvm
起身喝杯水,30分鐘后再回來。
打開git-bash(注意務必要在git-bash中運行以下命令)
git clone https://github.com/hlissner/doom-emacs ~/.emacs.d
~/.emacs.d/bin/doom install
windows上不能夠直接安裝all-th-icons,需要進入到doom后重新配置,運行:
M-x all-the-icons-install-fonts
跟隨提示創建.fonts目錄,之后手動安裝到系統中。
安裝過程中可能遇到dns污染的問題,報錯:
在win10下報錯GitHub raw.githubusercontent.com無法連接
處理方法請參閱 Win10中修改etc/hosts解決github無法接入
拿emacs在windows作為生產力工具是一場馬拉松,需要大量的自定義工作。
個人感覺在Emacs執行Lisp命令,不是特別爽,有一些別扭。可能還是不熟悉的緣故,也可能是Emacs最先在Unix中使用,而不是在Windows系統使用的緣故。
在Emacs的安裝目錄(我的是“D:\Programs\Emacs\x86_64\bin”)中,雙擊“emacs.exe”,運行程序。
點擊上圖中標注的“*GNU Emacs*”,會自動切換到“*Scratch*”。
輸入Lisp的命令(S-表達式): (+ 3 2)
然后將光標移到本行最后,按組合鍵(Ctrl+J)或者點擊“Lisp Interaction”在彈出的菜單中點擊“Evaluate and Print”,完成一行的計算。如下圖所示。
再測試一個匿名函數(lambda函數):
( (lambda (x) (+ x 2)) 2)
上述兩個Lisp命令(S-表達式)運行結果(S-表達式的計算結果)截圖如下:
參考網頁:
https://zhuanlan.zhihu.com/p/201062516
http://xahlee.info/emacs/emacs/emacs.html (英文版的實用Emacs教程)