Windows7下Emacs开发Java配置和Emacs背景颜色设置(仅限Windows(7))

本人系统windows 7旗舰(64bit)

早上8:30点起床,打开本本,不经意打开了Emacs,想想最近的Java和javaWeb编写,于是想在windows7下的Emacs里写Java程序,于是google一下配置信息

第一个问题,Java类型定制:

找到很多linux下的配置,还有就是windows XP下的配置,先前知道点VIM的东西,知道这些基于Lisp下的东西都有配置的东西,于是找所谓的~.emacs文件,可是找了半天也没找到,google和百度上信息太多,什么.emacs.d文件夹,弄得头都大了,

现在就仔细说一下流程,找到你Emacs放置的目录(我的:D:\Program Files (x86)\Emacs_Windows v23.2\emacs-23.2\bin)下的addpm.exe点击执行,这样会同时在你的start启动里添加上GNU选项同时在你的C盘这个位置C:\Users\Administrator\AppData\Roaming (AppData默认隐藏,这就是找不到的原因)生成你的.emacs.d文件夹,然后自己在.emacs.d目录下写个~.emacs配置文件。

Java开发要下载JDee,cedet,elib,,,,等压缩文件,这些可以去sourcepage 那里去下载,然后解压到emacs目录下lisp-site 的文件(个人建议放在这里,因为这是默认配置的地方,然后在配置文件里统一加载文件位置,方便扩展)接下来就是~.emacs文件的配置问题了。

这是我个人的配置文件,邮件问题还没有解决。

第二个问题,颜色设置问题,first ,下载color-theme-6.6.0,然后放在emacs下的lisp-site文件夹下,再在配置文件里配置文件。

这里遇到最大的情况是配置之后,emacs依然保持原来的颜面,这让我搞了半天,最后发现就是配置文件放置的原因,但是说明一点,就是java配置的时候位置好像不是太关键,因为唯有改变配置文件之前可以加载上对Java格式的设置,但是背景颜色的设置必须要求配置文件位置正确。

最后,说明一下,windows7下关键问题就是确定.emacs.d文件夹得位置,还有就是~.emacs文件的配置,下面把我的配置文件与大家共享一下,

注意,email配置没有实现,大家跳过,还有初学Emacs,配置写的不够规范,希望参考的时候注意区分,今天的收获就是知道了有些东西就是在你一次次次尝试之后的结果。

                            感谢GNU提供的资料,同时纪念9、18事变,希望中国,,,,,,,

                             Mackal_li

                              2011/9/18

效果图

;; Set the debug option to enable a backtrace when a
;; problem occurs.
(setq debug-on-error t)

(setq user-mail-address
"guangxuli7@gmail.com")
(setq user-full-name
"liguangxu")

(setq frame-title-format
"%b")

;; no backup files
(setq make-backup-files nil)

;; delete unnecessary autosave files
(setq delete-
auto-save-files t)

;; delete oldversion files
(setq delete-old-versions t)

;;支持 emacs 和外部程序的粘贴
(setq x-select-enable-clipboard t)

;;
add Java Develop Environment
'(jde-jdk-registry (quote (("1.6.0_26" . "D:\Program Files\Java\jdk1.6.0_26"))))

