RubyMine has support for certain things like decent ruby editor, showing multiple files at a time(i am assuming it works well, because this was supported in IntelliJ Idea when i used it last), ruby debugging and auto-generatable snippets, but it lacks on certain other fronts. For example, it does not have Haml editor and no key-binding to jump between related entities(controller, model, view, spec, helper etc). However, the major drawback with RubyMine is its resource footprint. I have seen developers force shutdown their OS X (running on MacBook Pro) because RubyMine decided to go unresponsive and `kill -9 <pid>` failed to get rid of it. Even GNU/Linux users are forced to kill it sometimes because it freezes too often(however `kill -9 <pid>` does work reliably on Linux, hence no operating system restart required ;-)). JavaScript support is dumb and doesn’t highlight errors too well. I do give it some points for navigation and searching though.

TextMate unlike RubyMine is light on resource footprint. But unfortunately, it also is low on features. Ruby editor is decent, but auto-completion is retard(it completes words from the current buffer(file) only). Besides, key binding for auto-complete(which is such a common operation) is Esc(no touch-typist in the sane world would like that). It has no debugging support at all, and running rspec needs a plugin which in turn needs rspec installed as a gem, and if you have a frozen version of rspec/rspec-rails in your application codebase, then tough luck(there is no easy way to configure it to pick things up on a per project basis, you need to roll your sleeves up and dig into /Application/TextMate.app, to modify some badly written ruby/shell-script mess). Navigation and searching is horrible(slow and unintuitive). Command-T has no notion of priority, and brings up all the wrong files first. Haml support has to be installed seperately as a plugin, and is terrible(be it indentation, or syntax hilight). There is no interactive console and no spliting of windows supported.

There is more that i expect from an editor before i call it a good programming environment. Here is what I think my definition of good programming tool looks like(in addition to the features in the bulleted list above):

Ablity to run multiple terminals within the editor

Ability to open directories as buffer(allowing easy selection of files)

Ability to run IRC client(i like to be on IRC channels all the time, helping people and seeking help is a great way to learn)

Snappy frontend and sensible keystrokes(close to the host row, not forcing user to get out of touchtyping mode too often)

Straightforward key-bindings for macro record and play.(Both TextMate and RubyMine claim to have Macro support, but its hidden somewhere under the MenuBar-Submenu(s))

Ability to run commands without leaving the editor or creating a terminal within it.

Emacs is a pretty powerful and mature editor which has passed the test of time and has got several refinements and enhancements over the years it has lived. Most of the major things that i want in my development environment are bundled with Emacs out of the box(and the once that aren’t, are available as plug-ins). I believe the best thing about Emacs is its written in lisp, which means you can change things very easily and cleanly. I do Ruby/Rails development in my day job, and have been customizing my Emacs repository for some time now. Over a period of time, i have accumulated/tweaked some emacs goodies which have not only made Emacs a better Ruby, JavaScript, Lisp, C++ editor, but a better IRC, Mail, RSS, Atom and News client. I keep my add-ons and customizations on github.com as a public repository, which helps me share it with other developers, and also gives me protection against disk failures and other bad things.
So here is what my setup looks like.

Ruby: ruby-mode(written by Matz) + ruby-electric(minor mode)

Haml: haml-mode(Nathan Weizenbaum) (by far the best support for HAML syntax highlight and marvelous indentation strictness, people who write haml know how painful it can get in TextMate/RubyMine to hunt bad indentation and fix it, but not with Emacs)

JavaScript: I was waiting to come to this one. js2(Steve Yegge) has the best JavaScript editing support I have ever seen. js2 has remarkable indentation, very good syntax highlighting and terrific error detection(warns you even about missing var and semicolons, let alone the more obvious errors).

Auto completion: Of course. This one works across buffers, across modes and unlike TextMate’s `Esc` the key binding(M-/) is quite sane. You don’t have to go out of touch-typing mode, and the same shortcut can be used to browse through other possible completions.

