all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: haj@posteo.de (Harald Jörg)
Cc: 46889@debbugs.gnu.org, "Mattias Engdegård" <mattiase@acm.org>
Subject: bug#46889: cperl-mode: Fix indentation issues [PATCH]
Date: Thu, 04 Mar 2021 18:31:37 +0100	[thread overview]
Message-ID: <87tupqvn9i.fsf@gnus.org> (raw)
In-Reply-To: <87im68uwld.fsf@hajtower> ("Harald Jörg"'s message of "Wed, 03 Mar 2021 15:43:10 +0100")

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





  reply	other threads:[~2021-03-04 17:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03 14:43 bug#46889: cperl-mode: Fix indentation issues [PATCH] Harald Jörg
2021-03-04 17:31 ` Lars Ingebrigtsen [this message]
2021-03-04 18:07   ` Mattias Engdegård
2021-03-04 18:16     ` Lars Ingebrigtsen
2021-03-04 18:23       ` Mattias Engdegård
2021-03-04 18:34         ` Lars Ingebrigtsen
2021-03-05 10:30       ` bug#46889: Help version guesser bug (was: bug#46889: cperl-mode: Fix indentation issues [PATCH]) Stephen Berman
2021-03-05 13:06         ` bug#46889: Help version guesser bug Lars Ingebrigtsen
2021-03-04 18:19   ` bug#46889: cperl-mode: Fix indentation issues [PATCH] Harald Jörg
2021-03-09 17:06 ` Harald Jörg
2021-03-09 17:18 ` Harald Jörg
2021-03-10 14:42   ` Lars Ingebrigtsen
2021-05-17 15:28     ` Lars Ingebrigtsen
2021-05-17 21:31       ` Harald Jörg
2021-05-18 13:47         ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tupqvn9i.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=46889@debbugs.gnu.org \
    --cc=haj@posteo.de \
    --cc=mattiase@acm.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.