[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#47902: cperl-mode: unwanted expansion of '$continue' [PATCH]
From: |
Harald Jörg |
Subject: |
bug#47902: cperl-mode: unwanted expansion of '$continue' [PATCH] |
Date: |
Mon, 19 Apr 2021 22:30:04 +0000 |
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.
--
Cheers,
haj
0001-cperl-mode-Avoid-abbrev-expansion-in-variable-names.patch
Description: Avoid expansion of "$continue"
- bug#47902: cperl-mode: unwanted expansion of '$continue' [PATCH],
Harald Jörg <=