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

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!

One Pingback/Trackback

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

    Each to their own I guess ;)

  • sean

    Chris — do you mean these?

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

  • John Fiala

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

  • Pingback: An update Java development environment - credmp()

  • 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 :-)


  • 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!

  • WuPac


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