Matrixlin Blog

Happy coding, blog for everything

Emacs入门指南及配置Python开发IDE

最近在家里倒腾emacs这玩意,都说牛逼的程序员都用这个东西。我不知天高地厚的表示也想玩玩。

一开始在ubuntu 安装emacs,然后看着它的tutorial,学了几个命令以为万事大吉,然后在学Python,想着要不在emacs里面搞个python的IDE,顺便高亮,最好像eclipse那边智能提示,然后像之前使用的vs那样快捷键运行,最好调试也搞定。

第一天上网查的时候看的是http://cnlox.is-programmer.com/posts/35867.html

完全不懂作者在讲啥。各种百度谷歌。包括翻墙上emacs中文网。上面下了两个电子版,看了一点emacs lisp发现这东西有点意思。

渐渐明白,原来emacs的配置基本都是用lisp写的。

然后知道~/.emacs文件一开始没有,要自己新建,至于配置网上随便找一个都能做到了酷炫。然后知道~/.emacs.d/init.d这个文件夹下的文件是emacs启动时会一起运行的。

百度时看到一个很好的关于emacs的文章:http://blog.csdn.net/redguardtoo/article/details/7222501/

里面提到作者自己的配置,我就去他github上面按他所说的安装:https://github.com/redguardtoo/emacs.d

Please remove the file “~/.emacs.d/init.el” (“~” means the parent directory of your “.emacs.d”).

Uninstall any package which not located in “~/.emacs.d”. For example, run “apt-get autoremove emacs-w3m” on Debian/Ubuntu. All packages will be placed at “~/.emacs.d” from now on.

Download latest setup and extract its content into “~/.emacs.d”.

Or you can use stable setup which has been regression tested by volunteers every 3 months.

If you’ve installed Git, run command `cd ~; git clone https://github.com/redguardtoo/emacs.d.git.emacs.d` in terminal.

Ensure that the init.el contained in this repo ends up at ~/.emacs.d/init.el.

其实按这个我是没安装成功的。不过注意https改成git,然后就可以,当然你要先安装git还要有自己的账户密码这是必须的,这个容易自己百度。

然后开始按http://blog.csdn.net/mikelearnscode/article/details/23022277 进行配置,不过里面的elpy安装不成功,然后我找到elpy的官网:http://elpy.readthedocs.org/en/latest/introduction.html

按它这样的install还是不行。结果用了国外一小哥的配置就可以了:

(require 'package)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                 ("marmalade" . "http://marmalade-repo.org/packages/")))
; Auto-complete:
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
; Org mode
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("elpy" . "http://jorgenschaefer.github.io/packages/") t)

这些放.emacs上面。

最后按下包管理工具el-get:http://emacser.com/el-get.htm

如果安装不成功可以试着改下上面的url,改成如下:https://raw.githubusercontent.com/dimitri/el-get/master/el-get-install.el

然后试了一下emacs上写python,可以高亮和智能提示。

如果不懂emacs lisp,完全按着别人怎么配怎么配就完全没意义了。所以我接下来要弄懂lisp.

这个花了我一个白天加一个半天完成。