erlang/otp

erlang-shell for Emacs gives "Unbalanced parenthesis" error

aathn opened this issue · 1 comments

Describe the bug
Pressing tab in the erlang-shell for Emacs directly after startup produces an "Unbalanced parenthesis" error.

To Reproduce
Start Emacs, run M-x erlang-shell, press tab (or run indent-for-tab-command).

Expected behavior
No error should pop up. Nothing in particular should happen, provided erlang-tab-always-indent is t.

Affected versions
I tried this with OTP 27 and the accompanying erlang-mode, on Emacs 29.1.

Additional context
This bug is caused by the code for erlang-calculate-indent, which calls erlang-beginning-of-clause to move to the beginning of the previous clause in order to calculate the appropriate indentation. If erlang-shell was just started, this causes the point to move before the beginning of the first prompt, to the Eshell version string (Eshell V15.0 (press Ctrl+G to abort, type help(). for help)). Then, erlang-partial-parse is invoked, which results in a parse error giving rise to the message.

dgud commented

A PR solving this would be welcome :-)