# Rails on emacs - need a working .emacs sample

**URL:** <https://www.ruby-forum.com/t/rails-on-emacs-need-a-working-emacs-sample/54863>\
**Category:** Rails\
**Created:** [March 14, 2006, 10:00pm UTC](https://www.ruby-forum.com/t/rails-on-emacs-need-a-working-emacs-sample/54863 "2006-03-14T22:00:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bakki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bakki](https://www.ruby-forum.com/u/bakki)\
**Post date:** [March 14, 2006, 10:00pm UTC](https://www.ruby-forum.com/t/rails-on-emacs-need-a-working-emacs-sample/54863/1 "2006-03-14T22:00:43Z")

</div>

I would like to hear from some one who has ecb, multiple modes with  
ruby mode + html mode, rails mode all working together and playing  
well.

I had ecb working with Ruby syntax highlighting. That was a no-brainer  
since I just had to apt-get them on my Debian Sarge box.

It got a bit more comlex after I got most of the .el files in the  
articles  
[EmacsWiki: Ruby On Rails](http://www.emacswiki.org/cgi-bin/emacs/RubyOnRails) -and-  
[Peak Obsession](http://wiki.rubyonrails.com/rails/pages/HowToUseEmacsWithRails).

Each of these has a sample of .emacs and I see that some commands may  
be duplicated.

eg, (setq auto-mode-alist (cons '(“\.rhtml$” . html-mode)  
auto-mode-alist))  
and  
(add-to-list 'auto-mode-alist '(“\.rhtml$” . html-mode))

I copied both of these files into my .emacs and have been playing with  
commenting out or uncommenting various lines. (Obviously I am not  
elisp proficient) While I have ecb still working, Ruby mode is now  
broken while rails mode commands still don’t work.

I would very much appreciate any one who can help me out in properly  
setting up these modes. Thanks,

bakki

---

<div class="post-metadata">

**Author:** ![bakki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bakki](https://www.ruby-forum.com/u/bakki)\
**Post date:** [March 14, 2006, 11:27pm UTC](https://www.ruby-forum.com/t/rails-on-emacs-need-a-working-emacs-sample/54863/2 "2006-03-14T23:27:00Z")

</div>

heres mine… basically i just installed these via portage:

apel-10.6/  
cedet-1.0\_pre3/  
cmail-2.62/  
css-mode-0.11/  
ecb-2.32/  
elib-1.0/  
emacs-w3m-1.4.4/  
flim-1.14.8/  
folding-2.97/  
mew-4.2/  
mmm-mode-0.4.8-r1/  
php-mode-1.1.0/  
pymacs-0.22/  
python-mode-4.70/  
ruby-mode-1.8.4/  
semi-1.14.6/

copied the ECB browser icons out of their CVS tarball since portage  
didnt install them, then put a few .el’s into  
/usr/share/emacs/site-lisp:

ido, better buffer/file selection  
ruby-electric, not sure what this does besides adding an end for a def  
rails, you know what this is, i think it mainly helps with snippets

then -eval “(ecb-activate)” on launch (or enable it by default)

the web forum email autowrapping will proably totally send the format to  
hell, my backup is at [http://whats-your.name/.emacs](http://whats-your.name/.emacs)

(load “/usr/share/emacs/site-lisp/site-gentoo”)  
;;(menu-bar-mode nil)  
;;(tool-bar-mode nil)  
(add-to-list 'auto-mode-alist ‘("SConstruct\’" . python-mode))  
(add-to-list 'auto-mode-alist ‘("SConscript\’" . python-mode))  
(add-to-list 'auto-mode-alist '(“\.tk” . tcl-mode))  
(add-to-list 'auto-mode-alist '(“\.wid” . tcl-mode))  
(add-to-list 'auto-mode-alist '(“\.rjs” . ruby-mode))  
(add-to-list 'auto-mode-alist '(“\.mab” . ruby-mode))  
(add-to-list 'auto-mode-alist '(“\.psp” . python-mode))  
(add-to-list 'auto-mode-alist '(“\.rhtml$” . html-mode))  
(add-to-list 'auto-mode-alist '(“/mutt” . mail-mode))  
(add-hook 'shell-mode-hook 'goto-address)  
(add-hook 'Man-mode-hook 'goto-address)  
(setq inhibit-startup-message t) ; Don’t want any startup message  
(setq make-backup-files nil) ; Don’t want any backup files  
(setq auto-save-list-file-name nil) ; Don’t want any .saves files  
(setq auto-save-default nil) ; Don’t want any auto saving  
(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.  
'(auto-save-default t)  
'(auto-save-interval 60)  
'(blink-cursor-delay 0.2)  
'(blink-cursor-interval 0.2)  
'(browse-url-browser-function (quote browse-url-mozilla))  
'(browse-url-mozilla-program “firefox”)  
'(buffer-auto-save-file-format t t)  
'(comint-completion-autolist t)  
'(cua-mode nil nil (cua-base))  
'(delete-auto-save-files nil)  
'(display-time-mode t)  
'(ecb-auto-activate nil)  
'(ecb-directories-menu-user-extension-function (quote ignore))  
'(ecb-history-menu-user-extension-function (quote ignore))  
'(ecb-layout-window-sizes (quote ((“left8” (0.19631901840490798 .  
0.2916666666666667) (0.19631901840490798 . 0.23958333333333334)  
(0.19631901840490798 . 0.2916666666666667) (0.19631901840490798 .  
0.16666666666666666)))))  
'(ecb-methods-menu-user-extension-function (quote ignore))  
'(ecb-options-version “2.32”)  
'(ecb-source-path (quote (“/” (“/a/var/www/cracklog” “cracklog”)  
(“/a/var/www/s43” “s43”) (“/a/var/www/sidebyside” “sidebyside”))))  
'(ecb-sources-menu-user-extension-function (quote ignore))  
'(ecb-tip-of-the-day nil)  
'(ecb-vc-enable-support t)  
'(ecb-vc-supported-backends (quote ((ecb-vc-dir-managed-by-SVN .  
ecb-vc-state))))  
'(face-default-stipple “gray3” t)  
'(global-font-lock-mode t nil (font-core))  
'(global-semantic-idle-completions-mode t nil (semantic-idle))  
'(make-cursor-line-fully-visible t t)  
'(mmm-submode-decoration-level 2)  
'(partial-completion-mode t)  
'(read-file-name-completion-ignore-case nil)  
'(server-mode t)  
'(show-paren-mode t)  
'(transient-mark-mode t)  
'(truncate-partial-width-windows nil)  
'(url-handler-mode t)  
'(url-history-track t)  
'(vc-handled-backends (quote (SVN)))  
'(w3m-about-history-indent-level 4 t)  
'(w3m-default-display-inline-images t)  
'(w3m-file-coding-system-for-read nil t)  
'(w3m-image-viewer “/usr/bin/display” t)  
'(w3m-verbose nil t)  
'(x-stretch-cursor t))  
(ansi-color-for-comint-mode-on)  
(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.  
'(default ((t (:stipple nil :background “#000000” :foreground “#ffffff”  
:inverse-video t :box nil :strike-through nil :overline nil :underline  
nil :slant normal :weight normal :height 96 :width normal :family  
“microsoft-consolas”))))  
'(cursor ((t (:background “#ff3eb2” :foreground “green”))) t)  
'(font-lock-builtin-face ((((class color) (min-colors 88) (background  
light)) (:foreground “#b802b2”))))  
'(font-lock-constant-face ((t (:background “white” :foreground  
“#00cccc”))))  
'(font-lock-string-face ((((class color) (min-colors 88) (background  
light)) (:foreground “DarkOrange”))))  
'(font-lock-variable-name-face ((((class color) (min-colors 88)  
(background light)) (:foreground “HotPink”))))  
'(mmm-cleanup-submode-face ((t (:background “#aacc33”))))  
'(mmm-code-submode-face ((t (:background “HotPink”))))  
'(mmm-output-submode-face ((t (:background “#f80000” :foreground  
“white”))))  
'(region ((((class color) (min-colors 88) (background dark))  
(:background “wgute” :foreground “blue3” :inverse-video t))))  
'(secondary-selection ((((class color) (min-colors 88) (background  
dark)) (:background “SkyBlue4” :foreground “#9999ff”))))  
'(vhdl-font-lock-directive-face ((((class color) (background light))  
(:foreground “#29dee4”))))  
'(vhdl-font-lock-generic-/constant-face ((((class color) (background  
light)) (:foreground “#decc29”)))))

(require 'cedet)  
(semantic-load-enable-code-helpers)  
(require 'mmm-mode)  
(require 'mmm-auto)  
(setq mmm-global-mode 'maybe)  
(setq mmm-submode-decoration-level 2)  
(mmm-add-classes  
'((erb-code  
:submode ruby-mode  
:match-face ((“\<%#” . mmm-comment-submode-face)  
(“\<%=” . mmm-output-submode-face)  
(“\<%” . mmm-code-submode-face))  
:front “\<%[#=]?”  
:back “%\>”  
:insert ((?% erb-code nil @ “\<%” @ " " \_ " " @ “%\>” @)  
(?# erb-comment nil @ “\<%#” @ " " \_ " " @ “%\>” @)  
(?= erb-expression nil @ “\<%=” @ " " \_ " " @ “%\>” @)))))  
(add-hook 'html-mode-hook  
(lambda ()  
(local-set-key (kbd “”) 'mmm-parse-buffer)  
(setq mmm-classes '(erb-code))  
(mmm-mode-on)))  
(require 'ruby-electric)  
(defun my-ruby-mode-hook ()  
(ruby-electric-mode))  
(add-hook 'ruby-mode-hook 'my-ruby-mode-hook)  
(require 'ido)  
(ido-mode t)  
(defun try-complete-abbrev (old)  
(if (expand-abbrev) t nil))

(setq hippie-expand-try-functions-list  
'(try-complete-abbrev  
try-complete-file-name  
try-expand-dabbrev))

(require 'rails)

---

<div class="post-metadata">

**Author:** ![bakki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bakki](https://www.ruby-forum.com/u/bakki)\
**Post date:** [March 15, 2006, 12:32am UTC](https://www.ruby-forum.com/t/rails-on-emacs-need-a-working-emacs-sample/54863/3 "2006-03-15T00:32:07Z")

</div>

What I’d really like is a trick so that psgml mode ‘knows’ what the DTD  
is, and where the current file fits into the layout, when dealing with  
anything other than layouts.

–  
David N. Welton

- [http://www.dedasys.com/davidw/](http://www.dedasys.com/davidw/)

Linux, Open Source Consulting

- [http://www.dedasys.com/](http://www.dedasys.com/)

---

<div class="post-metadata">

**Author:** ![bakki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bakki](https://www.ruby-forum.com/u/bakki)\
**Post date:** [March 14, 2006, 11:51pm UTC](https://www.ruby-forum.com/t/rails-on-emacs-need-a-working-emacs-sample/54863/4 "2006-03-14T23:51:38Z")

</div>

Carmen,

Thank you for your help. I will have to see which of the .el you have  
listed is already in site-lisp and add those which are missing. I’ll  
give your .emacs a try and see how it works.

-bakki
