emacs 24 IDE配置(YASnippet、ECB、Cedet、Auto-complete)

29 篇文章 0 订阅
6 篇文章 0 订阅

1. 参考链接:

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

b. http://www.emacswiki.org/CollectionOfEmacsDevelopmentEnvironmentTools

c. http://guweigang.com/2010/09/gnu/%E4%BB%8A%E5%A4%A9%E5%9F%BA%E6%9C%AC%E9%85%8D%E5%A5%BD%E4%BA%86emacs%E4%BA%86%EF%BC%81.html

d. http://jovesky.sinaapp.com/2012/07/29/the-the-emacs24-configuration-cedet-and-ecb/

e. http://jianghao19890829.iteye.com/blog/1850791

f. http://blog.csdn.net/cnsword/article/details/7474119

g. http://jianghao19890829.iteye.com/

PS如果安装过程中遇到问题, 可以在本文后面的问题解决中查找。  我罗列了一些我安扎ung过程中遇到的问题。但是不保证你安装过程会遇到的问题也在其中。

2. 软件下载:

YASnippet下载地址:http://code.google.com/p/yasnippet/

Auto-complete下载地址:http://cx4a.org/software/auto-complete/index.html

Cedet安装下载地址:http://cedet.sourceforge.net/

ECB安装下载地址:http://ecb.sourceforge.net/

3. 软件安装:

a. 配置cedet

由于emacs自带的cedet1.0版本,不能与ecb配合使用,我们这里自己下载最新版的cedet1.1,直接make没有什么问题。 在 .emacs  中添加:

;;cedet

(add-to-list 'load-path

    "~/.emacs.d/plugins//cedet-1.1/common")

(load-file "~/.emacs.d/plugins//cedet-1.1/common/cedet.el")

(global-ede-mode 1)                      ; Enable the Project management system

(semantic-load-enable-code-helpers)      ; Enable prototype help and smart completion 

(global-srecode-minor-mode 1)            ; Enable template insertion menu

这里的~/.emacs.d/plugins//cedet-1.1/common请根据自己的路径修改

b. 配置ecb

这个最麻烦,一直出问题,编译的时候就提示找不到cedet,这里我们编译的时候这样写

make CEDET=~/.emacs.d/plugins//cedet-1.1/

(根据自己cedet存放的路径更改)

这样就找到了cedet的路径,然后他又提示cedet的版本不对,因为ecb还不支持cedet1.1,这里我们修改ecb-upgrade.el中的