;; 使emacs可以接受中文输入法
(set-keyboard-coding-system
'chinese-iso-8bit-dos)

;; 使emacs可以复制粘贴中文字符
(set-selection-coding-system
'chinese-iso-8bit-dos)

;; 设置背景颜色和字体颜色
(set-foreground-color "white")
(set-background-color "darkblue")

;; 颜色设置
(setq frame-background-mode
'dark)
(set-background-color
"black")
(set-foreground-color
"gray")
(set-cursor-color
"yellow")

;; 设置另外一些颜色:语法高亮显示的背景和主题,区域选择的背景和主题,二次选择的背景和选择
(set-face-foreground
'highlight "white")
(set-face-background
'highlight "blue")
(set-face-foreground
'region "cyan")
(set-face-background
'region "blue")
(set-face-foreground
'secondary-selection "skyblue")
(set-face-background
'secondary-selection "darkblue")

;; 邮件收发
(require
'smtpmail)
(setq smtpmail-debug-info t)
(setq send-mail-function
'smtpmail-send-it)
(setq message-send-mail-function
'smtpmail-send-it)
(setq smtpmail-default-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-server "smtp.gmail.com")
(setq smtpmail-local-domain "gmail.com")
(setq smtpmail-sendto-domain "gmail.com") ;; maybe
(setq smtpmail-auth-credentials ; or use ~/.authinfo
'(("smtp.gmail.com" 25 "usr" "pwd")))
(setq smtpmail-starttls-credentials
'(("smtp.gmail.com" 25 nil nil)))
(setq gnus-posting-styles
'((".*"
;; default
(name
"Mackal li")
(address
"guangxuli7_at_gmail_dot_com")
(signature-file
"~/.sig"))
(
"^nnml:mail.*" ;; 被我简化了的过滤规则
;; misc mail
(signature-file
"~/.sig")
(name
"Mackal li")
(address
"guangxuli7@gmail.com")))) ;; real address



;; Update the Emacs load-path to include the path to
;; the JDE
and its require packages. This code assumes
;; that you have installed the packages in the emacs/site
;; subdirectory of your home directory.
(
add-to-list 'load-path (expand-file-name "~/site-lisp/jdee/lisp"))
(add-to-list
'load-path (expand-file-name "~/site-lisp/cedet/common"))
(
add-to-list 'load-path (expand-file-name "~/site-lisp/elib"))
(add-to-list
'load-path (expand-file-name "~/site-lisp/color-theme"))

;;When the file locate the different loacation, the setting is different
;;more compare this two way

;;(
add-to-list 'load-path (expand-file-name "~/../site-lisp/cedet/common"))
;;(load-file (expand-file-name "~/../site-lisp/cedet/common/cedet.elc"))
;;(add-to-list
'load-path (expand-file-name "~/../site-lisp/jde/lisp"))
;;(
add-to-list 'load-path (expand-file-name "~/../site-lisp/elib"))

;;Add color-theme
(require
'color-theme)
(color-theme-initialize)
(color-theme-dark-blue)
(setq my-color-themes (list
'color-theme-billw 'color-theme-jsc-dark
'color-theme-sitaramv-solaris 'color-theme-resolve
'color-theme-classic 'color-theme-jonadabian-slate
'color-theme-kingsajz 'color-theme-shaman
'color-theme-subtle-blue 'color-theme-snowish
'color-theme-sitaramv-nt 'color-theme-wheat))

;; 在这里定义你得CLASSPATH 需要的话,就修改这个文件,然后 M-x load-file
(setq jde-compile-option-classpath (quote (
"./"
;;
"../" "http://www.cnblogs.com/" "http://www.cnblogs.com/../"
"d:/Program Files/Java/jdk1.6.0_26/lib/dt.jar"
"d:/Program Files/Java/jdk1.6.0_26/lib/tools.jar"
;;
"~/../bin/apache-ant/lib/ant.jar"
;;
"D:/mysoft/webserver/resin_3_0_21/lib/jsdk-24.jar"
;;
"D:/website/cqtel.softreg.com/WEB-INF/lib/webpro2.jar"
;;
"D:/website/cqtel.softreg.com/WEB-INF/lib/xfire-all-1.2.2.jar"
)))

(setq jde-debugger (quote (
"JDEbug")))

;; 用JDK1.5编译如果出现乱码,加上下面一行可以解决
(setq jde-compiler (quote (
"javac" "")))

(setq jde-complete-function (quote jde-complete-menu))

;; JDK版本号和JAVA_HOME
(jde-jdk-registry (quote ((
"1.6.0_26" . "D:\Program Files\Java\jdk1.6.0_26"))))

;; 定义 ANT_HOME
(setq jde-ant-home
"D:/emacs22/custom/bin/apache-ant")

;; 将 %ANT_HOME%/bin 放在你的环境变量PATH中
(setq jde-ant-program
"ant")
;;(setq jde-ant-program
"D:/emacs22/custom/bin/apache-ant/bin/ant")


;; Initialize CEDET.
(load-file (expand-file-name
"~/site-lisp/cedet/common/cedet.el"))

;; 开启Emacs时就载入Jde,这样msf-abbrev就不会出错
(require
'jde)
;; 反编译 C-x C-f 打开一个Jar包,在Class文件上按 j 就会给出反编译的代码
;; 需要 jad.exe 和 unzip.exe 配合
(load-file "~/../lisp/decomp.el")

(require
'jmaker)
(require
'jjar)
(require
'jsee)
(setq jmaker-end-of-line-format (quote dos))
(setq jmaker-java-compiler-options
"")

;; load ecb
(
add-to-list 'load-path (expand-file-name "~/../site-lisp/ecb"))
(require
'ecb)
;; 防止CPU占用
100%
(setq semantic-idle-scheduler-idle-time
432000)
;;


;;java 开发环境
(require
'font-lock)
(require
'cedet)
(require
'ecb)
(require
'ecb-autoloads)
(require
'jde)
;;

;; If you want Emacs to defer loading the JDE until you open a
;; Java file, edit the following line
;;(setq defer-loading-jde nil)
;; to read:
;;
(setq defer-loading-jde t)
;;

(if defer-loading-jde
(progn
(autoload
'jde-mode "jde" "JDE mode." t)
(setq
auto-mode-alist
(append
'(("\\.java\\'" . jde-mode))
auto-mode-alist)))
(require 'jde))


;; Sets the basic indentation for Java source files
;; to two spaces.
(defun my-jde-mode-hook ()
(setq c-basic-offset 2))

(add-hook 'jde-mode-hook 'my-jde-mode-hook)

posted @ 2011-09-18 23:25  java_li  阅读(6268)  评论(7编辑  收藏  举报