[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Please do not deprecate perl-mode in favour of cperl-mode
From: |
Paul W. Rankin |
Subject: |
Re: Please do not deprecate perl-mode in favour of cperl-mode |
Date: |
Fri, 29 Dec 2023 13:44:19 +1000 |
User-agent: |
Purely Mail via Roundcube/1.6.5 |
Hello and very sorry for the lateness of my reply! I will respond
inline...
On 2023-12-03 23:20, Harald Jörg wrote:
This is how Perl mode indents it, isn't it?
CPerl mode has several predefined indentation styles, a recent addition
is to indent according to Damian Conway's "Perl Best Practices". This
can be activated with (cperl-set-style "PBP"). It _should_ be the
default these days, but it isn't for compatibility reasons. in PBP
style, indentation is like this:
$r->get(
'/test'
);
Ah this is excellent. "PBP" is indeed how I assume Perl should be
indented. But how do I set this as a user option, i.e. M-x
customize-option? I think M-x cperl-set-style is not easily discoverable
(i.e. I didn't find it). For my own packages I encourage user discovery
through M-x customize-group, but I think here cperl-set-style would
remain elusive...
Still on indentation, the main way CPerl Mode bumps me out of things is
that it doesn't indent the current region (like other programming
modes), only the current line. If CPerl Mode would indent the region on
TAB with "PBP" that would go a long way to making it feel more
approachable.
I also found weird behaviour with Electric Pair Mode; when point is at
`|' here and `{' is inserted, I get `{|}}', which seems incorrect
because it unbalances the braces (Perl Mode inserts `{|}'):
$r->get(
'/test',
sub {
|
}
);
This would indeed be a bug. Unfortunately, I can not reproduce it. If
you have a recipe to demonstrate the bug, then a bug report would be
welcome!
I narrowed this down to having electric-pair-inhibit-predicate set to
electric-pair-conservative-inhibit. I can't remember the reason I set
this. I guess it's only a bug if this is not as intended with that
option set.
One more thing...
something called `cperl-leading-whitespace-face'.
This seems to have been fixed already by Stefan Kangas. It used to be
the customizable face `cperl-invalid-face' but is gone now, in favor of
the option `show-trailing-whitespace'.
Cool. In general where CPerl mode departs from convention I think it
would be greatly appreciated to have an option to reign it back in ;)
I find the documentation of `cperl-hairy' and its customization
interface not too bad - but I am the wrong person to ask.
Anyways: CPerl mode has accumulated lots of options over the years.
Many of them, for example `cperl-fontify-m-as-s', can be safely ignored
and left at their defaults.
We will have more options to allow CPerl mode to look like Perl mode.
`cperl-fontify-trailer' is the first of the new options, to account for
the different treatment of text after __END__ or __DATA__ tokens.
Brilliant.
Something that may warrant a separate bug report is CPerl Mode's
departure from the use of font-lock-* faces in a few key faces. The big
advantage of sticking with the font-lock-* faces is that a user can more
or less define their own theme just by customizing these faces. The
faces in question are:
cperl-array-face
cperl-hash-face
cperl-nonoverridable-face
Each of which I think could benefit from instead inheriting from a
font-lock-* face by default, to make things look a little more
aesthetically pleasing. That said, I don't know which font-lock-* face
is most appropriate, maybe combinations e.g.
font-lock-variable-name-face plus bold plus underline.
- Please do not deprecate perl-mode in favour of cperl-mode, Paul W. Rankin, 2023/12/03
- Re: Please do not deprecate perl-mode in favour of cperl-mode, Eli Zaretskii, 2023/12/03
- Re: Please do not deprecate perl-mode in favour of cperl-mode, Paul W. Rankin, 2023/12/03
- Re: Please do not deprecate perl-mode in favour of cperl-mode, Harald Jörg, 2023/12/03
- Re: Please do not deprecate perl-mode in favour of cperl-mode,
Paul W. Rankin <=
- Re: Please do not deprecate perl-mode in favour of cperl-mode, Stefan Kangas, 2023/12/29
- Re: Please do not deprecate perl-mode in favour of cperl-mode, Harald Jörg, 2023/12/29
- Re: Please do not deprecate perl-mode in favour of cperl-mode, Stefan Kangas, 2023/12/29
- Re: Please do not deprecate perl-mode in favour of cperl-mode, Harald Jörg, 2023/12/30
- Re: Please do not deprecate perl-mode in favour of cperl-mode, Stefan Kangas, 2023/12/30
Re: Please do not deprecate perl-mode in favour of cperl-mode, Harald Jörg, 2023/12/03