From: Stefan Kangas <stefan@marxist.se>
To: "Harald Jörg" <haj@posteo.de>
Cc: 47902@debbugs.gnu.org
Subject: bug#47902: cperl-mode: unwanted expansion of '$continue' [PATCH]
Date: Tue, 20 Apr 2021 15:56:41 -0500 [thread overview]
Message-ID: <CADwFkm=MZMJ7tugvD8y_JvazUy8k5b+dDyjmrpDChdZ4W1kJ-g@mail.gmail.com> (raw)
In-Reply-To: <87a6ptgb6b.fsf@hajtower> ("Harald Jörg"'s message of "Mon, 19 Apr 2021 22:30:04 +0000")
tags 47902 fixed
close 47902 28.1
thanks
haj@posteo.de (Harald Jörg) writes:
> The symptom: When typing "$continue", abbrev expansion kicks in and
> converts this to "$continue { }" - which immediately catches the eye as
> suddenly it is formatted as a hash access.
>
> How to reproduce from Emacs -Q:
>
> C-x b demo.pl <RET>
> M-: (setq cperl-electric-keywords t)
> cperl-mode <RET>
> $continue = 1;
>
> It is quite usual to activate 'cperl-electric-keywords', either directly
> or with the catch-all customization value 'cperl-hairy'.
>
> Root cause: The expansion routine in 'cperl-electric-else' attempts to
> verify that the keyword starts a statement, by jumping back over the
> keyword with (backward-sexp 1). For a scalar variable "$else" or
> "$continue", this expression also skips back over the dollar (which has
> syntax type "escape" in CPerl mode), and "$continue" does start a
> statement, so unwanted expansion happens.
>
> The patch replaces (backward-sexp 1) by (skip-chars-backward "[:alpha:]")
> and avoids skipping over anything which doesn't belong to the keyword.
Thanks! This makes sense and works fine here so I've pushed this to
master as commit c4c9a60c13.
I've made some minor adjustment of the commit message and added the bug
number. I also added a blank line before the "ends here" line as a
minor stylistic point.
prev parent reply other threads:[~2021-04-20 20:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 22:30 bug#47902: cperl-mode: unwanted expansion of '$continue' [PATCH] Harald Jörg
2021-04-20 20:56 ` Stefan Kangas [this message]
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='CADwFkm=MZMJ7tugvD8y_JvazUy8k5b+dDyjmrpDChdZ4W1kJ-g@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=47902@debbugs.gnu.org \
--cc=haj@posteo.de \
/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.