分享
 
 
 

Emacs之JDEE大餐烹饪方法

王朝java/jsp·作者佚名  2006-02-01
窄屏简体版  字體: |||超大  

James Gosling:Java 是 10 年前发明的语言,在 Sun ,没有多少人用开发集成环境(IDE),因为 IDE 是面向低级程序员的,而真正的程序员使用的最好的工具应该是 Emacs,这个 23 年前,我就为之付出了一些心血的家伙。

一、原料:

0、厨房:Windows XP,另外‘厨房重地,谢绝闲人(hacker、Trojan horse= =)’;

1、emacs一只,产地:http://ftp.gnu.org/gnu/windows/emacs/latest/或者从CVS摘一只(不过我的CVS源码没有编译成功:P);

2、JDE及其文档各一斤(这个是原材料里面最大的东东了),出自http://java.sun.com/j2se/downloads/;

3、类浏览器speedbar、语法分析器semantic和eieio(OO lisp)各一汤匙,k级别的小东西,可以单独下载最新版本,唉?麻烦?!没关系,http://cedet.sourceforge.net/这里面有个cedet的包,有了它就都有了;

4、elib(Emacs lisp Utilities)一个,从http://jdee.sunsite.dk/elib-1.0.tar.gz挖一个;

吼~,到这里就万事具备了,生火~~,喂~~~呜~~~

二、流程:

1、将emacs洗净解压,在其根目录新建一个HOME目录,当然此目录建在其它地方也可以,在厨房内(也就是系统内啦)设置一个名为HOME的环境变量,变量的值是刚才新建的HOME目录的路径;

2、将jde、文档、cedet、elib这一些材料全都洗净解压,把他们解压到Home目录中便于使用;

3、接下来的操作在jde的文档里已经有详细的英文说明,所以下面挑出必要的几个设置来说一说,在HOME的目录里面建一个名称为'.emacs'的文件(用记事本编辑即可),此处http://jdee.sunsite.dk/install.html有一个 minimal .emacs file(内容我放在‘附’里面),可直接把它copy&paste到.emacs中,此外最多只需要改动四句:

(add-to-list 'load-path (expand-file-name "~/emacs/site/jde/lisp"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet/common"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))

;; Initialize CEDET.

(load-file (expand-file-name "~/emacs/site/cedet/common/cedet.el"))

‘~’号代表流程1中所设置的系统环境变量值(即Home目录的绝对路径),它的后面分别是jde、cedet、elib相对此目录的相对路径,至此,启动emacs能看到.emacs的载入过程,如果能正常启动,则说明配置文件可以无误的载入,下面安装完jdk就可以看到Jdee大餐了,下面设置过程如果输入命令是出错可以按快捷键Ctrl-g中断命令;

4、按M-X(Alt-x),然后输入M-x customize-variable ,回车后,会有Customize variable:的提示,然后输入jde-jdk-registry,会看到

点‘INS’,

输入JDK的版本号和绝对路径,如:

点‘INS’,

输入JDK的版本号和绝对路径,如:

点‘INS’,

输入JDK的版本号和绝对路径,如:

点击Save for Future Sessions表示将来编辑的工程都会使用此设置,这一步会自动写入你的.emacs文件中,最后Finish就可以了。

5、选择JDK:输入M-x customize-variable 回车,然后输入jde-jdk 回车,

选择后,Save for Future Sessions 最后Finish就好了。此时JDK就算设置好了,你试着输入M-x jde-mode就可以进入到emacs的java编辑世界了,菜单上也多了许多,效果如下

6、JDEE的功能还远远不止与此,想不想要Eclipse或Jbuilder的代码提示功能,简单设置一下马上就可以用。输入M-x customize-variable 回车,然后输入jde-complete-function 回车,如下:

选择你喜欢的方式,并点State保存选择,效果如下:

选择你喜欢的方式,并点State保存选择,效果如下:

7、还有像Jbuiler或Eclipse一样的树型的工程浏览器SpeedBar,如下图

这就像一个IDE了吧,还能安装插件成为XDE,关于这个可以参考JDEE的文档或http://jdee.sunsite.dk/jdedoc/html/jde-ug/jde-ug.html,这里就不再详细说明了。

三.附:minimal .emacs file

;; This .emacs file illustrates the minimul setup

;; required to run the JDE.

;; Set the debug option to enable a backtrace when a

;; problem occurs.

(setq debug-on-error t)

;; 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 "~/emacs/site/jde/lisp"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet/common"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))

;; Initialize CEDET.

(load-file (expand-file-name "~/emacs/site/cedet/common/cedet.el"))

;; 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)

;; Include the following only if you want to run

;; bash as your shell.

;; Setup Emacs to run bash as its primary shell.

(setq shell-file-name "bash")

