配置emacs,安装color-theme和配置java编程环境


1 安装color-theme

1: 把的下载到的压缩包1里的color-theme.el 和文件夹 “themes”放入load-path。2

2:在.emacs配置文件3中加入下列语句:

(require 'color-theme)
(color-theme-initialize)
(color-theme-robin-hood)

第1行,调用color-theme扩展,使之随emacs启动。 注意:网上的很多教程并没提到第2行,但是它必须有,否则会出错。 最起码在我这里如此。 第3行是我自己选择的一个主题,你可以换成你自己喜欢的,浏览里面 的主题可以用M-x color-theme-select,然后一个个地试,觉得哪个好 就把第三行替换成那个。(见http://wangcong.org/blog/archives/305)

2 安装cedet

 

2.1 独立版cedet安装失败

环境:emacs23.3.1和emacs24/windows XP/cedet 1.0pre7

我安装独立版的cedet后,打开emacs老是出现错误。在.emacs文件中添加了几个打开semantic mode的函数就报错。

m-x cedet 回车 点 version 看到semantic和几个插件没有loaded。不知道怎么回事。

2.2 使用内置版cedet。

我是依照文章:http://emacser.com/built-in-cedet.htm/ 进行设置的。

在.emacs里添加了

(require 'cedet)
;semantiec基本配置
;见http://emacser.com/built-in-cedet.htm
(setq semantic-default-submodes '(global-semantic-idle-scheduler-mode
global-semanticdb-minor-mode
global-semantic-idle-summary-mode
global-semantic-mru-bookmark-mode))
(semantic-mode 1)
(global-semantic-highlight-edits-mode (if window-system 1 -1))
(global-semantic-show-unmatched-syntax-mode 1)
(global-semantic-show-parser-state-mode 1)
;代码跳转和官方版本一样还是用semantic-ia-fast-jump命令,不过在emacs-23.2里直接用这个命令可能会报下面的错误,所以运行时这个feature没被load进来,我们需要自己load一下:
(require 'semantic/analyze/refs)
(global-ede-mode t)

3 安装jdee,lib,ecb

我是依照http://longgue.iteye.com/blog/158784 进行配置的。

1:下载jdee,lib,ecb。(已安装cedet就不用再安了)

http://jdee.sourceforge.net/

http://ecb.sourceforge.net/

2:解压缩放入load-path目录。然后load,require。

(add-to-list 'load-path "~/.emacs.d/lisp/jdee-2.4.0.1/lisp")
(add-to-list 'load-path "~/.emacs.d/lisp/elib-1.0")
(add-to-list 'load-path "~/.emacs.d/lisp/ecb-2.40")
(require 'font-lock)
(require 'ecb)
(require 'ecb-autoloads)
(require 'jde)

但配置好,重启emacs出现错误:File error: Cannot open load file, semantic-ctxt。搜google找到http://stackoverflow.com/questions/3134026/emacs-23-2-with-ecb-2-40-file-error-cannot-open-load-file-semantic-ctxt 依照其方法,在.emacs文件中添加provide xx

(require 'semantic/analyze) (provide 'semantic-analyze) (provide 'semantic-ctxt) (provide 'semanticdb) (provide 'semanticdb-find) (provide 'semanticdb-mode) (provide 'semantic-load)

(add-to-list 'load-path "~/ecb-2.40") (require 'ecb)

重启后,依然出现 File error: Cannot open load file, semantic-什么什么。这时依葫芦画瓢,在.emacs里面添加 (provide 'semantic-什么什么) ,然后重复:重启-错误-添加.emacs,几次以后终于不再出现错误。(emacs24用此方法无效,依然出现错误,叫wrong 参数 number)。

3.1 测试

新建HelloWorld.java文件

public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World !");
}
}

保存。按菜单栏的Java-compile.然后Java-run。可以看到输出结果。

Footnotes:

1 :下载地址见 http://gooss.org/getting-started-guide-emacs-iii-custom-color-matching-the-expansion-of-the-use-of-elisp/

2 :见http://www.emacswiki.org/cgi-bin/wiki?ColorTheme 里content的install部分:Put the file color-theme.el and the folder “themes” (with the files color-theme-example.el and color-theme-library.el) in a directory on your LoadPath. ) load-path: 在.emacs配置文件中设置。可使用:(add-to-list 'load-path "~/.emacs.d/lisp/") 来添加~/.emacs.d/lisp文件夹为load-path。

3 :如果没有.emacs配置文件,可依下面方法建立:打开Emacs,按C-x 加 C-f,然后在minibar输入~ ,回车。可看到进入了一个目录,这就是.emacs文件需要放的目录。然后在emacs的菜单栏-file-open file,找到前面提到的”~“目录,打开.emacs,Emacs会自动创建出.emacs文件,然后点保存,就可以了。

Author: <acer@ACER-1707DDC0CC>

Date: 2012-01-08 15:19:58

HTML generated by org-mode 6.33x in emacs 23

posted @ 2012-01-08 15:22  闲暇捻码  阅读(1303)  评论(0编辑  收藏  举报