將Emacs作為Ruby On Rails整合式開發環境

來源:互聯網
上載者:User

RubyForge項目裡的emacs-rails包,ruby發行中misc目錄下提供的ruby對emacs的支援,結合nXhtml Emacs addon的使用;一起提供了開發ROR項目的強大支援. 

簡要說一下安裝配置過程: 

1. 到RubyForge網站下載最新的emacs-rails包 

2. 下載emacs-rails依賴的lisp包 

* "http://www.kazmier.com/computer/snippet.el":snippets 
* "http://www.webweavertech.com/ovidiu/emacs/find-recursive.txt":frecursive 

3. 將所需的lisp包放入emacs的load path的一統一目錄下. 

解壓emacs-rails壓縮檔到emacs包配置目錄,如:"$HOME/.emacs.d/"或emacs目錄下的site-lisp目錄中,解壓後產生了emacs-rails目錄;我將其改名到rails.

將ruby安裝目錄下的misc目錄中的*.el檔案拷貝到rails目錄裡;(emacs-rails發行中的README中說(只)需要inf-ruby包,可能解釋的不是很清楚;最好將misc目錄中的所有檔案(至少是ruby-electric.el,ruby-mode.el和inf-ruby.el檔案放入). 

將snippet.el和find-recursive.el檔案也拷貝到rails目錄裡. 

4. 定製.emacs檔案 

在.emacs檔案中加入下面的內容: 
(setq load-path (cons "~/.emacs.d/rails" load-path)) 
(require 'rails) 
(setq auto-mode-alist 
  '( 
  ;; emacs-rails發行中的README中沒提及下面一行的設定,雖然開發環境能工作了,但*.rb等檔案不能文法高亮;所以需要加入下面的設定. 
  ("//.rb//'" . ruby-mode) 
  ;; ........ other mode relation 
  )) 

5. 安裝與定製nXhtml Emacs Addon 

nXhtml mode是Emacs的一個擴充包,提供了對編輯XHTML之類web檔案的豐富支援,利用其提供Multiple major modes,可以輕鬆地處理PHP, JSP, eRuby 之類的文檔. 

到nXhtml首頁下載最新的包,解壓到"$HOME/.emacs.d/"目錄中,在.emacs中加入下面一行: 

(load "~/.emacs.d/nxml/autostart.el") 

就可以利用其進行開發了;在開啟相關檔案後,可以按"M-x nxhtml-minor-mode"開啟nXhtml 模式,在nXhtml菜單中,可進行相關的定製,詳細使用請參考網站提供的文檔. 

參考資料: 

1. 到RubyForge網站下載emacs-rails包和相關的檔案 

2. 依據安裝配置的第二步提供的地址下載emacs-rails依賴的兩個lisp檔案,注意將第二個下載的txt檔案更名為find-recursive.el. 

3. 到nXhtml網站下載nXhtml包和參考使用說明文檔. 

4. nXhtml使用當中可能會遇到一些問題,請到Yahoo的emacs-nxml-mode組尋求協助或支援.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.