From Eclipse to Emacs: Drupal development with Subversion, tags, templates, and xdebug

| drupal, emacs

Yesterday, I started working on my Drupal project in Emacs. I can’t believe I hadn’t moved to Emacs earlier. =)

I really like being able to diff a file with C-x v = (vc-diff) and check in a file with C-x v v (vc-next-action). I also like the way that svn-status (from psvn.el) lets me examine a directory tree, mark a set of files, and commit them–all without using the mouse. I probably should’ve set up keyboard shortcuts for these in Eclipse, but Eclipse made it too easy to just use the mouse. Emacs encourages you to use the keyboard, and it’s easy to customize any keyboard shortcut.

php-mode’s C-c . (php-show-arglist) works beautifully with the TAGS file that I’d set up using Exuberant Ctags, so I don’t need to do anything special in order to get function definitions. Definition functions for PHP functions would be nice. In the meantime, there’s C-c C-f (php-search-documentation).

The yasnippet template engine came in handy when I was writing test cases. I updated my module template to include the simpletest hook, added a test case template, and added a template for the simpletest hook as well. Yay dynamic templates!

And I just got Xdebug working with PhpMode and Geben… Sweet!

You can view 7 comments or e-mail me at sacha@sachachua.com.

7 comments

Chris Aniszczyk

2008-07-29T15:12:14Z

You know that Eclipse ships with Emacs keybindings by default, they are actually pretty good.

Each to their own I guess ;)

Chris -- do you mean these?

http://eclipse-tools.source...

They look half-ass to me, e.g. no rectangle or register commands, C-x k doesn't take a buffer name, etc. The problem is that Eclipse lacks Emacs *features*.

Is there a good, easy to follow for the n00b guide for setting up emacs so it does PHP and subversion well? I've used emacs at times for various text file editing, but I'm not familiar with setting it up to do anything more complicated...

Why are you using psvn.el for examining a directory when there's vc-dired (C-x v d).

Just curious....

Torstein Krause Johansen

2008-08-06T11:54:01Z

Hi there,

great story! I assume you've also gotten a speed boost using Emacs rather than Eclipse? That's one of the reason I use Emacs and not IDEA, it's so much faster to work with. Even the input buffer is way slower in the big IDEs; I didn't learn to write fast just to wait for the IDE to catch up :-)

-Torstein

So, sacha - you've got me tempted to move back to emacs "full-time" from Komodo... your articles are *awesome*.

Just a quick note, I was having trouble with psvn.el failing to update. I tracked it down to the fact that it calls --non-interactive which apparently fails (for https authentication) on svn 1.5.1. I've ended up just patching out the --non-interactive part for now.

Man, I forgot how much I liked VCS / psvn ...

Keep up the awesome posts!

Hi,

Could you point us to any instructions on how to set Emacs up for PHP/Drupal with XDebug?

Thanks,

Pac