简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM