What Emacs feature(s), packages, add-ons, etc. helps you in your daily Ruby On Rails development?
-
2the comma is too much. it is C-x C-c in correct nomenclature – Peter Miehle May 05 '10 at 13:46
3 Answers
Previous versions of both emacs-rails mode, and Rinari(the two most popular modes for Rails development) were very feature rich, but bloated and cumbersome. To maintain a small, clean, reliable, functional, and hackable core Rinari will shun much of the “bells and whistles” type functionality. However that is not to say that these extra goodies might not be useful.
This page should serve as marshaling point for links to some other tools/packages that work well with Rinari and Rails in general. If you have any ideas for additions to this list, or for new Rinari features please let us know at http://groups.google.com/group/emacs-on-rails.
Essential Major Modes for working with Rails
Ruby Mode, and some other general Ruby-Emacs goodies can be found in the /misc directory of your ruby distribution and at http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/misc/ (it's also bundled by default with Emacs 23.1)
CSS Mode http://www.emacswiki.org/cgi-bin/emacs/css-mode-simple.el
JavaScript Mode http://www.emacswiki.org/cgi-bin/wiki/JavaScriptMode#toc1 Other Tools
Rhtml Mode Minor Mode for editing rhtml files (without MMM-Mode) see rhtml-Mode
Snippets http://code.google.com/p/yasnippet/ and Rails snippets http://github.com/eschulte/yasnippets-rails/tree/master
ruby-debug support http://groups.google.com/group/emacs-on-rails/browse_thread/thread/dfaa224905b51487
ido Mode http://www.emacswiki.org/cgi-bin/wiki/InteractivelyDoThings
nxhtml-mode - the best mode for web development in Emacs - a great alternative of the rhtml-mode for editing erb files amongst many other things.
Most of this stuff is copied from Rinari's documentation. As you might have guessed I prefer Rinary over emacs-rails. Looking at the activity of both projects - emacs-rails hasn't had any changes for about an year, while rinary is still being developed.

- 55,802
- 13
- 100
- 117
-
Based on its description, Rinari sounds just like what I'm looking for, but the current version hosted on Github is broken, as I noted in [this comment](http://stackoverflow.com/questions/2713096/emacs-rails-vs-rinari#comment17458856_2736256). – Teemu Leisti Oct 15 '12 at 08:54
-
Personally I use [Emacs Prelude](http://github.com/bbatsov/prelude) for Rails development. The `projectile` extension that's bundled gives me the project navigation features that I need and I don't really care for the rest of Rinari's features. – Bozhidar Batsov Oct 15 '12 at 09:52
-
I added an answer about `projectile`. By the way, you were too modest to mention that it's your work. :) – Teemu Leisti Oct 16 '12 at 09:44
I use emacs-rails
and some modes to edit css, js (espresso-mode), haml, sass, yaml and a snippet mode (yas-snippet). For an overview look into the emacs wiki pages on Ruby on Rails..

- 4,733
- 3
- 28
- 43
I tried the Aptana Studio IDE (open-source), which handles Rails projects. I found I mostly used it for navigating among a Rails project's files, and since I prefer to use Emacs for editing files anyway, I've set Aptana aside for now. (But it might come in handy later when doing debugging, so I'm not dismissing it completely.)
I've recently tried different Emacs extensions to help with Rails development: ECB (Emacs Code Browser), Rinari, and something else I forget about, none of which I was entirely happy with, or couldn't get working. However, I'm now happily using projectile
, which Bozhidar Batsov mentioned in a comment above. It adds convenience to finding files within a project and grepping within them. It's not specific to just Rails projects, either.
Another very useful Emacs add-on I've recently discovered is the tabbar
extension, which works a bit like a browser's tab bars. I've tied the navigation among open tabs to my M-leftarrow and M-rightarrow keys, which makes switching among buffers much more convenient than before.
Continuing with Emcas, there's bubble-buffer
(code below), with which I can just press a key (F5 in my case) to switch the buffer contents to a recently visited file -- although tabbar
makes this a bit superfluous. I'm also including code to kill a buffer immediately with C-DEL, plus a couple of nice little functions that make it possible to scroll up and down a buffer while keeping the point constant, as long as it doesn't go off the screen; the code here binds them to the numeric keypad's *
and /
. (None of these are my own work.)
;; Use F5 to switch between buffers. Use C-DEL to remove the current buffer
;; from the stack and retrieve the next buffer. The most-frequented buffers are
;; always on the top of the stack. (Copied, with changes and a bugfix, from
;; http://geosoft.no/development/emacs.html.)
(defvar LIMIT 1)
(defvar time 0)
(defvar mylist nil)
(defun time-now ()
(car (cdr (current-time))))
(defun bubble-buffer ()
(interactive)
(if (or (> (- (time-now) time) LIMIT) (null mylist))
(progn (setq mylist (copy-alist (buffer-list)))
(delq (get-buffer " *Minibuf-0*") mylist)
(delq (get-buffer " *Minibuf-1*") mylist)))
(bury-buffer (car mylist))
(setq mylist (cdr mylist))
(setq newtop (car mylist))
(switch-to-buffer (car mylist))
(setq rest (cdr (copy-alist mylist)))
(while rest
(bury-buffer (car rest))
(setq rest (cdr rest)))
(setq time (time-now)))
(global-set-key [f5] 'bubble-buffer)
(defun kill-buffer-without-questions ()
;; Kill default buffer without the extra emacs questions
(interactive)
(kill-buffer (buffer-name)))
(global-set-key [C-delete] 'kill-buffer-without-questions)
;; Scroll up and down without moving the cursor by pressing the numeric keypad's
;; "/" and "*" keys.
(defun scroll-down-keep-cursor ()
;; Scroll the text one line down while keeping the cursor
(interactive)
(scroll-down 1))
(defun scroll-up-keep-cursor ()
;; Scroll the text one line up while keeping the cursor
(interactive)
(scroll-up 1))
(global-set-key [kp-divide] 'scroll-down-keep-cursor)
(global-set-key [kp-multiply] 'scroll-up-keep-cursor)

- 3,750
- 2
- 30
- 39