Configuring Emacs
This short snippet will extend the php-mode in Emacs to follow drupals coding style. Add this to your $HOME/.emacs:
(defun drupal-mode ()
(interactive)
(php-mode)
(setq c-basic-offset 2)
(setq indent-tabs-mode nil)
(setq fill-column 78)
(c-set-offset 'case-label 2)
(c-set-offset 'arglist-close 0))
(c-set-offset 'arglist-intro 2)
(add-to-list 'auto-mode-alist '("/drupal.*\\.\\(php\\|module\\|inc\\|test\\|install\\)$" . drupal-mode))
(add-to-list 'auto-mode-alist '("/drupal.*\\.info" . conf-windows-mode))This will automatically set you in drupal-mode if you load a .php, .module or .inc file from beneath a drupal* directory. You may also manually select drupal mode by hitting M-x drupal-mode.

Additional Features
Any way to make emacs indent array items in an array( ) declaration the way Drupal tends to keep them? Right now they look like:
return array('index' => 'value',
);
When they ought to look like:
return array('index' => 'value',
);
adding this to the
adding this to the indentation rules should do the trick
(c-set-offset 'arglist-intro 2)http://www.manalaa.net
This combo will also work:
(c-set-offset 'arglist-intro +) ;this value is already set by default in my emacs(setq c-basic-offset 2) ;this is redundant with the recommended code, above
I don't know why the original poster had a problem, since my setup works by default.
conf-windows-mode for .info files
The following will also enable conf-windows-mode for .info files inside drupal.* folders:
(add-to-list 'auto-mode-alist '("/drupal.*\\.info" . conf-windows-mode))Add install files to auto-mode-alist
You might want to turn this on for install files too:
(add-to-list 'auto-mode-alist '("/drupal.*\\.\\(php\\|module\\|inc\\|test\\|install\\)$" . drupal-mode))Roy Smith