tags:

views:

69

answers:

2

Hi all,

I'm a bit new to using emacs for webdevelopment. I am using php-mode and i am happy with it. There is only one issue i have which causes me a lot of problems because of our company's coding style.

When i have a function, e.g.:

$instance = new Model('foo', 'bar');

And I want to indent it like this:

$instance = new Model(
    'foo',
    'bar'
);

Emacs does the following when i insert a newline before the first argument and indents it like this:

$instance = new Model(
                      'foo',
                      'bar'
);

Can anyone point me in a direction on how i can configure/change this?

Thanks in advance

A: 

In you .emacs file of configuration add this line:

(setq standard-indent X)

Being X the amount of spaces you want to indent while hitting TAB.

Dez
Thanks for your answer.The indenting is fine after braces but not when I try to put the parameters of a function call onto the next line, see my example.
Danny
Then check this answer, it may suit your needs about indenting with emacs:http://stackoverflow.com/questions/1475279/how-to-control-indentation-after-an-open-parenthesis-in-emacs
Dez
+1  A: 

php-mode is actually build on top of cc-mode, so you can use cc-mode's indentation customization capabilities. Have a look here.

Bozhidar Batsov