Rails on emacs - need a working .emacs sample

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

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
http://www.emacswiki.org/cgi-bin/emacs/RubyOnRails -and-

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)
(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,


heres mine… basically i just installed these via portage:


copied the ECB browser icons out of their CVS tarball since portage
didnt install them, then put a few .el’s into

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

(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 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 .
'(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 .
'(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))
;; 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
'(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
'(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
'(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)
(require 'mmm-mode)
(require 'mmm-auto)
(setq mmm-global-mode 'maybe)
(setq mmm-submode-decoration-level 2)
: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))
(require 'ruby-electric)
(defun my-ruby-mode-hook ()
(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

(require 'rails)

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

Linux, Open Source Consulting


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.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs