emacs的配置过程

来源:互联网 发布:hermitian矩阵 编辑:程序博客网 时间:2024/05/22 05:28

先借用下前人的博文如下:

原文:

http://blog.csdn.net/longxj04/article/details/6606355


首先在putty里设置好自己喜好的color,font,然后设置好translation里的编码,这个是重点,不然就会出现中文乱码设置什么编码,取决于linux平台的locale,可以用locale命令查看注意,如果要显示中文,请务必保证locale里的lang和language是以zh开头的,en开头的字符集无法显示中文。设置命令:export LC_ALL=zh_CN.UTF-8 (当然也可以分别设置lang language),这个命令可以放到自己的启动脚本中~/.bashrc.也就是说putty里translation要跟linux平台的locale一致(不一致putty就无法正常解释,就会出现乱码)。设置好后,记得保存一个session,这个session在后面的推荐工具也能用到。by the way,推荐一个好工具putty connection manager,可以解决putty不能自动登录,没有tab的问题(一个putty就一个窗口太烦)

emacs编辑来自各个平台的文件时,要注意编辑文件的编码格式,如果打开文件显示有乱码,一般就说明打开文件的编码跟文件编码不一致。可以用M+describe-coding-system可以查看当前buffer用的解释编码,可以用M+revert-buffer-with-coding-system来改变解码方式,一般主要是gbk(gb18030,gbk)和utf-8。还有一个命令M+prefer-coding-system设置默认解码格式,需要将这个命令放入.emacs中。


emacs编程,非常有用的3个插件:

cscope

使用cscope需要先安装cscope,用源码编译或者linux发行版自带的各种包管理工具,随你喜好。装好后,拷贝xcscope.el到一个emacs的加载路径中,一般是在自己的主目录下建一个.emacs.d的目录,然后将这个目录加入.emacs中:

(add-to-list 'load-path "~/.emacs.d")

要使用cscope,先建索引:

可以参考下面的命令,假设所有的头文件和cpp文件在src目录下:

find src/ -type f -iname "*.h" > cscope.files

find src/ -type f-iname "*.cpp" >>cscope.files (这里是>>追加)

然后执行命令cscope -bq


auto-complete

自动补全:

emacs下的自动不全可以用auto-complete,安装使用都很方便http://cx4a.org/software/auto-complete/manual.html#Source


cedet+ecb(emacs code browser)

ecb可以列出文件里面的各种函数,装这个需要先装cedet,挺好用的。cedet里面的semantic可以支持语法级别的自动提示和补全。


我的配置文件在这里:http://blog.csdn.net/longxj04/article/details/6316040,插件装好了,可以直接使用。


完整的emacs配置以及插件

这里http://www.kuaipan.cn/file/id_8195239982399743.htm有我的配置文件以及对应的所有插件

配置文件内容:

1.emacs_conf.txt 放在主目录下,命名为.emacs

2.emacs.d.tar.gz 解压缩到主目录下,命名为.emacs.d

3.进入.emacs.d的cedet-1.0pre7, 运行命令make EMACS=emacs,编译cedet

这样就ok了


配置完成后如下:


http://blog.csdn.net/longxj04/article/details/6606355

由于我用的emacs是24.3版本的

根据博文出现如下问题:


n toplevel form:

lmcompile.el:35:1:Error: Forgot to expand macro eieio-object-p
lmcompile.el:35:1:Error: Forgot to expand macro eieio-object-p
lmcompile.el:35:1:Error: Forgot to expand macro eieio-object-p
lmcompile.el:35:1:Error: Forgot to expand macro eieio-object-p
lmcompile.el:35:1:Error: Forgot to expand macro eieio-object-p
lmcompile.el:35:1:Error: Forgot to expand macro eieio-object-p
lmcompile.el:35:1:Error: Invalid function: eieio-object-p
make[1]: *** [examples] 错误 1
make[1]:正在离开目录 `/root/.emacs.d/cedet-1.0pre7/eieio'


在http://sourceforge.net/projects/cedet/  这个位置下载cedet1.1就行了


问题: ”Symbol's value as variable is void: stack-trace-on-error“


解决: 在你的emacs配置中加上(setq stack-trace-on-error t)



如下是我根据它的包做好的整体配置:

如下:

http://download.csdn.net/detail/htjx99/6996231



有网上有牛人有更好的配置如下:

http://www.cnblogs.com/karotte/archive/2012/06/06/2537670.html



0 0
原创粉丝点击