1

After upgrading to EMACS 24.3 (I think from 24.2) and also upgrading the MELPA php-mode package to version 20130920.1850, php-mode now indents as follows:

array('a' => 1,
'b' => 2);

What it did previously:

array('a' => 1,
      'b' => 2);

How do I get back the previous behavior?

Update: Eventually, I filed an issue on Github, and the maintainer of php-mode confirmed that there is a bug.

feklee
  • 7,555
  • 9
  • 54
  • 72
  • Revert to the previous version of php-mode? – phils Sep 25 '13 at 10:20
  • 2
    Be warned that MELPA gives you the current head of a repository, which can easily be unstable, depending on the project in question. In this case it's from Github, so you could check the [issue tracker](https://github.com/ejmr/php-mode/issues) for php-mode, and log a new one if need be. – phils Sep 25 '13 at 10:27

1 Answers1

1

This is the ugly workaround I use while waiting for php-mode to fix this bug (it assumes you use the default php indentation style: pear). I had hoped for a quick fix, but it has been several months.

(eval-after-load "php-mode"
  '(progn
     (c-add-style
      "pear"
      '((c-basic-offset . 4)
        (c-offsets-alist . ((block-open . -)
                            (block-close . 0)
                            (topmost-intro-cont . (first c-lineup-cascaded-calls
                                                         php-lineup-arglist-intro))
                            (brace-list-intro . +)
                            (brace-list-entry . c-lineup-cascaded-calls)
                            (arglist-close . php-lineup-arglist-close)
                            (arglist-intro . php-lineup-arglist-intro)
                            (knr-argdecl . [0])
                            (statement-cont . (first c-lineup-cascaded-calls +))))))))
juanleon
  • 9,220
  • 30
  • 41
  • Thanks. However, I don't need the workaround. The latest version of [php-mode available from Github](https://github.com/ejmr/php-mode/) seems to indent fine, although [my bug report](https://github.com/ejmr/php-mode/issues/130) is still open. – feklee Feb 24 '14 at 10:03