(setq shell-command-switch "-c")

(setq explicit-shell-file-name shell-file-name)

(setenv "SHELL" shell-file-name)

(setq explicit-sh-args '("-login" "-i"))

(if (boundp 'w32-quote-process-args)

(setq w32-quote-process-args ?\")) ;; Include only for MS Windows.

这就像一个IDE了吧,还能安装插件成为XDE,关于这个可以参考JDEE的文档或http://jdee.sunsite.dk/jdedoc/html/jde-ug/jde-ug.html,这里就不再详细说明了。

三.附:minimal .emacs file

;; This .emacs file illustrates the minimul setup

;; required to run the JDE.

;; Set the debug option to enable a backtrace when a

;; problem occurs.

(setq debug-on-error t)

;; 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 "~/emacs/site/jde/lisp"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet/common"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))

;; Initialize CEDET.

(load-file (expand-file-name "~/emacs/site/cedet/common/cedet.el"))

;; 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)

;; Include the following only if you want to run

;; bash as your shell.

;; Setup Emacs to run bash as its primary shell.

(setq shell-file-name "bash")

(setq shell-command-switch "-c")

(setq explicit-shell-file-name shell-file-name)

(setenv "SHELL" shell-file-name)

(setq explicit-sh-args '("-login" "-i"))

(if (boundp 'w32-quote-process-args)

(setq w32-quote-process-args ?\")) ;; Include only for MS Windows.

6、JDEE的功能还远远不止与此,想不想要Eclipse或Jbuilder的代码提示功能,简单设置一下马上就可以用。输入M-x customize-variable 回车,然后输入jde-complete-function 回车,如下:

选择你喜欢的方式,并点State保存选择,效果如下:

选择你喜欢的方式,并点State保存选择,效果如下:

7、还有像Jbuiler或Eclipse一样的树型的工程浏览器SpeedBar,如下图

这就像一个IDE了吧,还能安装插件成为XDE,关于这个可以参考JDEE的文档或http://jdee.sunsite.dk/jdedoc/html/jde-ug/jde-ug.html,这里就不再详细说明了。

三.附:minimal .emacs file

;; This .emacs file illustrates the minimul setup

;; required to run the JDE.

;; Set the debug option to enable a backtrace when a

;; problem occurs.

(setq debug-on-error t)

;; 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 "~/emacs/site/jde/lisp"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet/common"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))

;; Initialize CEDET.

(load-file (expand-file-name "~/emacs/site/cedet/common/cedet.el"))

;; 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)

;; Include the following only if you want to run

;; bash as your shell.

;; Setup Emacs to run bash as its primary shell.

(setq shell-file-name "bash")

(setq shell-command-switch "-c")

(setq explicit-shell-file-name shell-file-name)

(setenv "SHELL" shell-file-name)

(setq explicit-sh-args '("-login" "-i"))

(if (boundp 'w32-quote-process-args)

(setq w32-quote-process-args ?\")) ;; Include only for MS Windows.

这就像一个IDE了吧,还能安装插件成为XDE,关于这个可以参考JDEE的文档或http://jdee.sunsite.dk/jdedoc/html/jde-ug/jde-ug.html,这里就不再详细说明了。

三.附:minimal .emacs file

;; This .emacs file illustrates the minimul setup

;; required to run the JDE.

;; Set the debug option to enable a backtrace when a

;; problem occurs.

(setq debug-on-error t)

;; 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 "~/emacs/site/jde/lisp"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet/common"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))

;; Initialize CEDET.

(load-file (expand-file-name "~/emacs/site/cedet/common/cedet.el"))

;; 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)

;; Include the following only if you want to run

;; bash as your shell.

;; Setup Emacs to run bash as its primary shell.

(setq shell-file-name "bash")

(setq shell-command-switch "-c")

(setq explicit-shell-file-name shell-file-name)

(setenv "SHELL" shell-file-name)

(setq explicit-sh-args '("-login" "-i"))

(if (boundp 'w32-quote-process-args)

(setq w32-quote-process-args ?\")) ;; Include only for MS Windows.

选择后,Save for Future Sessions 最后Finish就好了。此时JDK就算设置好了,你试着输入M-x jde-mode就可以进入到emacs的java编辑世界了,菜单上也多了许多,效果如下

6、JDEE的功能还远远不止与此,想不想要Eclipse或Jbuilder的代码提示功能,简单设置一下马上就可以用。输入M-x customize-variable 回车,然后输入jde-complete-function 回车,如下:

选择你喜欢的方式,并点State保存选择,效果如下:

选择你喜欢的方式,并点State保存选择,效果如下:

7、还有像Jbuiler或Eclipse一样的树型的工程浏览器SpeedBar,如下图

这就像一个IDE了吧,还能安装插件成为XDE,关于这个可以参考JDEE的文档或http://jdee.sunsite.dk/jdedoc/html/jde-ug/jde-ug.html,这里就不再详细说明了。

三.附:minimal .emacs file

;; This .emacs file illustrates the minimul setup

;; required to run the JDE.

;; Set the debug option to enable a backtrace when a

;; problem occurs.

(setq debug-on-error t)

;; 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 "~/emacs/site/jde/lisp"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet/common"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))

;; Initialize CEDET.

(load-file (expand-file-name "~/emacs/site/cedet/common/cedet.el"))

;; 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)

;; Include the following only if you want to run

;; bash as your shell.

;; Setup Emacs to run bash as its primary shell.

(setq shell-file-name "bash")

(setq shell-command-switch "-c")

(setq explicit-shell-file-name shell-file-name)

(setenv "SHELL" shell-file-name)

(setq explicit-sh-args '("-login" "-i"))

(if (boundp 'w32-quote-process-args)

(setq w32-quote-process-args ?\")) ;; Include only for MS Windows.

这就像一个IDE了吧,还能安装插件成为XDE,关于这个可以参考JDEE的文档或http://jdee.sunsite.dk/jdedoc/html/jde-ug/jde-ug.html,这里就不再详细说明了。

三.附:minimal .emacs file

;; This .emacs file illustrates the minimul setup

;; required to run the JDE.

;; Set the debug option to enable a backtrace when a

;; problem occurs.

(setq debug-on-error t)

;; 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 "~/emacs/site/jde/lisp"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet/common"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))

;; Initialize CEDET.

(load-file (expand-file-name "~/emacs/site/cedet/common/cedet.el"))

;; 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)

;; Include the following only if you want to run

;; bash as your shell.

;; Setup Emacs to run bash as its primary shell.

(setq shell-file-name "bash")

(setq shell-command-switch "-c")

(setq explicit-shell-file-name shell-file-name)

(setenv "SHELL" shell-file-name)

(setq explicit-sh-args '("-login" "-i"))

(if (boundp 'w32-quote-process-args)

(setq w32-quote-process-args ?\")) ;; Include only for MS Windows.

6、JDEE的功能还远远不止与此,想不想要Eclipse或Jbuilder的代码提示功能,简单设置一下马上就可以用。输入M-x customize-variable 回车,然后输入jde-complete-function 回车,如下:

选择你喜欢的方式,并点State保存选择,效果如下:

选择你喜欢的方式,并点State保存选择,效果如下:

7、还有像Jbuiler或Eclipse一样的树型的工程浏览器SpeedBar,如下图

这就像一个IDE了吧,还能安装插件成为XDE,关于这个可以参考JDEE的文档或http://jdee.sunsite.dk/jdedoc/html/jde-ug/jde-ug.html,这里就不再详细说明了。

三.附:minimal .emacs file

;; This .emacs file illustrates the minimul setup

;; required to run the JDE.

;; Set the debug option to enable a backtrace when a

;; problem occurs.

(setq debug-on-error t)

;; 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 "~/emacs/site/jde/lisp"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet/common"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))

;; Initialize CEDET.

(load-file (expand-file-name "~/emacs/site/cedet/common/cedet.el"))

;; 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)

;; Include the following only if you want to run

;; bash as your shell.

;; Setup Emacs to run bash as its primary shell.

(setq shell-file-name "bash")

(setq shell-command-switch "-c")

(setq explicit-shell-file-name shell-file-name)

(setenv "SHELL" shell-file-name)

(setq explicit-sh-args '("-login" "-i"))

(if (boundp 'w32-quote-process-args)

(setq w32-quote-process-args ?\")) ;; Include only for MS Windows.

这就像一个IDE了吧,还能安装插件成为XDE,关于这个可以参考JDEE的文档或http://jdee.sunsite.dk/jdedoc/html/jde-ug/jde-ug.html,这里就不再详细说明了。

三.附:minimal .emacs file

;; This .emacs file illustrates the minimul setup

;; required to run the JDE.

;; Set the debug option to enable a backtrace when a

;; problem occurs.

(setq debug-on-error t)

;; 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 "~/emacs/site/jde/lisp"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet/common"))

(add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))

;; Initialize CEDET.

(load-file (expand-file-name "~/emacs/site/cedet/common/cedet.el"))

;; 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)

;; Include the following only if you want to run

;; bash as your shell.

;; Setup Emacs to run bash as its primary shell.

(setq shell-file-name "bash")

(setq shell-command-switch "-c")

(setq explicit-shell-file-name shell-file-name)

(setenv "SHELL" shell-file-name)

(setq explicit-sh-args '("-login" "-i"))

(if (boundp 'w32-quote-process-args)

(setq w32-quote-process-args ?\")) ;; Include only for MS Windows.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有