emacs-php / emacs-php/php-mode

Indentation inside of anonymous functions deletes code

Open
#132 4 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
Emacs Lisp
Stars
602
Forks
117
Avg merge
12h 54m
Merged PRs (30d)
3

Description

When `indent-tabs-mode` is enabled and a `tab-width` of 4, trying to indent a statement inside an anonymous function deletes some characters.

``` php
foo(function ($bar) {
test('baz');
});
```

With the cursor before `test`, pressing tab changes the line to

``` php
foo(function ($bar) {
t('baz');
});
```

The number of characters deleted seems to depend on the value of `tab-width`. With the brace on a newline, the problem doesn't occur

``` php
foo(function ($bar)
{
test('baz');
});
```

`php-mode-coding-style` is `pear`, but not set in my configuration, so it's just using the default. Running `php-enable-pear-coding-style` manually, then enabling `indent-tabs-mode` again seems to fix the issue in the buffer.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.