天天看點

Emacs + ECB + CygWin + Cedet Emacs + ECB + CygWin + Cedet

Emacs + ECB + CygWin + Cedet

發表于  2009年04月4日  由  pipi95

第一步:安裝cgywin(它是windows平台下實作linux環境的一個工具,如果你已經安裝了此工具,則此步可略過)

1,安裝cygwin;

2,下載下傳http://www.khngai.com/emacs/cygwin-mount.el

存入emacs目錄下、自己建的mylist目錄 

3,在.emacs配置檔案中加入(加載cygwin):

(setenv “PATH” (concat “c:/programs/cygwin/bin;” (getenv “PATH”)))

(setq exec-path (cons “c:/programs/cygwin/bin/” exec-path))

(require ‘cygwin-mount)

(cygwin-mount-activate)

4,接着,在.emacs檔案中再加入(把dos shell替換成bash shell):

(add-hook ‘comint-output-filter-functions

‘shell-strip-ctrl-m nil t)

(add-hook ‘comint-output-filter-functions

‘comint-watch-for-password-prompt nil t)

(setq explicit-shell-file-name “bash.exe”)

;; For subprocesses invoked via the shell

;; (e.g., “shell -c command”)

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

5,ok了。如果想要檢視cygwin的$HOME實際路徑,在cygwin控制台下用指令:echo

$HOME.

第二步:下載下傳cedet和ecb包(google一下,立刻出現)

然後在cygwin控制台下,解壓:tar xvzf cedet包名,tar xvzf ecb包名

進入解壓後的目錄,先進入解壓出來的cedet包進行make,然後進入解壓出來的

ecb目錄,先編輯修改makefile檔案,我的為:

CEDET=/cygdrive/d/emacs-22.3-bin-i386/emacs-22.3/myLisp/cedet-1.0pre4。

注意d盤,在cygwin下的寫法。然後編譯。

然後把這兩個目錄copy到自己建的List 目錄中,再在.emacs目錄中配置如下:

;;————————cedet+ecb———————

(load-file “D:\\emacs-22.3-bin-i386\\emacs-22.3\\myLisp\\cedet-1.0pre4\\common\\cedet.el”)

(semantic-load-enable-code-helpers)

(add-to-list ‘load-path “D:\\emacs-22.3-bin-i386\\emacs-22.3\\myLisp\\ecb-2.32″)

(require ‘ecb)

注:路徑中的myLisp目錄是我自己建的專門放置自己搜集來的插件的目錄,你可

以建立你自己的目錄,或者把插件放進emacs裡的公共lisp目錄中。

重新開機emacs,輸入指令:M-x ecb-activate激活ecb.

注:我的.emacs檔案(.emacs檔案在windows系統中處于“C:\Documents and settings\usrname\Application Data”目錄下)

;; 增加cygwin的配置項目

(setenv “PATH” (concat “d:/cygwin/bin;” (getenv “PATH”)))

(setq exec-path (cons “d:/cygwin/bin/” exec-path))

(require ‘cygwin-mount)

(cygwin-mount-activate)

(add-hook ‘comint-output-filter-functions

‘shell-strip-ctrl-m nil t)

(add-hook ‘comint-output-filter-functions

‘comint-watch-for-password-prompt nil t)

(setq explicit-shell-file-name “bash.exe”)

;; For subprocesses invoked via the shell

;; (e.g., “shell -c command”)

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

;; 增加session的配置項,來源于session的INSTALL檔案的說明

(require ‘session)

(add-hook ‘after-init-hook ‘session-initialize)

;; 增加CEDET的配置項,來源于CEDET的INSTALL檔案

;; Load CEDET.

;; See cedet/common/cedet.info for configuration details.

(load-file “D:\\Program Files\\emacs-22.3\\site-Lisp\\cedet-1.0pre6\\common\\cedet.el”)

;; Enable EDE (Project Management) features

(global-ede-mode 1)

;; Enable EDE for a pre-existing C++ project

;; (ede-cpp-root-project “NAME” :file “~/myproject/Makefile”)

;; Enabling Semantic (code-parsing, smart completion) features

;; Select one of the following:

;; * This enables the database and idle reparse engines

(semantic-load-enable-minimum-features)

;; * This enables some tools useful for coding, such as summary mode

;;   imenu support, and the semantic navigator

(semantic-load-enable-code-helpers)

;; * This enables even more coding tools such as intellisense mode

;;   decoration mode, and stickyfunc mode (plus regular code helpers)

;; (semantic-load-enable-gaudy-code-helpers)

;; * This enables the use of Exuberent ctags if you have it installed.

;;   If you use C++ templates or boost, you should NOT enable it.

;; (semantic-load-enable-all-exuberent-ctags-support)

;; Enable SRecode (Template management) minor-mode.

;; (global-srecode-minor-mode 1)

;; 增加ECB的配置項

(add-to-list ‘load-path “D:\\Program Files\\emacs-22.3\\site-Lisp\\ecb-2.32″)

(require ‘ecb)

(custom-set-variables

;; custom-set-variables was added by Custom.

;; If you edit it by hand, you could mess it up, so be careful.

;; Your init file should contain only one such instance.

;; If there is more than one, they won’t work right.

‘(ecb-options-version “2.32″))

(custom-set-faces

;; custom-set-faces was added by Custom.

;; If you edit it by hand, you could mess it up, so be careful.

;; Your init file should contain only one such instance.

;; If there is more than one, they won’t work right.

)

轉自http://www.feelingbox.cn/archives/337