From: "Harald Jörg" <haj@posteo.de>
To: "Paul W. Rankin" via "Emacs development discussions."
<emacs-devel@gnu.org>
Cc: Eli Zaretskii <eliz@gnu.org>, "Paul W. Rankin" <hello@paulwrankin.com>
Subject: Re: Please do not deprecate perl-mode in favour of cperl-mode
Date: Sun, 03 Dec 2023 13:20:56 +0000 [thread overview]
Message-ID: <875y1fzakn.fsf@oook.m.uunet.de> (raw)
In-Reply-To: <432593e94d8f9316cce77962a0598c23@purelymail.com> (Paul W. Rankin's message of "Sun, 03 Dec 2023 18:21:19 +1000")
"Paul W. Rankin" via "Emacs development discussions."
<emacs-devel@gnu.org> writes:
> On 2023-12-03 17:07, Eli Zaretskii wrote:
>>> C Perl Mode has several quirks that make it behave unlike a normal
>>> Emacs
>>> Major mode, including:
>>> - unorthodox code indentation
>>> - behaviour of TAB on region does not perform indent-region
>>> - use of specific faces instead of font-lock-* faces
>> What if CPerl mode would optionally support the above as well?
>> Would
>> it be acceptable then for you to switch?
>
> I would love to take advantage of whatever CPerl Mode advantages exist
> if CPerl Mode could do the things that Perl Mode does. And I think it
> should be easy and clear to the user how to set these options.
>
> Here's a minimal example of perl code that indents in a way I find
> unexpected in CPerl Mode (e.g. the trailing paren should line up with
> the start of the statement):
>
> $r->get(
> '/test'
> );
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'
);
> 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!
> One more thing...
>
> CPerl Mode has a feature the applies the `underline' face to leading
> whitespace before point and there doesn't appear to be an option to
> disable this. It's not a huge thing, but Whitespace Mode provides this
> feature and it's just a weird addition to hardcode and not use
> 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'.
>>> I don't wish to dampen the enthusiasm of the originator of this
>>> Perl->C
>>> Perl idea, but I would implore you to please first address C Perl
>>> Mode's
>>> shortcoming as a 1:1 replacement for Perl Mode before the
>>> baby/bathwater? C Perl Mode should at least work as well as Perl Mode
>>> before deprecation is considered.
>> Deprecation doesn't mean removal. Even obsolete packages are still
>> available, and some of them will not be removed. So if you insist on
>> using Perl mode, you will be able to do so for the years to come, even
>> if we deprecate and obsolete it.
>
> This is cool. My opinion is that CPerl Mode is (currently) too weird
> and idiosyncratic to be Emacs's default mode for perl (e.g. what the
> heck is `cperl-hairy' or `cperl-fontify-m-as-s'?) and will likely lead
> to more confusion than productivity/joy. But maybe if someone wants to
> take a hard look at CPerl Mode from a user friendliness perspective?
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.
--
Cheers,
haj
next prev parent reply other threads:[~2023-12-03 13:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-03 6:36 Please do not deprecate perl-mode in favour of cperl-mode Paul W. Rankin via Emacs development discussions.
2023-12-03 7:07 ` Eli Zaretskii
2023-12-03 8:21 ` Paul W. Rankin via Emacs development discussions.
2023-12-03 8:34 ` Eli Zaretskii
2023-12-03 8:42 ` Emanuel Berg
2023-12-03 13:20 ` Harald Jörg [this message]
2023-12-29 3:44 ` Paul W. Rankin via Emacs development discussions.
2023-12-29 9:33 ` Stefan Kangas
2023-12-29 15:07 ` Harald Jörg
2023-12-29 21:52 ` Stefan Kangas
2023-12-30 21:10 ` Harald Jörg
2023-12-30 22:50 ` Stefan Kangas
2024-01-02 17:18 ` Harald Jörg
2024-01-02 17:33 ` Stefan Kangas
2023-12-03 10:10 ` Harald Jörg
2023-12-29 3:48 ` Paul W. Rankin via Emacs development discussions.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875y1fzakn.fsf@oook.m.uunet.de \
--to=haj@posteo.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=hello@paulwrankin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).