Starting with emacs -Q, I open a C file a.c and a Perl file a.pl. I turn on electric-pair-mode and electric-indent-mode in each.
In a.c, I enter the following, where the | shows the cursor position:
int foo() {
if (bar) {|}
}
I press Enter and get:
int foo() {
if (bar) {
|
}
}
Well and good. But in the Perl file, I start with:
sub foo {
if (bar) {|}
}
Then I press Enter and get:
sub foo {
if (bar) {
|
}
}
No matter the level of indentation, the closing brace is placed at the beginning of the line it's on.
I could hack my way around this irritation, but is there a simple way to get the same indenting behavior in perl-mode that I see in c-mode?