2
votes

My problem is that with curly brackets in new lines, I am getting and additional indent, as shown in the code listed below.

I am using emacs 22.2 on debian-lenny, I have instaled php-mode.el from github

(https://github.com/ejmr/php-mode/blob/master/php-mode.el)

and my .emacs contains only key bindings (not for the indent)

if (logical condition)
       {
             avariable 
             #COMMENT 
             if (logical condition)
                 {
                     if(condition)
                          {
                               variable
................

I have tried PEAR mode on for all php files, I have tried tab-mode indents.

Please, what have I done wrong?

UPDATE:

The above is the default "GNU" indentation style. For standard php indentation add the following to your .emacs

(setq c-default-style "linux" c-basic-offset 4)

Answer found here: http://www.emacswiki.org/emacs/IndentingC#toc2

1
You should answer your own question, and then accept your answer. Also, Emacs 22.2 dates back to March 2008; you may wish to consider upgrading.phils
If you have not, you should try the nxhtml mode which is usually better when you're editing files containing more than php (like php and html).Arkh

1 Answers

2
votes

The above is the default "GNU" indentation style. For standard php indentation add the following to your .emacs

(setq c-default-style "linux" c-basic-offset 4)

Answer found here: http://www.emacswiki.org/emacs/IndentingC#toc2