Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to fix php-mode indenting when using closures

I use php-mode in Emacs, it work fine execept when I use closures as argument like this:

$app->get('/', function() use ($app) {
        echo "foo";
    });

It seams that when function is inside function invocation the indentation is doubled. How to fix this?

EDIT

How to make it look like this (the same as javascript-mode handle anonymous functions).

$app->get('/', function() use ($app) {
    echo "foo";
});
like image 898
jcubic Avatar asked Sep 13 '26 05:09

jcubic


1 Answers

If you put point at the end of the first line and press C-c C-o, you can see what syntactic construct cc-mode thinks you're in the middle of, and customize how it indents that construct. I don't have php-mode on my current computer, but I think setting this to zero worked reasonably well back when I was doing PHP.

like image 151
amalloy Avatar answered Sep 14 '26 18:09

amalloy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!