Ruby Debugging: rubydb3x to rescue (rubydb2x for Emacs 19.2 and older). Just fire rubydb and get rolling. It uses GUD (Grand Unified Debugger), and has sensible(easy to remember) shortcuts(unlike F7, F8, F9 that most IDE(s) have). Some common key bindings are C-n for next line C-s to step in, C-f to finish function, C-r to resume and <, > to roll stack frames up and down(the name-space used is C-c, so it doesn’t override any of the usual actions that those shortcuts are supposed to perform).

Tag navigation: Navigation is a breeze. M-. to get to the implementation, M-* to pop out of it. I enhanced it to make it a look recursively up the directory hierarchy to find the tags file(a file named TAGS) and load it up and navigate seamlessly, all by itself. (etags doesn’t have ruby support, so use exuberant-ctags)(“/usr/bin/ctags -e -a –Ruby-kinds=-cmfF -o TAGS -R <dir_name>” can be used to generate a file named TAGS which emacs will read to navigate ruby code).

Test::Unit/Rspec tests: test-runner(a tiny add-on) runs your test as you load a test file, and then autoruns it every time the test file is saved. It supports Test::Unit by itself, I added support for Rspec(even running single spec) to it. Works like a charm, and is very easy to tweak.

Ability to show multiple files by splitting windows up: Do i need to say anything about windows support? Emacs is loved for this capability. However, navigation between windows was a bit painful before i added window-numbering.el (Nikolaj Schumacher), which made it sweet.

Ability to jump between related files: Rinari(Phil Hagelberg, Eric Schulte) uses jump(Eric Schulte) to make jumping between controller-model-view-helper-spec-test on a Rails project seamless and quick.

Runing interactive console: ruby-mode has a this hook called run-ruby(bound to C-c C-s), which can be used to start an interactive ruby session.While in a Rails project C-c M-s can be used to load script/console (irb with the project environment loaded).

Auto-generatable snippets: YASnippet(pluskid) has this awesome snippet support which can be used to selectively load snippets for a particular mode. Snippets can be overridden by adding a custom location to pick snippets from after loading the default snippets(no need to dive into library code base to make changes)

Ability to run multiple terminals: Not just one, there are multiple flavors of terminal supported within Emacs(ansi-term, shell and eshell to name a few). Each one has its own strong points, but they are all great.

Ability to open directory within a buffer: dired is your friend (its a full blown file manager).

IRC client: rcirc can be used to keep in touch with IRC channels. A line or two of lisp can be dropped in to change its default behavior(such as what channels to join, on which servers, using what alias… etc).

Snappy frontend and sensible keystrokes: Its has lower footprint than most other editors, TextMate and RubyMine are no match. I can not say it has not frozen ever, it does(but very occasionally). Even when it is frozen, 3 Esc hits or C-g can be used to abort the activity causing it to freeze. I don’t remember killing it(have been using it for more than a few months now). It just never gets that bad.

