[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#46889: cperl-mode: Fix indentation issues [PATCH]
From: |
Lars Ingebrigtsen |
Subject: |
bug#46889: cperl-mode: Fix indentation issues [PATCH] |
Date: |
Thu, 04 Mar 2021 18:31:37 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
haj@posteo.de (Harald Jörg) writes:
> As a by-catch, the new code fixes the ancient Bug#8077.
>
> This patch also fixes the first part of Bug#11733. The "other
> indentation bug" reported in Bug#11733 (using a colon as a Perl regexp
> terminator) is a different story and not covered by this patch.
>
> Also fixed now (without known bug number): labels with a space before,
> or a comment after the colon are now correctly indented and fontified.
Sounds good.
> With this patch in effect, CPerl mode should finally have caught up with
> Perl 5.30!
:-)
> Many thanks to Mattias Engdegård for his patient explanations how rx
> expressions can be used without breaking compatibility to Emacs 26.1.
> Until now, this allowed two ugly regexp literals to be eliminated.
Funnily enough, that's the one thing I was going to ask you about with
this patch.
I'm not an experienced rx user -- at all -- but is this the best way to
do this?
> +(eval-and-compile
> + (defconst cperl--ws-rx
> + '(sequence (or space "\n"))
It was the eval-and-compile that made me look at this bit...
[...]
> +(defconst cperl-maybe-white-and-comment-rex
> + (rx-to-string `(group (eval cperl--ws*-rx)))
I'm thinking of the rx `eval' things everywhere. Wouldn't defining
these rx expressions with `rx-define' be more straighforward, and then
you'd have:
> +(defconst cperl-maybe-white-and-comment-rex
> + (rx-to-string `(group cperl--ws*-rx))
(Similarly for basically all the rx `eval' bits.
Now, rx expands the `eval' at compile time, I think, so it doesn't
really make that much difference in practice, but it seems slightly
clearer, perhaps?
(Added Mattias to the CCs.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug#46889: cperl-mode: Fix indentation issues [PATCH], Harald Jörg, 2021/03/04
bug#46889: cperl-mode: Fix indentation issues [PATCH], Harald Jörg, 2021/03/09
bug#46889: cperl-mode: Fix indentation issues [PATCH], Harald Jörg, 2021/03/09