cperl-mode icon indicating copy to clipboard operation
cperl-mode copied to clipboard

Extra space in keyword expansion

Open r39ex opened this issue 8 years ago • 3 comments

With cperl-electric-keywords set, when typing if + space I get an expanded construct like this (_ is point):

if ( _) {
}
  1. Is this intended behaviour?
  2. If so, is there a setting or some other way to get rid of the extra space before point?

r39ex avatar May 27 '16 14:05 r39ex

I think the behavior is intended. Note that according to perlstyle spaces after the opening parenthesis is recommended for readability. For example if I run perltidy on this code:

if($foo==3) {
    say "Hello";
}

it will insert extra spaces like this:

if ( $foo == 3 ) {
    say "Hello";
}

hakonhagland avatar May 27 '16 14:05 hakonhagland

Yes, but timtowtdi =). That's why perltidy has an option like --paren-tightness. I would personally write it like this:

if ($foo == 3) {
    say "Hello";
}

r39ex avatar May 27 '16 15:05 r39ex

I don't think someone will fix this, and tend to close the issue unless someone objects.

renormalist avatar Oct 09 '18 21:10 renormalist