2

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

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
Paul Salber
  • 700
  • 6
  • 12
  • 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 Aug 29 '11 at 11:37
  • 1
    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 Aug 29 '11 at 11:52

1 Answers1

2

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

Paul Salber
  • 700
  • 6
  • 12