feklee
feklee

Reputation: 7695

php-mode suddenly indents differently

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.

Upvotes: 1

Views: 180

Answers (1)

juanleon
juanleon

Reputation: 9380

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 +))))))))

Upvotes: 1

Related Questions