步驟:
1. 下載emacs最新版
http://ftp.gnu.org/gnu/emacs/windows/
2. 解壓並執行emacs安裝目錄的\bin\addpm.exe
下文的安裝目錄,是「D:/EDA-tools/emacs/emacs-25.1
」。
注意:是左斜槓/
,而不是右斜槓\
。emacs會認爲右斜槓是轉義符。
3. 下載emacs-25-x86_64-deps.zip,並解壓縮到D:/EDA-tools/emacs/emacs-25.1
目錄裏;這一步驟很重要,是讓windows支持更多的gnu庫,好比使得org-mode能夠顯示png格式的圖片等。git
配置文件,默認是不存在的。配置文件生效的目錄是windows主目錄:github
C:\Users\Administrator\AppData\Roaming\
配置文件的設置步驟:vim
C:\Users\Administrator\AppData\Roaming
目錄下沒有.emacs文件。C:\Users\Administrator\AppData\Roaming\.emacs.d\init.el
文件;內容以下:;; Without this comment emacs25 adds (package-initialize) here ;; (package-initialize) (setenv "HOME" "D:/EDA-tools/emacs/emacs-25.1") (setenv "PATH" "D:/EDA-tools/emacs/emacs-25.1") (setq default-directory "~/") (load-file "D:/EDA-tools/emacs/emacs-25.1/.emacs.d/init.el")
;; (package-initialize)
,不然spacemacs啓動時間一次比一次長。問題的表現是:
spacemacs啓動,長時間白板顯示,下方顯示正在寫入D:/EDA-tools/emacs/emacs-25.1/init.el
。windows
發現D:/EDA-tools/emacs/emacs-25.1/init.el
裏串着幾十個(package-initialize),把spacemacs啓動過程搞得幾乎癱瘓。服務器
解決方法:
特別注意,package-initialize這一行,必需要添加,並且是註釋,並且要放在系統主目錄裏,即C:\Users\Administrator\AppData\Roaming\.emacs.d\init.el
文件。不然,每次啓動都會自動添加(package-initialize),遲早有一天,會發現啓動spacemacs須要幾分鐘或者十幾分鍾。緣由先不考慮,必定要加這段註釋。網絡
;; Without this comment emacs25 adds (package-initialize) here ;; (package-initialize)
.emacs.d
;放入目錄D:/EDA-tools/emacs/emacs-25.1
D:/EDA-tools/emacs/emacs-25.1/runemacs.exe
;能夠設置爲快捷鍵,方便之後啓動emacs程序。我的經歷:
一. emacs25.1版本,使用spacemacs的master分支時,會遇到不少error;最終下載使用的spacemacs版本是develop分支。https://codeload.github.com/syl20bnr/spacemacs/zip/develop
master版本和develop版本的區別,一個是穩定版(爲了穩定,功能少一些),一個是開發版(更多功能,穩定性相對差一些)。app
二. 根據我的需求,選擇vim/spacemacs/等設置選項。
三. 因爲spacemacs須要下載不少插件。因爲插件源網絡關係,下載極慢並且不穩定;因此修改插件源爲清華服務器。實現方法以下:
在第一步驟開始下載插件的過程當中,強制退出emacs。這時,D:/EDA-tools/emacs/emacs-25.1/.spacemacs出現。修改其中的代碼:ide
(defun dotspacemacs/user-init () "Initialization function for user code. It is called immediately after `dotspacemacs/init', before layer configuration executes. This function is mostly useful for variables that need to be set before packages are loaded. If you are unsure, you should try in setting them in `dotspacemacs/user-config' first." (setq-default configuration-layer--elpa-archives '(("melpa-cn" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/") ("gnu-cn" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/") ("org-cn" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/org/"))) )
最後一路順利通關。
warning:spacemacs默認字體」Source Code Pro」不存在。解決方法以下:字體
dotspacemacs-default-font '("Courier New" :size 13 :weight normal :width normal :powerline-scale 1.1)
最終,提供org顯示png格式圖片的界面效果:
ui
補充:安裝其它插件package的時候,也許會碰到一些問題。能夠選擇性exclude_package掉。
若是遇到下述問題:
Found 1 new package(s) to install... --> refreshing package archive: marmalade... [5/5] --> installing package: evil-unimpaired@spacemacs-evil... [1/1] An error occurred while installing evil-unimpaired (error: (file-error Opening directory No such file or directory d:/EDA-tools/emacs/emacs-25.1/.emacs.d/.cache/quelpa/melpa/recipes))
解決辦法:
把.cache清空之後掛個代理,確認能不能用github,啓動之後應該能成功安裝。仍是不行就手動把https://github.com/melpa/melpa下載到~/.emacs.d/.cache/quelpa/melpa,而後重啓。這個錯誤估計是由於要用melpa路徑裏面的資源編譯el文件,可是由於在中國不能很好地用github下載因此沒法完成編譯。
A build command can be specified via the layer variable latex-build-command
.
If LatexMk
is specified, the appropriate LatexMk
configuration will be applied. (the default on systems with latexmk
in the path) This variable can be set to any of the entities in TeX-command-list
, including any custom entries you may have added there. To use the regular AucTeX
command set latex-build-command
to LaTeX
as shown below.
dotspacemacs-configuration-layers '( (latex :variables latex-build-command "LaTeX"))
To enable auto-fill set the variable latex-enable-auto-fill
to t
.
The variable latex-nofill-env
provide the list of environment names where auto-fill-mode
will be inhibited.
dotspacemacs-configuration-layers '( (latex :variables latex-enable-auto-fill t))
Enable folding of text by setting latex-enable-folding
to t
. Default value is nil.
dotspacemacs-configuration-layers '( (latex :variables latex-enable-folding t))
(add-hook 'doc-view-mode-hook 'auto-revert-mode) (setq-default TeX-engine 'xetex) (setq-default TeX-master nil) (setq TeX-view-program-list '(("Sumatra PDF" ("\"c:/Program Files/SumatraPDF/SumatraPDF.exe\" -reuse-instance" (mode-io-correlate "-forward-search %b %n ") "%o" ))) ) (eval-after-load 'tex '(progn (assq-delete-all 'output-pdf TeX-view-program-selection) (add-to-list 'TeX-view-program-selection '(output-pdf "Sumatra PDF"))))
接下來,若是順利的話就能夠寫LaTeX了,例如用C-c-c編譯,C-c-v查看。
補充一下:打開Sumatra PDF的設置,加上這句話(假設emacsclient在下述的位置)
"C:\Program Files (x86)\emacs\bin\emacsclient.exe" --no-wait +%l "%f"
而後就能夠雙擊PDF跳轉回Emacs了。
穩重D;\XXX地址換成相應地址。