(defconst ecb-required-cedet-version-max '(1 0 4 9))

(defconst ecb-required-cedet-version-max '(1 1 4 9))

并且注释其中的

;;      (when (or (not (boundp 'cedet-version))

;;                (ecb-package-version-list<

;;                 (ecb-package-version-str2list cedet-version)

;;                 ecb-required-cedet-version-min)

;;                (ecb-package-version-list<

;;                 ecb-required-cedet-version-max

;;                 (ecb-package-version-str2list cedet-version)))

;;        (setq version-error (concat "cedet ["

;;                                    cedet-required-version-str-min

;;                                    ", "

;;                                    cedet-required-version-str-max

;;                                    "]")))

这样就可以正常编译和使用了

最后我们添加如  .emacs

;;ecb

(add-to-list 'load-path

    "~/.emacs.d/plugins//ecb-2.40")

(require 'ecb)

(require 'ecb-autoloads)

(setq stack-trace-on-error nil)

(setq ecb-auto-activate t

      ecb-tip-of-the-day nil)

同样,根据自己的路径修改

PS:其中有一点真是恶心到我了,就是cedet的配置必须在ecb之前,不然ecb就会调用自带的cedt

c. 配置YASnippet

下载后解压到 ~/.emacs.d/plugins 目录下,然后在.emacs中添加

; yasnippet

 (add-to-list 'load-path

                  "~/.emacs.d/plugins/yasnippet-0.6.1c")

    (require 'yasnippet) ;; not yasnippet-bundle

    (yas/initialize)

    (yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets")

d. 配置Auto-complete

下载后解压到 ~/.emacs.d/plugins 目录下,然后打开  emacs  , 按照以下步骤操作:

Type M-x load-file RET in the running Emacs or newly launched Emacs. Note that if you want to upgrade auto-complete-mode, you have to install in a newly launched Emacs with -q option. Then input a file name to load which is a path string with adding /etc/install.el to the package directory. For example, if the package directory is ~/tmp/auto-complete-1.2, the file name will be ~/tmp/auto-complete-1.2/etc/install.el.

(按下 M-x  输入load-file 按下回车, 按照提示输入auto-complete的配置文件文件名。 如:~/tmp/auto-complete-1.2/etc/install.el.

Then input a directory where Auto Complete will be installed. You need to add a directory to load-path later if load-path doesn't include the directory. The directory is to be ~/.emacs.d by default.

Finally type RET to start installation. After installation, you may see the following buffer and follow instructions to edit .emacs.

添加如下代码到你的  .emacs 文件中

;; auto-complete

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

(require 'auto-complete-config)

(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")

(ac-config-default)

4. 问题解决:

a.    Warning: cedet-called-interactively-p called with 0 arguments, but requires 1

问题:“Warning: cedet-called-interactively-p called with 0 arguments, but requires 1

解决: can be suppressed by adding (setq byte-compile-warnings nil) in your .emacs file before CEDET is loaded

b.    Symbol's value as variable is void: stack-trace-on-error

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

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

c.    void-function make-local-hook

问题: (void-function make-local-hook)

解决: You can use this:

(defalias 'make-local-hook

  (if (featurep 'xemacs)

      'make-local-hook

    'ignore))

添加上述到你的.emacs文件中。(应该是屏蔽make-local-hook吧, 参考链接http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-03/msg00806.html


PS: 欢迎大家补充,完善。

5. 结果展示:

按照上面步骤完成操作后,生成的  .emacs  如下:

(我的所以插件都是放在 ~/.emacs.d/plugins/目录下的)

(setq byte-compile-warnings nil)

(setq stack-trace-on-error t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;      Cedet 1.1

;;

(load-file "~/.emacs.d/plugins/cedet-1.1/common/cedet.el")

      (global-ede-mode 1)                      ; Enable the Project management system

      (semantic-load-enable-code-helpers)      ; Enable prototype help and smart completion 

      (global-srecode-minor-mode 1)            ; Enable template insertion menu

;

;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;      ECB 2.40

;;

(add-to-list 'load-path

                    "~/.emacs.d/plugins/ecb-2.40")

(require 'ecb)

(require 'ecb-autoloads)

;; ;;;;窗口间切换

(global-set-key [M-left]  'windmove-left)

(global-set-key [M-right] 'windmove-right)

(global-set-key [M-up]    'windmove-up)

(global-set-key [M-down]  'windmove-down)

 ;;;;show&hide window

(global-set-key [C-f1] 'ecb-hide-ecb-windows)

(global-set-key [C-f2] 'ecb-show-ecb-windows)

;; ;;;; 使某一ecb窗口最大化

(global-set-key (kbd "C-c 1") 'ecb-maximize-window-directories)

(global-set-key (kbd "C-c 2") 'ecb-maximize-window-sources)

(global-set-key (kbd "C-c 3") 'ecb-maximize-window-methods)

(global-set-key (kbd "C-c 4") 'ecb-maximize-window-history)

;; ;;;;恢复原始窗口布局

(global-set-key (kbd "C-c 0") 'ecb-restore-default-window-sizes)

;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; yasnippet

 (add-to-list 'load-path

                  "~/.emacs.d/plugins/yasnippet-0.6.1c")

    (require 'yasnippet) ;; not yasnippet-bundle

    (yas/initialize)

    (yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets")

;; auto-complete

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

(require 'auto-complete-config)

(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")

(ac-config-default)

6. 整体配置。   

上面的一些插件安装好之后,如果没有进一步的配置的话,用起来也不会那么得心应手的。  于是我参照http://www.cnblogs.com/karotte/archive/2012/06/06/2537670.html  这位大神的配置(他用的版本是emacs23 我的是24, 完全按照他的配置是行不通的,会有很多错误。 于是就参照着他的修修改改,最终算是成功的移植到了我的emacs上吧)

这是我的配置:  我的插件都是放在 ~/.emacs.d/plugins   目录下的。   压缩包里面有一个 _emacs 文件夹, 这个放在  ~  目录下就可以了。

这里是我的链接: http://download.csdn.net/detail/a593796769/5488405

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值