2008-11-29
rails.elの設定ではまった
色々バグフィックスされているがまったくリリースする気なさげなので最新を取得しておく.
$ svn co http://emacs-rails.rubyforge.org/svn/trunk/
yasnippetとの相性
ちょっと併用して使えないので
(add-hook 'rails-minor-mode-hook '(lambda () (yas/minor-mode-off)))
でオフした.
Ctr+Enter
rails.elでは,
render :partial => "hoge" render :action => "fuga"
などの部分でCtr+Enterを押すとそのテンプレートに飛んでくれる.
しかし,".rhtml"拡張子にしか対応してない.
最近のRailsでは".html.erb"を使うのでこれを修正した.
Index: rails-core.el =================================================================== --- rails-core.el (リビジョン 232) +++ rails-core.el (作業コピー) @@ -236,14 +236,14 @@ "Return the file name of partial NAME." (if (string-match "/" name) (concat "app/views/" - (replace-regexp-in-string "\\([^/]*\\)$" "_\\1.rhtml" name)) + (replace-regexp-in-string "\\([^/]*\\)$" "_\\1.html.erb" name)) (concat (rails-core:views-dir (rails-core:current-controller)) - "_" name ".rhtml"))) + "_" name ".html.erb"))) (defun rails-core:view-name (name) "Return the file name of view NAME." (concat (rails-core:views-dir (rails-core:current-controller)) - name ".rhtml")) ;; BUG: will fix it + name ".html.erb")) ;; BUG: will fix it (defun rails-core:helper-file (controller) "Return the helper file name for the controller named @@ -669,6 +669,6 @@ (defun rails-core:rhtml-buffer-p () "Return non nil if the current buffer is rhtml file." - (string-match "\\.rhtml$" (buffer-file-name))) + (string-match "\\.html.erb$" (buffer-file-name))) (provide 'rails-core) Index: rails-view-minor-mode.el =================================================================== --- rails-view-minor-mode.el (リビジョン 232) +++ rails-view-minor-mode.el (作業コピー) @@ -43,7 +43,7 @@ (insert "\n") (split-window-vertically) (other-window 1) - (find-file (concat "_" name ".rhtml")) + (find-file (concat "_" name ".html.erb")) (goto-char (point-min)) (erase-buffer) (insert content)
かなりアドホックだけど..まぁいいか.
トラックバック - http://d.hatena.ne.jp/authorNari/20081129/1227932427
リンク元
- 6 http://ezsch.ezweb.ne.jp/search/ezGoogleMain.php?query=マリオ&start-index=4&adpage=3&mode=02
- 6 http://ezsch.ezweb.ne.jp/search/ezGoogleMain.php?query=スーパーマリオ&start-index=4&adpage=3&mode=02
- 4 http://reader.livedoor.com/reader/
- 3 http://homepage3.nifty.com/hebaruzin/mekiki/view/mekiki.html
- 3 http://search.yahoo.co.jp/search?p=ブラッディ+マンデイの意味&sp=1&search_x=1&tid=top_ga1&ei=UTF-8&fr=top_ga1&SpellState=n-4178772553_q-XAuZbHQkDgg7PWb6lC.aVQAAAA@@
- 2 http://b.hatena.ne.jp/keyword/rails?sort=eid
- 2 http://d.hatena.ne.jp/keyword/コピー
- 2 http://ezsch-stg.ezweb.ne.jp/search/ezGoogleMain.php?query=マリオ&start-index=4&adpage=3&mode=02
- 2 http://ezsch.ezweb.ne.jp/search/ezGoogleMain.php?query=にこ☆さうんど&start-index=4&adpage=3&mode=02
- 2 http://nicowiki.com/tools.html