Straightforward key-bindings: I feel key-bindings are very carefully chosen. More common the key, closer it it to the home row index finger positions(f and j). Macro record/play is bound to C-x ( <definition> C-x ) (parenthesis make sense to developers at once, and i believe its quite intuitive a binding to define something. C-e can be used subsequently to play the macro(macros can be stored by numbers and names too). Even complicated keyboard shortcuts like kill-rectangle have sensible C-x r k (r -> rectangle, k-> kill), paste rectangle similarly is C-x r y (y -> yank). Navigation keys are C-n (n -> next), C-p (p -> previous), C-f (f -> forward), C-b (b -> backward). Sensible key bindings are much easier to remember. Orthogonality is maintained across actions C-u <x> <action> does something x number of times and works across different types of actions.

Running single commands: M-! can be used to run commands from within emacs(output is captured in a buffer and shown to the user).

In addition to these emacs comes with some not so well-known features(which need a little exploration), for example make-frame-on-display can create frames on other hosts(making pair-programming really simple). It has terrific Mail/News/Feed reader called Gnus, a beautiful mode for organizing yourself up called Org-mode and a host of other great things like TRAMP(Transparent Remote (file) Access, Multiple Protocol) which lets you edit remote files over a whole bunch of protocols(including ssh, smb, rcp etc) and also allows editing of local files as root(using su). It can open compressed archives(and edit files in place), java jars, PDF files, images…. you name it. Combined with dired, these capabilities make it a great tool. This post has only tried to explain what Emacs is capable of with respect to other editors, and trust me, I haven’t even skimmed the surface of it. One really needs to use it to find out what a brilliant tool it is.

It can be a little daunting for a beginner to set Emacs up from scratch(it is not difficult; its just takes some time and patience). I have spent time setting it up for myself, and I think it is a good setup to start with for people doing Ruby(Rails)/JavaScript and Lisp in general. My repository is available at http://github.com/janmejay/emacs. One of my motivations to put it out is to help other developers(especially people starting out with Emacs), so feel free to pull it up and take it for a ride.

Like every other powerful tool, Emacs has bit of a learning curve, but i believe it pays off, and it pays off pretty well. To a programmer, its not just an editor, it is a “friend for life”.

25 Comments

Nice job! This is probably the best compilation of Emacs help out there on the web right now specifically targeted at Ruby/Rails developers. I work on Windows which is not all that great – so next I’m going to read your article on GNU/Linux that I’m seeing below. Thanks again -

Just came across a broken submodule reference(for vendor/cedet in http://github.com/janmejay/emacs), which is fixed now. The owner of the submodule(ed) repo probably deleted his repository from github.com, which caused the issue.

Strange comparison it seems your are trying to compare only editing features and ignore all other highlevel features. Also the comparison contains some errors. E.g. about RubyMine:
1. >For example, it does not have Haml editor and
>no key-binding to jump between related
> entities(controller, model, view, spec, helper etc).

3. > However, the major drawback with RubyMine is its resource footprint.

Yes your are right, RM isn’t just a lightweight text editor. Please compare code completion in RM and Emacs. Does Emacs tries to do any type inference? Does it provides code completion it erb? Any inspections about problems in code? Does Emacs provide in autocompletion or at least show somewhere db fileds of you active record models? Does emacs indexes your project files content to provide really quick text search?

After reading your comment, there are certain things that im really happy about. For instance, i didn’t know HAML support on RM was in cooking(its gonna be helpful to a lot of users, better late than never). But i based on my experience with TextMate, RubyMine and Emacs, the best support i have seen till date is on Emacs. Haml, unlike other markup languages, depends on indentation for the structure it generates, which means indentation support of the editor should be aligned towards it in some sense. So, while you people are at it, you may want to check out haml mode(and forks) for emacs on github.com. I was wrong about navigation within related entities(my apologies), the key binding is actually there, as you said is Alt + Shift + n.

Since i have been doing ruby development for a while now, and most of which has been around rails and having used TextMate, RubyMine, NetBeans and Emacs, i have formed a fairly well rounded opinion of editors for myself(on things that are and aren’t useful to me as a ruby/rails developer). So let me try to answer point 3 in the light of my RoR development experience:
Code completion in RM and Emacs:

> Usually you edit related things(like controller, its model, its spec, its view, model spec, and related lib files). I have not had a situation where auto completion in emacs failed to yield the result i want. Usually its needs the first few words(like ‘auth’ and then a M-/ completes it to authentication_required). If first choice is not what you wanted, you can continue pressing M-/ to reach the one you do(or refine the initial filter).

> RM on the other hand, as you say, does type interfacing and smart auto complete. The experience gets sour when you can’t get auto-completes for things that have been meta-programmed. Methods defined on the fly etc. Most ruby projects have parts meta-programmed using :symbols or ‘strings’, and completion in RM fails there(which means you either make mistakes by typing the method/variable name wrong or are forced to copy and paste).

> In fact, i have had several instances where the code being tested in a spec/test-case doesn’t even exist(TDD/BDD as some of us call it). Emacs auto-complete works even in these scenarios(the only time it does not work is when you type the token for the very first time. So as a developer(especially with a duck typing language) i don’t care about the type interface, because most of the times, you don’t even know what type of object is coming into a certain method as an argument(this is how people from the loosely typed language school put it “I don’t care if it is a duck or not as long as it swims and quacks”).

> database column name auto-completion: I know RM does it, but Emacs does it as well(because when you write migrations, you use the column names as tokens(words) in that) and as you start using column names and model/specs/where-ever, those tokens are available to you as any other token would be. Emacs doesn’t treat them any differently than any other set of tokens.

> ERB/HAML auto-completion: emacs does provide auto-completion on these as well, like i said, the auto-completion is token based, and as long as tokens are available, it works.

> Indexing and searching: I know RM does a lot of work on this one, it can be very helpful when developers use it. While emacs does not provide any indexing support, it does have free text searches(you can switch to dired buffer and select directories you want to search(all or some) and then search them. I agree that indexing and search capabilities in RM are good, but personally i almost never use full text searches(even with RM). What i do, is language tag navigation(from method/class/module/javascript-function) use to definition). While RM support for tag-to-def navigation is good, i fing exuberant-ctags based navigation in Emacs better. I said i love exuberant-ctags support because i have control over what should and should not be indexed(as tags), which means i can limit areas i want to go-to while looking for a tag’s definition on a per directory basis. I understand that not everyone wants this kind of controllability, but im not sure if RM has it for people who do.

> Emacs does have version control integration and its good:
> git : http://www.emacswiki.org/emacs/Git
> mercurial: http://www.emacswiki.org/emacs/MercurialMode
> bazaar : http://www.emacswiki.org/emacs/Bazaar
> subversion : http://cvs.savannah.gnu.org/viewvc/emacs/emacs/lisp/vc-svn.el?view=markup
> darcs: http://www.emacswiki.org/emacs/?action=browse;oldid=VcDarcs;id=DaRcs
Having said that, let me add that i do not prefer using version control from within my editor. I can’t talk for others, but i like to use the shell for version control(be it svn, git or bzr). Simply put, i find it much easier that way. Even though emacs has good version control support, you may or may not have noticed that its not on my feature list. I don’t need vcs overhead all the time(it is a necessary overhead for users to back files up and collaborate), and i use git/subversion on all my personal and office projects, but i need to know about it only when its time to do something with it. When i choose to add a new file to my project, i do not like the editor to push a prompt in my face asking me if i want to add the file to VCS(thats what RM does by default). As im replying to you(a jetbrains person) i have some amount of hope that you will use this as a positive feedback. My team has some RM users, and every time they add files to the project, RM irritates them(and i have never seen anyone of them pressing yes on the prompt). I think you should consider disabling VCS support by default and have an option for people to enable it if they want.

> Cucumber support: Search cucumber.el on github.com or check this one out : (http://github.com/michaelklishin/cucumber.el/tree/master). Once again, i have never used cucumber support in either(emacs/RM) , and i don’t know how many developers actually use it. But for people who do, its there.

I have a little feedback here(so while we are at it, let me bring it up). We@thoughtworks do a lot of pair programming, and usually one developer exposes a network file share and other mounts it. I have seen people using RM are forced to do a window un-focus and re-focus hack(or sync) before they start driving(to load all changes), because RM doesn’t prompt to load file changes when you start editing a file. It does so when you try to save it(which means, either your or your pair’s work is gonna be overwritten, or you will have to go through ugly and painful diff/merge cycle). Emacs on the other hand prompts you on the first keystroke and makes you choose to either reload or overwrite before you start making changes(so effectively, no-one’s changes are lost). I so love emacs for prompting me before i start making changes.

janmejay, thank you for detailed reply and some RubyMine feedback. I’ve found some interesting points in it =).

Honestly I don’t use Emacs and I should spend some time to learn it a little to make my answers more constructive. I want try to do honest (from my point of view) ruby IDEs comparison somewhen in future and I’ve found information from this article useful for me.

> vcs
> I can’t talk for others, but i like to use the shell for version control(be it svn, git or bzr).

Personally for me it is hard to use command line for it. I think that GUI support really saves my time.

>autocompletion
Yes, you are right. It is hard to do absolutely correct type inference in Ruby, but is possible to cover most cases. Also some IDEs (not only RubyMine, also Komodo and some other) allow to specify manually list of methods for some object which will be added to autocompletion.

RubyMine also supports cyclic autocompletion for all identifiers from current file (Code|Complete Code|Cycliс expand Work) and also our ctrl+space allow to autocomplete ruby symbols(:foo) using other mentioned symbols in current file.

Real problem with such simple word completion – false positives. E.g. Emacs may complete names of db fields using such completion but user cannot use it’s autocompletion list to extract some information about db fields of model. Let’s imagine that you have two models: Person and Company. Then Person.new. should show ONLY db fields and associations for :people db table. In this case RM’s autocompletion list wont contain db fields of table :company and Emacs will show useless code completion here. Such behaviour is hardcoded in RubyMine, i.e. RubyMine parses all migrations and knows which fields and methods(finders) will be dynamically added to corresponding model class.

> fing exuberant-ctags based navigation in Emacs better
I like this idea

> so love emacs for prompting me before i start making changes.
Thank you you are right.

> so love emacs for prompting me before i start making changes.
Thanks, I hope we can fix this =)

Glad to know the feedback was helpful.
In practical day to day development, i seem to find token/word completion very helpful. I didn’t know RM has word completion at file level(TextMate does the same too), but its a lot more helpful when its done across files(buffers, in case of Emacs).
Between RM and TextMate, i have seen people on my team prefer TextMate, not because its feature rich(it doesn’t have debugging for instance, which is very important), but because RM is resource hungry which makes it slower. I believe selective enabling of features can really make it much better(for instance multi-buffer auto-completion combined with turning type interfacing off may make RM really powerful and fast. If i was not an Emacs user, i would have loved to have RM(minus resource hungriness) as an alternative to TextMate/NetBeans.
Simplicity is another turn-on. TextMate and Emacs do a great job of presenting a very simple and uncluttered view to the developer. In my emacs setup, even menu bar and scroll-bar are turned off. Simplicity goes a long way in making a tool more appealing.

Emacs is probably too powerful and mature(23 releases down) to be matched against any other tool(i guess even vim, which is the only other editor that i really respect), and Emacs and Vim are free softwares, which interest a different set of audience(people who are particular about ideology and licenses). Emacs/Vim have relatively steep learning curve as well, hence do not excite too many users. TextMate on the other hand(in my opinion) will not stand a chance if RM can cut some weight. RM is natural choice to IntelliJ Idea users(i started my journey with Ruby using IntelliJ Ruby/Rails plugin(s)) so it has a sight advantage there. To top that, there is no TextMate for GNU/Linux or Windows.

Now when I try to look at the implementation of say before_filter in my rails code, emacs asks me for the TAGS file location. I take it to the TAGS file location and it barfs saying TAGS is not a valid tags table.

Now when I try to look at the implementation of say before_filter in my rails code, emacs asks me for the TAGS file location. I take it to the TAGS file location and it barfs saying TAGS is not a valid tags table.

I read your post Emacs: setup geared towards doing `Ruby based Web-Applications` and tried to install and set it up my computer but the result was a complete disaster.

I have to and admit that I’m new to Emacs but figured I could follow the instructions and get the setup to work. It was very difficult to determine what directory I should be located in when I was trying to execute commands. The very first part installing python and pymac was very confusing and could never understand what to do!

I would still like to try to get your setup to work but I don’t know what or how to proceed. I’m trying to set this up on a Macbook Pro running Mac OS X 10.5.8. Any help you could give me would be deeply appreciated.

You do not need pymacs if you don’t need python auto-suggest/refactoring support.
You can comment out the following lines in custom/behaviour.el
;; ropemacs configuration
(setq ropemacs-enable-shortcuts 'nil)
(require 'pymacs)
(pymacs-load "ropemacs" "rope-")

you can also comment out
(add-hook 'python-mode-hook 'my-python-mode-hook)

which will ensure pymacs stuff does not interfere with python-mode.

The repository git://github.com/janmejay/emacs.git is the ~/.emacs.d directory, you can clone it using
$ git clone git://github.com/janmejay/emacs.git .emacs.d

while you are in home directory(~).

~/.emacs must load the emacs.el file from the repository, which loads all the enhancements. Executing
echo "(load-file \"~/.emacs.d/emacs.el\")" >> .emacs

while you are in home directory should suffice.

There are things that you can avoid if you don’t care about specific things. For instance, you don’t need to worry about elib if you don’t need jdee(java) support. You can comment out
(require 'jde)

in .emacs.d/emacs.el.

Additionally if you do not need erlang support you can comment out all lines in .emacs.d/defunkt/erlang.el.

I intend to come up with a shell script to automate this process, but that may take time.

There is another branch named old_mac_branch that i do not maintain or use anymore. Its the snapshot of the way this repo was configured when i was using it with carbon-emacs on OS X leopard. It may be a good starting point, but you probably want to move to master once you are more comfortable with emacs.

Most importantly, get comfortable with elisp. Its will go a long way in helping you tweak emacs to your taste.

This is actually not a problem with your git version. It usually happens when a repo re-writes history. As in, the repo owner decided to remove a commit or modify tree for an existing commit.
Changing public commits is acually a bad development practice, but in this case, since cedet repo is just a mirror, it has to track what happens upstream.

Anyway, I have archived and uploaded my local copy(it should expand to a directory named emacs, which you can then either symlink ~/.emacs.d -> or just rename to ~/.emacs.d).

I have fixed the repository. The fixes are:
1. deleted cadet(cadet is now bundled, so no point carrying another copy around)
2. enabled ecb(works like a charm with the bundled cedet)
3. removed jde(it messes up ecb and apparently is known to have problems with the bundled version of cedet(haven’t verified this one)), besides i don’t use it.

PS: you want to ‘git submodule update –init’ on the base directory, and then switch to vendor/rinari and fire up ‘git submodule update –init’ again(the second one will take care of pulling jump.el etc).

Thanks for updating the repository — I ran into some of those issues yesterday with the archive you sent. Thank you very much for your responsiveness to a 2-yr old blog post! This is a very nice resource you are sharing, however, I think people should be aware that just plugging in someone else’s large cache of elisp code is not likely to work well. There are just too many emacs configurations out there and too many chances for things to clash.

Probably the best way to add these resources is to do it one at a time. Then you get to test each one and it’s easier to troubleshoot if something doesn’t work right. Plus you get a little start on learning what each extension is supposed to do.

I started out doing this the other day and ran into a problem with some module, and thought I’d take a short cut by just installing your repo. Turned out to be a long cut. Spent most of the day yesterday trying to get it to work and ended up scrapping the whole thing and going back to the one-at-a-time route, which mostly worked, and it was handy to have your repo to drag things from.

First thing that happened when I tried just loading your repo was that Aquamacs (2.2) loaded a bunch of files and suddenly shrunk to postage-stamp size in the corner of the window. Turns out that there are 4 or 5 files in your repo that have comments like the following:

;; 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.

I removed all the related code, which fixed the postage stamp problem, but my fonts were uglified badly enough that emacs was nearly unusable. Changing mac-allow-anti-aliasing to t in init/view.el fixed that.

Then I found that css-mode was not working correctly. Your repo pulls in an old version that overrides the css-mode that comes with emacs, a bad thing.

Finally I ran into the ecb-commented-out thing. I tried uncommenting it and got errors, and since one of the main things I wanted was ecb, at that point I removed the link to your repo and went back to installing things one at a time (in ~/Library/Application Support/Aquamacs Emacs, which is aquamac’s preferred location.) I started with cedet again, then discovered that it was already bundled and could be activated with a few incantations in .emacs. After that, installing ecb worked and then I installed selected other things, either from your repo (including rinari!) or downloading them. So mostly I think I’ve got what I need— now I just need to figure out how to use them.

I am disappointed in ecb. I just started learning rails and programming my first app last week. I started out with emacs but found it overwhelming to deal with all those files in different directories, so I switched to Textmate so I could use the sidebar. It is a beautiful program visually and the sidebar is a terrific help– I was quite productive over the weekend even though I didn’t take the time to learn any of its features. (And as you mention, the indentation is horrible.) In the long run, however, it won’t do as I’m too hooked on emacs. I kept feeding Textmate emacs key sequences, some of which worked and some of which sent the program into conniption fits.

I thought ecb would be a good replacement for the textmate sidebar as I’d seen screenshots, but it doesn’t really seem to work like that. It’s ugly, and it brings up a ton of little windows with meaningless names like “W-0″ and “W-1″ and by default the mouse doesn’t work with it on the mac. Even after changing the mouse customization, the mouse doesn’t really work the way you’d expect, and I can’t find any good documentation on the program (If you have any suggestion in that regard I’d appreciate it). The docs on http://ecb.sourceforge.net/ go into long-winded discussions of trees and leaves without really telling you how to use the program.

Anyway, I hope my report of my experiences helps some readers, and thanks for your help. Even if plugging in your repo didn’t work, the information you have shared has been a great help.

Actually, the repo is tuned to work with GNU Emacs on GNU/Linux(to be very specific, Gentoo, Arch and Debian). There are things like pymacs and rope etc that are pulled from OS’s bundled packages, slime which calls out to SBCL etc. So I think it ‘drop it in and it works’ kinda thing is likely to be bumpy with a different OS. I was an OSX leopard user in 2008-09, but back then I was using it with Carbon Emacs. Had never tried having it work with AquaEmacs, so im glad you reported this here. After moving back to GNU/Linux, I made some changes that indeed may have added to making it less compatible with MacOS. So I agree, for experienced Emacs users, pulling it in piece by piece is probably the right thing to do.

About sidebar, my suggestion is, don’t dump on ECB just yet, its a pretty powerful and nifty tool. I have been a TextMate user for over an year so have given it a fair shot and didn’t find its sidebar nearly as useful as that of ECB. But like you pointed out, ECB is a keyboard based tool. I understand what you mean when you say it doesn’t work too well with mouse. However, for better navigation between windows, I use something called window-numbering mode, which provides me M- based(where n is window number, starting at top-left corner with 1) navigation between windows. I find it especially useful while in ECB windows. About the multiple splits in sidebar, I think you probably want to switch to a different layout(M-x ecb-change-layout (press TAB on the prompt to see a listing of layouts that come bundled with ECB)). You also may want to checkout this thing called ‘speedbar’ which renders just a navigable tree(like TextMate) unlike many of ECB layouts that render multiple windows, each for a specific purpose. However, having said all that, ECB is indeed a keyboard based tool, so is not the right choice if you want to use the mouse. I am not sure if speedbar is the same too, so you probably want to check it out. But honestly, I never try to reach out to the mouse while im wired to emacs(infact, i’d really hate it if i was forced to) because the keyboard in emacs is just so well done!

There is another interesting extension named textmate-mode, which allows M-t(textmate lookup file) style navigation within repositories(idenfified by .git or .hg etc). I have enhanced it to make it work better with with conflicting file names/conflicting sub-paths and all of those enhancements are available in the repo. Once you start using this extension for navigating the repo and get comfortable with rinari jumps, you’ll not need the vanilla sidebar anymore. However ECB sidebar still comes in handy because it shows you other interesthing things like methods in a class, history of files you opened(with parent paths) etc.

Thanks very much for the useful comments. You talked about auto-completion above. What should I have M-/ bound to? Right now it’s bound to “hippie-expand” which I’m pretty sure is not the right thing for rails but what should it be? Where does the information come from? I downloaded ecstatic ctags (by the way your example command to create tags has some typos) and so I have a tags file but AFAIK normal emacs tags does not have a completion feature.

Well, i keep M-/ wired to dabbrev-expand(i like this one). This is general symbol based auto-completion(rather than a ruby specific one). However, you probably want to look at .emacs.d/vendor/collection/ruby/ri-ruby.el for more details. I use exuberant-ctags(have never tried ecstatic ctags, will read up about it). I still use the command, so i think there is some difference in arguments exuberant-ctags and ecstatic-ctags expect. If you want tag based completion, you probably want to use ‘M-x complete-tag'(i mean wire it to the keymap or something). I don’t have ri-lookup wired up to a shortcut. I never felt the need for it(i guess my style of working is partly responsible for that). I tend to dive into the source more often than lookup documentation. Whatever documentation i actually read is in source files, i read it while browsing. The disadvantage of this approach is that it requires inherent familiarity with the codebase you are browsing, but the advantage is more prominent when the subject codebase is sparsely documented. Ruby-extension does expose really good ri support, but for gems you install, its upto you to ensure ri-pages are installed as well(people often skip rdoc and ri).

git submodule update from .emacs.d fails with the following error …
Cannot get remote repository information
Perhaps git-update-server-info needs to be run there ?
Clone of http://….ecb.git into submodule path ‘vendor/ecb’ failed

Peeking in to .gitmodules, the following defn is pointing to http instead of https
[submodule “vendor/ecb”]
path=vendor/ecb
url=http://github.com/emacsmirror/ecb.git

Interested to know your take on refactoring support on emacs for rails.
I found RubyMine has support for some of the common refactoring like extract method, introduce parameter …

About the ecb repository, it seems to work just fine for me. Are you behind a proxy that enforces https? May be you want to check the communication using wireshark, tcpdump or something. Or it may have something to do with github servers in your region. github.com for me resolves to 207.97.227.239. Hope this helps.

About refactoring, I was a RubyMine user a while back and have had good and bad experiences with it. Good for simple extract variable stuff, and bad with rename-method kinda refactoring. The problem is with a dynamic language with no type-checking and compilation, its so easy to get stuff wrong. I have stopped trying to do tool-assisted refactoring on Ruby code. I still write a lot of Ruby code but atleast for me there is no value in kind of refactorings the tools can get right and the annoyance of having to check ‘git diff’ everytime I try one is just too much of an overhead.

The kind of refactoring(s) that actually give you value are ‘extract module with common implementations’ etc, but tools do not support that kinda stuff. Besides, even if tools did support, you wouldn’t trust it after it has messed it up a few times.

I still prefer Emacs for everything other than Java(IntelliJ community-edition is my tool of choice for hacking Java).

Given my opinion of tool-assisted refactoring for dynamic languages, i haven’t bothered to dig deep into this, but something called ropemacs exists for python. Rope actually runs within an inferior Python VM, and performs smart auto-suggests and allows accurate refactoring(s). I wonder if there is something similar out there for Ruby. I wanted to write one but never had enough time of my hand.

IntelliJ Idea bundles some seriously kick-ass support for Java refactoring(s) but RubyMine doesn’t inherit it and doesn’t work for me.

About

Janmejay Singh

I’m a developer/consultant working for ThoughtWorks. I primarily work on Java, Ruby, Python, JavaScript and Lisp. I believe in Free Software philosophy and GNU project, and am generally interested in FOSS activities. Hacking is my hobby I happen to get paid for it…..