Emacs 安装与体验

 
 

Emacs 安装与体验

下载与安装

  1. 首先是下载最新的x64版本的Emacs。

  2. 将下载下来的文件解压到你喜欢的磁盘目录下,我选择的是C:\Program Files。放在D盘可能是更好的选择,因为待会的配置文件因此可以更方便的同安装文件一起保存到D盘,而不是C盘。

  3. 进入C:\Program Files\emacs\bin目录下,运行addpm.exe

  4. 启动Emacs,点击Options下的Highlight Matching Parenheses,随后点击Save Options。我们此举的目的是因为我们是第一次使用Emacs,以此来触发Emacs生成配置文件目录。可以发现在c:/Users/<username>/AppData/Roaming/下生成了.emacs文件以及.emacs.d文件夹。

  5. 下面我们要动一些手脚,因为将配置文件放在C盘是不理想的,比如重装系统等,容易丢失配置信息。我们打开刚刚生成的.emacs文件,按如下修改

    1.(custom-set-variables
    2.;; custom-set-variables was added by Custom.
    3.;; If you edit it by hand, you could mess it up, so be careful.
    4.;; Your init file should contain only one such instance.
    5.;; If there is more than one, they won't work right.
    6.'(show-paren-mode t))

    7.(custom-set-faces
    8.;; custom-set-faces was added by Custom.
    9.;; If you edit it by hand, you could mess it up, so be careful.
    10.;; Your init file should contain only one such instance.
    11.;; If there is more than one, they won't work right.
    12.)

    13.(load-file "C:/Program Files/emacs/.emacs")

    这是什么意思呢?就是说,Emacs在启动的时候会加载c:/Users/<username>/AppData/Roaming/.emacs,我们修改这个文件,使得其又加载了C:\Program Files\emacs\.emacs文件。这样就实现了配置的转移。

  6. 等等,我们的C:\Program Files\emacs下似乎并没有.emacs文件,好吧,我们现在创建一个吧,只能用命令行创建,先随便创建一个什么文件,然后用命令行进行改名,比方说,我们创建了一个emacs.txt文件,然后使用rename emacs.txt .emacs命令,间接的创建了一个Emasc配置文件。

  7. 修改刚刚创建的.emacs文件内容如下:

    1.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    2.;; emacs in windows
    3.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    4.(setenv "HOME" "C:/Program Files/emacs")
    5.(setenv "PATH" "C:/Program Files/emacs")
    6.;; set the default file path
    7.(setq default-directory "~/")

 
 
posted @ 2016-03-17 15:46  狂徒归来  阅读(413)  评论(0编辑  收藏  举报