From: "Harald Jörg" <haj@posteo.de>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: "Paul W. Rankin" <hello@paulwrankin.com>,
emacs-devel@gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: Re: Please do not deprecate perl-mode in favour of cperl-mode
Date: Fri, 29 Dec 2023 15:07:11 +0000 [thread overview]
Message-ID: <87v88hkpy8.fsf@oook.m.uunet.de> (raw)
In-Reply-To: <CADwFkmkeLZsA19VHBY1T+ANuoPeQWibi82ok3zPEDjs3TeG1BA@mail.gmail.com> (Stefan Kangas's message of "Fri, 29 Dec 2023 01:33:41 -0800")
Stefan Kangas writes:
> "Paul W. Rankin" via "Emacs development discussions."
> <emacs-devel@gnu.org> writes:
>
>> On 2023-12-03 23:20, Harald Jörg wrote:
>>
>>> 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'
>>> );
>
> BTW, how bad are the above mentioned compatibility concerns? If they
> are minor, perhaps we could change to the modern PBP style?
>
> AFAIK, the PBP book was released around 20 years ago, and it's style was
> pretty widely adopted by the Perl community from what I could tell at
> the time. It's been a long time since I last coded Perl seriously
> though, so I'm very much out of the loop.
>> 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...
I guess the reason why cperl-set-style was implemented as a command is
the fact that it sets a bulk of independent variables (11 for PBP) at
once.
> I think this is one example of CPerl mode being different from typical
> Emacs conventions. I think we should introduce a new defcustom with the
> same name so that this can be set from `M-x customize`.
The option you are looking for would be cperl-file-style (which is
rather new, Lars Ingebrigtsen implemented it for Emacs 29 as a response
to Bug#17948).
I can fix the discoverability: The option does not have a :group tag
defined, therefore it ends up in the stray customization group "Cperl
Help System". Instead, it _should_ be the first option in "Cperl
Indentation Details". Patch coming soon!
>> 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.
>
> Yet another case of CPerl mode being weird, and this one sounds a lot to
> me like a plain bug. Note that CPerl mode has several commands,
> including a separate one to indent the region, for some reason.
>
> Could you report this one as a bug so that we can discuss in more detail
> what, if anything, could be done about this?
Stefan Monnier suggested that we try to map TAB to
indent-for-tab-command. This seems to be the most generic way to bind
TAB to either indent-line, or indent-region, or insert a literal TAB
character. I have not yet looked into that (and I admit that I'm not
really familiar with the indentation code of cperl-mode.el).
>> 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 think we need to consider every case of that individually, so please
> do report bugs.
>
>> 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.
>
> This one warrants a bug report too, yes.
...and it is on my agenda. I had hoped to get it done quickly, but
underestimated the font-lock stuff cperl-mode does within regular
expressions (which are a language of their own).
--
Cheers,
haj
next prev parent reply other threads:[~2023-12-29 15:07 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
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 [this message]
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=87v88hkpy8.fsf@oook.m.uunet.de \
--to=haj@posteo.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=hello@paulwrankin.com \
--cc=stefankangas@gmail.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).